Skip to content

Add event system with metrics and typings - #9

Merged
c3c43083 merged 6 commits into
mainfrom
fix-monitoring
Aug 28, 2025
Merged

Add event system with metrics and typings#9
c3c43083 merged 6 commits into
mainfrom
fix-monitoring

Conversation

@c3c43083

Copy link
Copy Markdown
Contributor

Introduces Event.js implementing a publish/subscribe event system with Prometheus metrics tracking, and Event.d.ts for TypeScript definitions. Updates package.json exports to use the new event files.

Introduces Event.js implementing a publish/subscribe event system with Prometheus metrics tracking, and Event.d.ts for TypeScript definitions. Updates package.json exports to use the new event files.
@canmingir
canmingir requested a review from Copilot August 28, 2025 06:42

This comment was marked as outdated.

Eliminated unnecessary inline comments from Event.js, Event.ts, and Event.d.ts to improve code readability and maintain consistency. No functional changes were made.
Changed logging from console.debug to console.log for subscription and unsubscription events. Also removed some redundant comments to clean up the code.
Adds error handling for JSON.stringify when calculating payload size in the publish function. If stringification fails, logs the error, increments an error metric, and sets payload size to 0 to prevent crashes.
Deleted an unnecessary comment related to tracking unsubscription in the subscribe function for improved code clarity.
Removed src/Event.js and src/Event.d.ts, consolidating all event logic into src/Event.ts. Updated package.json build script to compile src/Event.ts. This change improves type safety and maintainability by using TypeScript directly for the Event module.
@canmingir
canmingir requested a review from Copilot August 28, 2025 09:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Refactors the existing event system by updating imports, removing comments, and modifying the build configuration to support compiled JavaScript output with TypeScript definitions.

  • Updated import statement from default to namespace import for prom-client
  • Removed inline comments throughout the metrics tracking code
  • Modified package.json to build TypeScript files and export compiled JavaScript with type definitions

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Event.ts Updated prom-client import and removed inline comments from metrics code
package.json Added TypeScript compilation step and updated exports to use compiled .js and .d.ts files

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread package.json
Comment thread package.json
@c3c43083
c3c43083 merged commit dada2f8 into main Aug 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants