-
Notifications
You must be signed in to change notification settings - Fork 19
chore: improve logs #250
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
chore: improve logs #250
Conversation
WalkthroughLogging across three federation SDK services was refactored from string/positional arguments to structured objects. Error, info, and debug calls now pass contextual fields (e.g., msg, err, identifiers). No control-flow, API surface, or exception behavior changes; functions continue to return/throw as before. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #250 +/- ##
=======================================
Coverage 81.84% 81.84%
=======================================
Files 63 63
Lines 4705 4705
=======================================
Hits 3851 3851
Misses 854 854 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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: 0
🧹 Nitpick comments (2)
packages/federation-sdk/src/services/federation.service.ts (1)
264-267: LGTM! Consider transaction log verbosity.The structured log now includes the full transaction object, which provides complete context but may be verbose in production logs if transactions contain large PDU arrays.
If transaction logs become too verbose, consider logging a summary instead:
- this.logger.info({ - transaction: txn, - msg: `Sending event ${event.eventId} to server: ${server}`, - }); + this.logger.info({ + msg: `Sending event ${event.eventId} to server: ${server}`, + eventId: event.eventId, + server, + pduCount: txn.pdus.length, + });packages/federation-sdk/src/services/room.service.ts (1)
912-916: Consider log verbosity in joinUser event persistence.The structured logs now include full event objects at each persistence step, which provides comprehensive debugging context but may generate significant log volume for complex room joins with many state events.
If log volume becomes excessive, consider logging event summaries in production:
logger.info({ msg: 'Persisting create event', eventId: event.eventId, eventType: event.event.type, roomId: event.roomId, });Keep the full event logging for development/debug levels only.
Also applies to: 943-947, 959-963, 977-981, 992-996
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
packages/federation-sdk/src/services/event-fetcher.service.ts(1 hunks)packages/federation-sdk/src/services/federation.service.ts(11 hunks)packages/federation-sdk/src/services/room.service.ts(8 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/federation-sdk/src/services/federation.service.ts (1)
packages/room/src/manager/event-wrapper.ts (1)
event(106-115)
🔇 Additional comments (6)
packages/federation-sdk/src/services/event-fetcher.service.ts (1)
123-131: LGTM! Structured logging improves observability.The shift to structured logging with contextual fields (
msg,err,eventIds,targetServerName) enhances log searchability and analysis. The error-handling logic remains unchanged.packages/federation-sdk/src/services/federation.service.ts (2)
61-61: LGTM! Consistent structured error logging.All error logs now use structured objects with
msganderrfields, improving log parsing and observability across federation operations.Also applies to: 98-98, 120-120, 141-141, 154-154, 173-173, 186-186, 201-201
85-85: LGTM! Enhanced debug logging with event context.The structured debug logs now include the full event object, providing complete context for invalid parameter scenarios.
Also applies to: 214-214
packages/federation-sdk/src/services/room.service.ts (3)
214-214: LGTM! Consistent structured logging for room operations.The upsertRoom method now uses structured logs with
msg,roomId, anderrfields, improving traceability and error diagnosis.Also applies to: 216-216
1000-1003: LGTM! State visibility before join event.The structured log provides a clear snapshot of room state keys before persisting the join event, useful for debugging state resolution issues.
1129-1133: LGTM! Consistent structured error logging.Error logs now include relevant identifiers (
roomId,userId1,userId2) along withmsganderr, improving error traceability.Also applies to: 1429-1434
Summary by CodeRabbit
New Features
Refactor
Chores