feat: Celery metrics#32
Merged
adinhodovic merged 10 commits intomainfrom Feb 27, 2026
Merged
Conversation
4e146ba to
db0e1e4
Compare
Tests that call setup functions directly now use make_config() from conftest.py so direct key access in library code never raises KeyError when a key is absent from a hand-rolled dict.
…ric init When PROMETHEUS_MULTIPROC_DIR is set in the environment (e.g. via Docker Compose), prometheus_client switches to multiprocess mode at import time. If the directory doesn't exist yet, the first metric object creation — which happens during model import inside AppConfig.ready() — raises FileNotFoundError. _ensure_existing_multiproc_dir() now runs early in setup_metrics_for_django, before the URL resolver check, so the dir is guaranteed to exist before any downstream model import can trigger a .db file write. Also removes the stale PROFILING.TAGS key from dev.py (removed in the config cleanup that introduced RESOURCE_ATTRIBUTES).
0a8d311 to
d517373
Compare
The previous attempt to create the dir in setup_metrics_for_django() was still too late: prometheus_client tries to write .db files during model import (Django Phase 2), but AppConfig.ready() only runs in Phase 3. django_o11y/__init__.py is imported in Phase 1 (app module discovery), before any model is imported, so creating the directory there is the earliest safe point. The stale _ensure_existing_multiproc_dir() helper in metrics/setup.py is removed since it was redundant.
7a306eb to
82f651b
Compare
1bb749d to
c1667dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.