Skip to content

Conversation

@allisson
Copy link
Owner

@allisson allisson commented Jan 3, 2026

Add performance timing and logging to the auth, clients, and subscriptions 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

…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
@allisson allisson requested a review from Copilot January 3, 2026 14:28
Copy link
Contributor

Copilot AI left a 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.

allisson and others added 5 commits January 3, 2026 11:30
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.
@allisson allisson merged commit c36c691 into main Jan 3, 2026
1 check passed
@allisson allisson deleted the improve-logs branch January 3, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants