From 8d71d4e9aa12f9c4d4608b7abb17f4dc0bccf0ce Mon Sep 17 00:00:00 2001 From: Julien Maupetit Date: Fri, 13 Dec 2024 19:54:46 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7(api)=20collect=20sentry=20profilin?= =?UTF-8?q?g=20traces?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need more insights to analyze API performances. --- src/api/CHANGELOG.md | 5 +++++ src/api/qualicharge/api/__init__.py | 1 + src/api/qualicharge/conf.py | 1 + 3 files changed, 7 insertions(+) diff --git a/src/api/CHANGELOG.md b/src/api/CHANGELOG.md index ec37391b..8a414abc 100644 --- a/src/api/CHANGELOG.md +++ b/src/api/CHANGELOG.md @@ -8,6 +8,11 @@ and this project adheres to ## [Unreleased] +### Added + +- Activate and configure Sentry profiling by setting the + `SENTRY_PROFILES_SAMPLE_RATE` configuration + ### Changed - Prefetch user-related groups and operational units in `get_user` dependency diff --git a/src/api/qualicharge/api/__init__.py b/src/api/qualicharge/api/__init__.py index f8f8fbe1..df1cce64 100644 --- a/src/api/qualicharge/api/__init__.py +++ b/src/api/qualicharge/api/__init__.py @@ -28,6 +28,7 @@ async def lifespan(app: FastAPI): dsn=str(settings.SENTRY_DSN), enable_tracing=True, traces_sample_rate=settings.SENTRY_TRACES_SAMPLE_RATE, + profiles_sample_rate=settings.SENTRY_PROFILES_SAMPLE_RATE, release=__version__, environment=settings.EXECUTION_ENVIRONMENT, integrations=[ diff --git a/src/api/qualicharge/conf.py b/src/api/qualicharge/conf.py index 85d4d365..7826c380 100644 --- a/src/api/qualicharge/conf.py +++ b/src/api/qualicharge/conf.py @@ -119,6 +119,7 @@ def PASSWORD_CONTEXT(self) -> CryptContext: # Third-party integrations SENTRY_DSN: Optional[HttpUrl] = None SENTRY_TRACES_SAMPLE_RATE: float = 1.0 + SENTRY_PROFILES_SAMPLE_RATE: float = 1.0 # Misc EXECUTION_ENVIRONMENT: str