-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CU-86epthegu Log consumer run options and log notice when batch messa… #3
base: master
Are you sure you want to change the base?
Conversation
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (19)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughThe changes involve updates to the Changes
Sequence Diagram(s)sequenceDiagram
participant KafkaBatchServer
participant Logger
KafkaBatchServer->>Logger: Initialize logger with class name
KafkaBatchServer->>KafkaBatchServer: bindEvents()
KafkaBatchServer-->>Console: Log 'CHECK: this.options.run'
KafkaBatchServer->>KafkaBatchServer: handleMessage(messages)
KafkaBatchServer-->>Logger: Log batch message details
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Outside diff range and nitpick comments (1)
lib/kafka.server.ts (1)
58-68
: Consider enhancing the log metadata structure.While the logging implementation is good, the metadata structure could be improved for better readability and consistency.
Consider this structure:
this.logger.log( - '[KAFKA] Batch messages received', + 'Batch messages received', 'handleMessage', { - topicName: payload.batch.topic, - partition: payload.batch.partition, - numberOfMessages: payload.batch.messages.length, - firstOffset: payload.batch.firstOffset(), - lastOffset: payload.batch.lastOffset(), + kafka: { + topic: payload.batch.topic, + partition: payload.batch.partition, + batch: { + size: payload.batch.messages.length, + offsetRange: { + first: payload.batch.firstOffset(), + last: payload.batch.lastOffset() + } + } + } } )This structure:
- Removes redundant "[KAFKA]" prefix as it's already clear from the context
- Groups related fields under a "kafka" namespace
- Provides better nesting for batch-specific information
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
lib/kafka.server.ts
(4 hunks)
🔇 Additional comments (2)
lib/kafka.server.ts (2)
10-10
: LGTM! Good use of NestJS Logger.
Using the built-in NestJS Logger with the class name provides consistent logging and proper context throughout the application.
Also applies to: 26-26
Line range hint 52-52
: Verify the impact of type mismatches.
The code contains multiple @ts-expect-error
comments indicating interface mismatches with the parent class. While not directly related to the current changes, these type issues should be tracked and addressed.
Let's analyze the type mismatches:
Consider creating an issue to track the resolution of these type mismatches, as they could lead to maintenance challenges in the future.
Also applies to: 53-53, 92-92, 93-93
console.log( | ||
JSON.stringify(this.options.run, null, 2), | ||
'CHECK: this.options.run', | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Replace console.log with structured logging.
The current console.log appears to be debugging code and should be replaced with proper structured logging using the NestJS Logger.
Replace with:
- console.log(
- JSON.stringify(this.options.run, null, 2),
- 'CHECK: this.options.run',
- );
+ this.logger.debug(
+ 'Consumer run options',
+ { options: this.options.run }
+ );
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
console.log( | |
JSON.stringify(this.options.run, null, 2), | |
'CHECK: this.options.run', | |
); | |
this.logger.debug( | |
'Consumer run options', | |
{ options: this.options.run } | |
); |
This does nothing more than add 2 log statements and commit the dist folder. |
…ges received
Summary by CodeRabbit
New Features
Bug Fixes