Skip to content

Commit 1880d52

Browse files
committed
Replace dots with spaces to separate destination and operation names
1 parent f93e926 commit 1880d52

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def __call__(self, scope, receive, send):
217217
@wraps(receive)
218218
async def wrapped_receive():
219219
with self.tracer.start_as_current_span(
220-
span_name + " " + scope["type"] + ".receive"
220+
" ".join((span_name, scope["type"], "receive"))
221221
) as receive_span:
222222
message = await receive()
223223
if receive_span.is_recording():
@@ -229,7 +229,7 @@ async def wrapped_receive():
229229
@wraps(send)
230230
async def wrapped_send(message):
231231
with self.tracer.start_as_current_span(
232-
span_name + " " + scope["type"] + ".send"
232+
" ".join((span_name, scope["type"], "send"))
233233
) as send_span:
234234
if send_span.is_recording():
235235
if message["type"] == "http.response.start":

instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,20 @@ def validate_outputs(self, outputs, error=None, modifiers=None):
116116
self.assertEqual(len(span_list), 4)
117117
expected = [
118118
{
119-
"name": "/ http.receive",
119+
"name": "/ http receive",
120120
"kind": trace_api.SpanKind.INTERNAL,
121121
"attributes": {"type": "http.request"},
122122
},
123123
{
124-
"name": "/ http.send",
124+
"name": "/ http send",
125125
"kind": trace_api.SpanKind.INTERNAL,
126126
"attributes": {
127127
SpanAttributes.HTTP_STATUS_CODE: 200,
128128
"type": "http.response.start",
129129
},
130130
},
131131
{
132-
"name": "/ http.send",
132+
"name": "/ http send",
133133
"kind": trace_api.SpanKind.INTERNAL,
134134
"attributes": {"type": "http.response.body"},
135135
},
@@ -204,7 +204,7 @@ def update_expected_span_name(expected):
204204
entry["name"] = span_name
205205
else:
206206
entry["name"] = " ".join(
207-
[span_name] + entry["name"].split(" ")[-1:]
207+
[span_name] + entry["name"].split(" ")[1:]
208208
)
209209
return expected
210210

@@ -306,11 +306,11 @@ def test_websocket(self):
306306
span_list = self.memory_exporter.get_finished_spans()
307307
self.assertEqual(len(span_list), 6)
308308
expected = [
309-
"/ websocket.receive",
310-
"/ websocket.send",
311-
"/ websocket.receive",
312-
"/ websocket.send",
313-
"/ websocket.receive",
309+
"/ websocket receive",
310+
"/ websocket send",
311+
"/ websocket receive",
312+
"/ websocket send",
313+
"/ websocket receive",
314314
"/",
315315
]
316316
actual = [span.name for span in span_list]

0 commit comments

Comments
 (0)