Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e35d84f

Browse files
authored
fix(datadog): use http.target not http.path (open-telemetry#810)
1 parent f2bc613 commit e35d84f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

ext/opentelemetry-ext-datadog/src/opentelemetry/ext/datadog/exporter.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ def _get_span_name(span):
191191
def _get_resource(span):
192192
"""Get resource name for span"""
193193
if "http.method" in span.attributes:
194-
route = span.attributes.get(
195-
"http.route", span.attributes.get("http.path")
196-
)
194+
route = span.attributes.get("http.route")
197195
return (
198196
span.attributes["http.method"] + " " + route
199197
if route

ext/opentelemetry-ext-datadog/tests/test_datadog_exporter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ def test_export(self):
222222
def test_resources(self):
223223
test_attributes = [
224224
{},
225-
{"http.method": "GET", "http.route": "/foo"},
226-
{"http.method": "GET", "http.path": "/foo"},
225+
{"http.method": "GET", "http.route": "/foo/<int:id>"},
226+
{"http.method": "GET", "http.target": "/foo/200"},
227227
]
228228

229229
for index, test in enumerate(test_attributes):
@@ -235,7 +235,7 @@ def test_resources(self):
235235
self.assertEqual(len(datadog_spans), 3)
236236

237237
actual = [span["resource"] for span in datadog_spans]
238-
expected = ["0", "GET /foo", "GET /foo"]
238+
expected = ["0", "GET /foo/<int:id>", "GET"]
239239

240240
self.assertEqual(actual, expected)
241241

0 commit comments

Comments
 (0)