Improve batch worker error log serialization and test assertions#591
Improve batch worker error log serialization and test assertions#591
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Pino only auto-serializes errors (message, stack) on the `err` key. Using `error` silently loses structured error data in production logs.
b906863 to
ceb2872
Compare
🤖 Velo CI Failure AnalysisClassification: 🟠 SOFT FAIL
|
ceb2872 to
52ca8c9
Compare
src/services/events/publisher.ts
Outdated
| const errorMessage = error instanceof Error ? error.message : String(error); | ||
| logger.error({ | ||
| event: 'EventPublishFailed', | ||
| error: errorMessage, | ||
| err: errorMessage, |
There was a problem hiding this comment.
we should log the whole error here, not just the error message.
| messageId: message.id, | ||
| messageData: this.getMessageData(message), | ||
| error | ||
| err: error |
There was a problem hiding this comment.
Let's rename error to err, so we can just pass it in the object as-is
Rename `error` to `err` in all logger calls so Pino's error serializer properly extracts message and stack trace in structured logs.
52ca8c9 to
af99306
Compare
Summary
errfield so error message and stack are serialized in structured logstest/utils/log-capture.ts