From 2f53be4b9e05698a69f6fafe339d6dd4c56b69cc Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 20 Jun 2024 13:57:19 +0200 Subject: [PATCH] add OTEL_PYTHON_ENABLE_SERVER_ATTRIBUTES_FOR_REQUEST_DURATION flag to add server.address and server.port for http.server.request.duration --- .../tests/test_programmatic.py | 2 +- .../src/opentelemetry/instrumentation/wsgi/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py index 55b9ec27a7..b2535b538e 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py @@ -133,7 +133,7 @@ def setUp(self): "os.environ", { "OTEL_PYTHON_FLASK_EXCLUDED_URLS": "http://localhost/env_excluded_arg/123,env_excluded_noarg", - "OTEL_ENABLE_SERVER_ATTRIBUTES_FOR_REQUEST_DURATION": "true", + "OTEL_PYTHON_ENABLE_SERVER_ATTRIBUTES_FOR_REQUEST_DURATION": "true", OTEL_SEMCONV_STABILITY_OPT_IN: sem_conv_mode, }, ) diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py index 83250986e8..c4ac4462db 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/src/opentelemetry/instrumentation/wsgi/__init__.py @@ -466,7 +466,7 @@ def _parse_duration_attrs( req_attrs, _server_duration_attrs_old, _server_duration_attrs_new_with_server_attributes - if os.environ.get("OTEL_ENABLE_SERVER_ATTRIBUTES_FOR_REQUEST_DURATION") + if os.environ.get("OTEL_PYTHON_ENABLE_SERVER_ATTRIBUTES_FOR_REQUEST_DURATION") else _server_duration_attrs_new, sem_conv_opt_in_mode, )