Skip to content

fix: adapt Sentry initialization to fix performance tracking not working#91

Merged
bolinocroustibat merged 1 commit intomainfrom
fix/sentry-performance
Feb 2, 2026
Merged

fix: adapt Sentry initialization to fix performance tracking not working#91
bolinocroustibat merged 1 commit intomainfrom
fix/sentry-performance

Conversation

@bolinocroustibat
Copy link
Copy Markdown
Contributor

@bolinocroustibat bolinocroustibat commented Feb 2, 2026

Fix Sentry performance tracking

Problem

After PR #87, Sentry performance tracking stopped working while error tracking continued to function normally.

Possible Cause

The AioHttpIntegration() instance was being created at module import time in api_tabular/core/sentry.py (when the sentry_kwargs dictionary was defined). This likely happened before sentry_sdk.init() was called in the app modules, which may have prevented the integration from properly hooking into aiohttp's internals for performance tracking.

Error tracking might have been still working because it doesn't require the same level of framework instrumentation - errors can be captured through exception handlers without needing to instrument the request/response cycle.

Solution

Converted sentry_kwargs from a module-level dictionary to a get_sentry_kwargs() function that creates a fresh AioHttpIntegration() instance each time it's called. This ensures the integration is instantiated right when sentry_sdk.init() is called, matching the original behavior before the refactor.

Copy link
Copy Markdown
Contributor

@maudetes maudetes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah well spotted, this may explain why it doesn't work properly.
Let's try this, thank you!

@bolinocroustibat bolinocroustibat merged commit 319f9eb into main Feb 2, 2026
4 checks passed
@bolinocroustibat bolinocroustibat deleted the fix/sentry-performance branch February 2, 2026 11:12
@bolinocroustibat bolinocroustibat added the bug Something isn't working label Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants