-
Notifications
You must be signed in to change notification settings - Fork 10
feat(http): Add observability metrics tracking #1155
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
base: main
Are you sure you want to change the base?
Changes from all commits
dcacbbc
d020fa5
48f47e4
b8ee39d
86efee9
c0d1171
71ad9e4
760b0bb
1f8c56c
9f16b94
0ccf189
8633a44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,6 +157,12 @@ def AWS_S3_BUCKET(self) -> str: | |
| BACKEND_SERVICE_NAME: str = "kaapi-backend" | ||
| CRON_SERVICE_NAME: str = "kaapi-cron" | ||
|
|
||
| # Defaults preserve current behavior; production .env needs no changes. | ||
| SENTRY_TRACES_SAMPLE_RATE: float = 1.0 | ||
| SENTRY_RELEASE: str | None = None | ||
| SENTRY_SEND_DEFAULT_PII: bool = False | ||
| SENTRY_ERROR_SAMPLE_RATE: float = 1.0 | ||
|
Comment on lines
+161
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🌐 Web query:
💡 Result: For the current Sentry SDK (as of version 2.62.0 for Python and recent versions for other platforms), the configuration options for profiling are as follows: profile_session_sample_rate This option accepts a numerical value in the range of 0.0 to 1.0 (inclusive) [1][2][3][4]. A value of 0.0 means profiling is disabled for all sessions, while 1.0 means profiling is enabled for every session [2][3][4]. The sampling decision is evaluated once when the SDK is initialized [5][1][3][4]. profile_lifecycle This option accepts the following string values [6][7][4]: - 'manual' (default): The profiler is controlled explicitly via manual start and stop function calls [8][7][4]. - 'trace': The profiler is controlled automatically based on the presence of active root spans, requiring tracing to be enabled [7][9][4]. These modes are mutually exclusive; only one can be active at a time [2][9][10]. If you configure both, ensure they are compatible with your intended sampling strategy [2][8]. Citations:
🤖 get_repo_knowledge executed:
Length of output: 47179 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- config.py ---'
sed -n '1,210p' backend/app/core/config.py
printf '%s\n' '--- telemetry.py ---'
sed -n '1,80p' backend/app/core/telemetry.py
printf '%s\n' '--- celery_app.py ---'
sed -n '1,85p' backend/app/celery/celery_app.py
printf '%s\n' '--- telemetry tests ---'
sed -n '180,220p' backend/app/tests/core/test_telemetry.py
printf '%s\n' '--- observability docs ---'
sed -n '1,35p' docs/wiki/cross-cutting/observability.md
printf '%s\n' '--- sentry dependency declarations ---'
rg -n -i --glob '!*lock*' --glob '!*.pyc' 'sentry-sdk|sentry' pyproject.toml poetry.lock requirements*.txt setup.cfg setup.py uv.lock Pipfile Pipfile.lock 2>/dev/null || true
printf '%s\n' '--- settings usage and environment config ---'
rg -n 'SENTRY_PROFILE_SESSION_SAMPLE_RATE|SENTRY_PROFILE_LIFECYCLE|extra\s*=|SettingsConfigDict|BaseSettings|sentry_sdk\.init|profile_session_sample_rate|profile_lifecycle' backend docs .github 2>/dev/nullRepository: ProjectTech4DevAI/kaapi-backend Length of output: 24574 🏁 Script executed: #!/bin/bash
set -eu
sed -n '130,180p' backend/app/core/config.py
sed -n '1,75p' backend/app/core/telemetry.py
sed -n '45,70p' backend/app/celery/celery_app.py
sed -n '195,212p' backend/app/tests/core/test_telemetry.py
sed -n '1,25p' docs/wiki/cross-cutting/observability.md
rg -n -i 'sentry-sdk|sentry' --glob 'pyproject.toml' --glob 'poetry.lock' --glob 'requirements*.txt' --glob 'uv.lock' --glob 'setup.cfg' --glob 'setup.py' --glob 'Pipfile*' .
rg -n 'SENTRY_PROFILE_SESSION_SAMPLE_RATE|SENTRY_PROFILE_LIFECYCLE|extra\s*=|SettingsConfigDict|BaseSettings|sentry_sdk\.init|profile_session_sample_rate|profile_lifecycle' backend docsRepository: ProjectTech4DevAI/kaapi-backend Length of output: 16481 🤖 get_repo_knowledge executed:
Length of output: 43638 🏁 Script executed: #!/bin/bash
set -eu
sed -n '1,65p' backend/app/main.py
sed -n '210,280p' backend/app/core/config.py
sed -n '4318,4340p' backend/uv.lockRepository: ProjectTech4DevAI/kaapi-backend Length of output: 7584 🌐 Web query:
💡 Result: In sentry-python 2.54.0, the configuration options profile_session_sample_rate and profile_lifecycle are used to control continuous profiling [1]. profile_session_sample_rate This option accepts a float value between 0.0 and 1.0 [2][3]. It controls the percentage chance that a given session will be profiled [3]. The sampling decision is evaluated exactly once at SDK initialization (process start) [3][1]. The default value is None (which disables the feature unless otherwise configured) [3]. profile_lifecycle This option accepts the following literal string values [4][5]: - 'manual': The profiler is controlled explicitly via start_profiler and stop_profiler calls [6][4]. This is the default value [4][5]. - 'trace': The profiler is managed automatically by the SDK, starting and stopping based on the presence of active root spans [6][4]. This mode requires tracing to be enabled [4]. These settings are part of the continuous profiling implementation, which differs from legacy transaction-based profiling (controlled by profiles_sample_rate) [2][1]. The two lifecycle modes are mutually exclusive [1]. Citations:
Make profiling configuration effective in both Sentry initialization paths.
Add validated settings with the current defaults. Make 📍 Affects 5 files
🤖 Prompt for AI Agents |
||
|
|
||
| # Threshold Request Rate per minute | ||
| THRESHOLD_LLM_CALL_RATE: int = 15 | ||
| THRESHOLD_COLLECTIONS_RATE: int = 3 | ||
|
|
||
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.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: ProjectTech4DevAI/kaapi-backend
Length of output: 1402
🤖 get_repo_knowledge executed:
get_repo_knowledge ProjectTech4DevAI/kaapi-backend /tmp/coderabbit-repo-knowledge/projecttech4devai-kaapi-backend-9f364c5e/architecture /tmp/coderabbit-repo-knowledge/projecttech4devai-kaapi-backend-9f364c5e/conventions /tmp/coderabbit-repo-knowledge/projecttech4devai-kaapi-backend-9f364c5e/learningsLength of output: 42311
🏁 Script executed:
Repository: ProjectTech4DevAI/kaapi-backend
Length of output: 1854
🏁 Script executed:
Repository: ProjectTech4DevAI/kaapi-backend
Length of output: 17647
🏁 Script executed:
Repository: ProjectTech4DevAI/kaapi-backend
Length of output: 15619
🏁 Script executed:
Repository: ProjectTech4DevAI/kaapi-backend
Length of output: 3940
Copy the trace-header template before dispatch.
Sentry SDK’s Celery integration defaults
propagate_tracestoTrueand removessentry-propagate-tracesfrom the supplied header mapping withpop(). This call passes the sharedSENTRY_NO_PROPAGATE_HEADERSmapping, so the first dispatch removes the opt-out key. Later poll cycles can use default trace propagation. Pass a new mapping for each dispatch.Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents