-
Notifications
You must be signed in to change notification settings - Fork 279
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
feat: Add OpenTelemetry tracing #5295
Conversation
pyproject.toml
Outdated
[tool.poetry.group.observability.dependencies] | ||
opentelemetry-api = "^1.22.0" | ||
opentelemetry-sdk = "^1.22.0" | ||
opentelemetry-exporter-otlp = "^1.22.0" | ||
opentelemetry-instrumentation-django = "^0.43b0" | ||
opentelemetry-instrumentation-celery = "^0.43b0" | ||
opentelemetry-instrumentation-psycopg2 = "^0.43b0" | ||
opentelemetry-instrumentation-dbapi = "^0.43b0" | ||
opentelemetry-instrumentation-redis = "^0.43b0" | ||
opentelemetry-instrumentation-logging = "^0.43b0" | ||
opentelemetry-instrumentation-mysqlclient = "^0.43b0" | ||
opentelemetry-instrumentation-wsgi = "^0.43b0" |
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.
Are these actually development-only dependencies? I would have thought they'd need to be added to the main project dependencies instead of in this group.
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.
I updated it to make it a requirement. That got missed since the docker container includes everything for dev
|
||
OpenTelemetry logs, traces, and metrics are not exposed by default. To enable this, the `OTEL_PYTHON_DJANGO_INSTRUMENT` setting should be set to `True`. This will do two things: | ||
|
||
- Logs will be exposed in the OpenTelemetry format and include the Trace ID, Span ID, and Resource attributes. |
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.
Exposed where/how?
OpenTelemetry logs, traces, and metrics are not exposed by default. To enable this, the `OTEL_PYTHON_DJANGO_INSTRUMENT` setting should be set to `True`. This will do two things: | ||
|
||
- Logs will be exposed in the OpenTelemetry format and include the Trace ID, Span ID, and Resource attributes. | ||
- Metrics and Traces will be logged to console. |
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.
Can you provide sample output of how things differ when this feature is enabled?
|
||
--- | ||
|
||
### OTEL_PYTHON_DJANGO_INSTRUMENT |
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.
The entries in this file are alphabetically sorted, IIRC - would be good to stick with that convention.
|
||
Default: `False` | ||
|
||
Environment Variable: `OTEL_PYTHON_DJANGO_INSTRUMENT` |
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.
Are these OpenTelemetry conventions, or should the environment variables all be prefixed with NAUTOBOT_
for self-consistency?
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.
These are OpenTelemetry conventions but I had to set them up manually since some of the OpenTelemetry auto-tooling doesn't work with the nautobot-server
command. Possibly with some of the changes in #5310, the auto-tooling will work. I'll have to explore/test that
Closes #4783
What's Changed
Screenshots
Postgres Select inside a celery job:
TODO