Skip to content

Opentelemetry tweaks #211

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

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/bootstrap-python-fastapi.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 13 additions & 33 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ optional = true
[tool.poetry.group.http.dependencies]
fastapi = ">=0.99.0"
jinja2 = "^3.1.2"
opentelemetry-instrumentation-fastapi = "*"
# We use the generic ASGI instrumentation, so that if we decide to change
# Framework it will still work consistently.
opentelemetry-instrumentation-asgi = "*"
starlette-prometheus = "^0.10.0"
strawberry-graphql = { version = ">=0.204.0", extras = ["debug-server"] }
uvicorn = { version = "^0.31.0", extras = ["standard"] }
Expand Down
9 changes: 9 additions & 0 deletions src/celery_worker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
without having to initialise the HTTP framework (or other ones)
"""

from celery.signals import worker_process_init
from opentelemetry.instrumentation.celery import CeleryInstrumentor

from bootstrap import AppConfig, application_init


@worker_process_init.connect(weak=False)
def init_celery_tracing(*args, **kwargs):
CeleryInstrumentor().instrument() # pragma: nocover


app = application_init(AppConfig()).celery_app