-
Notifications
You must be signed in to change notification settings - Fork 621
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
add OTEL_PYTHON_HTTP_SERVER_REQUEST_DURATION_SERVER_ATTRIBUTES_ENABLED flag #2597
base: main
Are you sure you want to change the base?
add OTEL_PYTHON_HTTP_SERVER_REQUEST_DURATION_SERVER_ATTRIBUTES_ENABLED flag #2597
Conversation
...tation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py
Outdated
Show resolved
Hide resolved
2f53be4
to
1841e73
Compare
1841e73
to
9662dbc
Compare
@xrmx can you check again? |
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.
Thanks for working on this one. Left some comments
...nstrumentation-django/src/opentelemetry/instrumentation/django/middleware/otel_middleware.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py
Outdated
Show resolved
Hide resolved
instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py
Outdated
Show resolved
Hide resolved
opentelemetry-instrumentation/src/opentelemetry/instrumentation/_semconv.py
Outdated
Show resolved
Hide resolved
|
||
_OpenTelemetrySemanticConventionStability.server_duration_attrs_new_effective = ( | ||
_server_duration_attrs_new_with_server_attributes | ||
if os.environ.get( |
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.
We don't need to run this for all instrumentation migrated to new semconv, right? because not every instrumentation has metrics implemented. Wdyt we have a way to explicitly initialize this per instrumentation we want to support the opt-in 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.
this field is only used for metrics here - maybe rename the field?
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.
+1 to supporting this individually per instrumentation. _OpenTelemetrySemanticConventionStability
should only be used for semantic convention migration. We do not want to mix this functionality with semantic conventions.
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.
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.
Yeah you mostly like don't need to store the config as part of the global _OpenTelemetrySemanticConventionStability
. I think you can store the config information in each instrumentation instance themselves when creating them. You can then have a static set of attributes with the one without the flag enabled and one with the flag enabled.
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'm sympathetic to the @lzchen approach. With that we can be more selective in which instrumentation we want to support to opt-in 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.
ok - changed now 😄
@emdneto please have another look 😄 |
opentelemetry-instrumentation/src/opentelemetry/instrumentation/_semconv.py
Outdated
Show resolved
Hide resolved
3726748
to
bda040d
Compare
…rver.address and server.port for http.server.request.duration
8c1bb5d
to
36373e4
Compare
feedback from SIG meeting
|
Maybe I am late but would adding a single environment variable that takes a list of additional attributes to export would be more acceptable? The caveat would be to require specifying the accepted literals with types so at least it's clear what the code supports. |
@xrmx That's the suggestion I made at SIG yesterday. I don't know if my explanation was very clear, but we ended up discussing and agreed to do that per instrumentation using the kwargs at the instrument level. |
I'm open to having a separate discussion about what efforts we should make for auto instrumentation to not block this PR. Seems like we have enough interest for autoinstrumentation that we should definitely do an audit of it. |
OTEL_PYTHON_HTTP_SERVER_ACTIVE_REQUESTS_COUNT_SERVER_ATTRIBUTES_ENABLED: "1", | ||
}, | ||
) | ||
def test_basic_metric_success_new_semconv_server_address(self): |
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.
Would you be able to add tests for django, asgi and wsgi as well?
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.
Blocking until we remove env var mechanism.
Description
add
OTEL_PYTHON_HTTP_SERVER_REQUEST_DURATION_SERVER_ATTRIBUTES_ENABLED
flag to addserver.address
andserver.port
forhttp.server.request.duration
- which are opt-inOTEL_PYTHON_HTTP_SERVER_ACTIVE_REQUESTS_COUNT_SERVER_ATTRIBUTES_ENABLED
- flag to addserver.address
andserver.port
forhttp.server.active_requests
- also opt-inThis env var does not exist for any other language so far.
Type of change
How Has This Been Tested?
tests included in this PR
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.