-
Notifications
You must be signed in to change notification settings - Fork 0
feat: improve the logs #29
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
Conversation
…iptions services - Measure execution duration for token validation, message cleanup, and subscription creation - Log debug info on successful validations, warnings on failures, and errors on exceptions - Include relevant metadata like client_id, scopes, duration, and error details in logs - Enhances observability for debugging and performance monitoring
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.
Pull request overview
This PR enhances observability across the fastpubsub service layer by adding comprehensive logging and performance timing instrumentation. The changes systematically add execution duration tracking and contextual logging to authentication, client, subscription, topic, message, and helper services.
Key changes:
- Performance timing using
time.perf_counter()to measure operation duration - Structured logging with contextual metadata (IDs, scopes, durations, error details)
- Log level differentiation: debug for successful retrievals, info for creations/deletions, warning for validation failures, error for exceptions
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| fastpubsub/services/topics.py | Added timing and logging to topic CRUD operations with success/failure tracking |
| fastpubsub/services/subscriptions.py | Added timing and logging to subscription operations with constraint violation warnings |
| fastpubsub/services/messages.py | Added timing and logging to message publish/consume/ack/nack/cleanup operations |
| fastpubsub/services/helpers.py | Added timing and slow query detection (>100ms warning, >10ms debug) to SQL helper |
| fastpubsub/services/clients.py | Added timing and logging to client creation and JWT token issuance/validation |
| fastpubsub/services/auth.py | Added timing and logging to token validation with success/failure differentiation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Add a generic exception handler in the FastAPI app to catch unhandled exceptions and return a 500 Internal Server Error with a generic message, preventing leakage of sensitive application internals. Also, update test fixture to downgrade migrations to 'base' instead of '-1' for cleaner teardown.
Add performance timing and logging to the auth, clients, and subscriptions services.