Tag ADIT telemetry per service in observability overlay#340
Tag ADIT telemetry per service in observability overlay#340samuelvkwong wants to merge 2 commits intomainfrom
Conversation
Restructure the overlay so service.namespace and deployment.environment live
once in a shared env anchor; each service merges that anchor and adds only
its own SERVICE_COMPONENT value (consumed by adit_radis_shared/telemetry.py).
service.name comes from OTEL_SERVICE_NAME=${STACK_NAME}, dynamically resolved
by the existing CLI helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the observability configuration in docker-compose.override.yml.example by splitting network and environment settings into separate anchors and adding OpenTelemetry resource attributes for each service. The review feedback suggests enhancing the flexibility and portability of this configuration by leveraging existing environment variables from the .env file and using default value syntax for OTEL settings, rather than relying on manual file modifications or hardcoded values.
| # 2. If this is a staging or development deployment, edit the | ||
| # `deployment.environment=production` value inside `OTEL_RESOURCE_ATTRIBUTES` | ||
| # below to `staging` or `development`: | ||
| # sed -i 's/deployment.environment=production/deployment.environment=staging/' \ | ||
| # docker-compose.override.yml |
There was a problem hiding this comment.
The sed -i command is not portable across different operating systems (e.g., macOS/BSD vs. GNU/Linux). Instead of requiring manual file modification or fragile scripts, you can leverage the ENVIRONMENT variable already defined in the .env file to set the deployment environment dynamically. This simplifies the setup process and makes it more robust.
# 2. The deployment environment is automatically set from the `ENVIRONMENT`
# variable in your `.env` file (defaults to `production`).
# To override it, change `ENVIRONMENT` in your `.env` file.
There was a problem hiding this comment.
@gemini The ENVIRONMENT variable in .env describes which django settings ADIT should use, either development or production, not the deployment environment.
There was a problem hiding this comment.
Thank you for the clarification, @samuelvkwong. I understand now that deployment.environment in OTEL_RESOURCE_ATTRIBUTES is distinct from the ENVIRONMENT variable used for Django settings. Given that this is a manual configuration step for the deployment environment, I recommend updating the documentation to explicitly mention that this is a manual override required for non-production environments, rather than suggesting it be handled via the existing .env file.
| OTEL_PYTHON_DJANGO_EXCLUDED_URLS: "health/,static/.*" | ||
| OTEL_SERVICE_NAME: ${STACK_NAME} | ||
| OTEL_RESOURCE_ATTRIBUTES: "service.namespace=openradx,deployment.environment=production" |
There was a problem hiding this comment.
Hardcoding these values prevents users from overriding them via the .env file. Using the ${VAR:-DEFAULT} pattern provides better flexibility. Additionally, using ${ENVIRONMENT} allows the deployment environment to be synchronized with the rest of the application settings automatically, avoiding the need for manual sed commands.
OTEL_PYTHON_DJANGO_EXCLUDED_URLS: ${OTEL_PYTHON_DJANGO_EXCLUDED_URLS:-health/,static/.*}
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-${STACK_NAME}}
OTEL_RESOURCE_ATTRIBUTES: "service.namespace=openradx,deployment.environment=${ENVIRONMENT:-production}"
There was a problem hiding this comment.
@gemini See #340 (comment)
Also each deployment environment will have its own project directory and respective .env file. The deployment environment will be set once per .env file and will not change.
There was a problem hiding this comment.
Understood. Given that the deployment environment is managed per-stack and is static for the lifetime of that specific .env file, the current approach of manual configuration is acceptable. I will keep this in mind for future reviews.
Summary
Why
OpenObserve telemetry was tagged with a single `service.name` per stack, collapsing all containers under one identity. With this overlay every signal carries:
This makes telemetry filterable per stack, per component, and per deployment environment.
Dependency
`service.component` is set via a custom `SERVICE_COMPONENT` env var that the `adit-radis-shared` telemetry helper reads — see openradx/adit-radis-shared#186. `pyproject.toml` will need updating to reference that branch (or a follow-up tag) before this PR's effect is visible end-to-end.
Sibling PR
Test plan
🤖 Generated with Claude Code