Skip to content

Commit 7d3c150

Browse files
committed
http.target in old sem metric attribute
1 parent c8d9555 commit 7d3c150

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

instrumentation/opentelemetry-instrumentation-flask/src/opentelemetry/instrumentation/flask/__init__.py

-6
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,6 @@ def _start_response(status, response_headers, *args, **kwargs):
399399
)
400400

401401
if wrapped_app_environ.get(_ENVIRON_REQUEST_ROUTE_KEY, None):
402-
duration_attrs_old[HTTP_ROUTE] = wrapped_app_environ.get(
403-
_ENVIRON_REQUEST_ROUTE_KEY
404-
)
405402
duration_attrs_old[HTTP_TARGET] = wrapped_app_environ.get(
406403
_ENVIRON_REQUEST_ROUTE_KEY
407404
)
@@ -418,9 +415,6 @@ def _start_response(status, response_headers, *args, **kwargs):
418415
duration_attrs_new[HTTP_ROUTE] = wrapped_app_environ.get(
419416
_ENVIRON_REQUEST_ROUTE_KEY
420417
)
421-
duration_attrs_new[HTTP_TARGET] = wrapped_app_environ.get(
422-
_ENVIRON_REQUEST_ROUTE_KEY
423-
)
424418

425419
duration_histogram_new.record(
426420
max(duration_s, 0), duration_attrs_new

instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,10 @@ def expected_attributes_new(override_attributes):
8686

8787

8888
_server_duration_attrs_old_copy = _server_duration_attrs_old.copy()
89-
_server_duration_attrs_old_copy.append("http.route")
9089
_server_duration_attrs_old_copy.append("http.target")
9190

9291
_server_duration_attrs_new_copy = _server_duration_attrs_new.copy()
93-
_server_duration_attrs_new_copy.append("http.target")
92+
_server_duration_attrs_new_copy.append("http.route")
9493

9594
_expected_metric_names_old = [
9695
"http.server.active_requests",
@@ -577,7 +576,6 @@ def test_basic_metric_success(self):
577576
self.client.get("/hello/756")
578577
expected_duration_attributes = {
579578
"http.method": "GET",
580-
"http.route": "/hello/<int:helloid>",
581579
"http.target": "/hello/<int:helloid>",
582580
"http.host": "localhost",
583581
"http.scheme": "http",
@@ -605,7 +603,6 @@ def test_basic_metric_success_new_semconv(self):
605603
"http.request.method": "GET",
606604
"url.scheme": "http",
607605
"http.route": "/hello/<int:helloid>",
608-
"http.target": "/hello/<int:helloid>",
609606
"network.protocol.version": "1.1",
610607
"http.response.status_code": 200,
611608
}

0 commit comments

Comments
 (0)