Merged
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
Contributor
There was a problem hiding this comment.
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 <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add performance timing and logging to the auth, clients, and subscriptions services.