Skip to content

Remove erroneous type attribute from asgi instrumentation #2145

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

### Fixed

- Remove erroneous `type` attribute from `opentelemetry-instrumentation-asgi`
([#2145](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2145))

## Version 1.23.0/0.44b0 (2024-02-23)

- Drop support for 3.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,6 @@ async def otel_receive():
if receive_span.is_recording():
if message["type"] == "websocket.receive":
set_status_code(receive_span, 200)
receive_span.set_attribute("type", message["type"])
return message

return otel_receive
Expand Down Expand Up @@ -697,7 +696,7 @@ async def otel_send(message: dict[str, Any]):
elif message["type"] == "websocket.send":
set_status_code(server_span, 200)
set_status_code(send_span, 200)
send_span.set_attribute("type", message["type"])

if (
server_span.is_recording()
and server_span.kind == trace.SpanKind.SERVER
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,20 +268,19 @@ def validate_outputs(self, outputs, error=None, modifiers=None):
{
"name": "GET / http receive",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "http.request"},
"attributes": {},
},
{
"name": "GET / http send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {
SpanAttributes.HTTP_STATUS_CODE: 200,
"type": "http.response.start",
},
},
{
"name": "GET / http send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "http.response.body"},
"attributes": {},
},
{
"name": "GET /",
Expand Down Expand Up @@ -358,7 +357,7 @@ def add_more_body_spans(expected: list):
more_body_span = {
"name": "GET / http send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "http.response.body"},
"attributes": {},
}
extra_spans = [more_body_span] * 3
expected[2:2] = extra_spans
Expand Down Expand Up @@ -396,12 +395,12 @@ def add_body_and_trailer_span(expected: list):
body_span = {
"name": "GET / http send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "http.response.body"},
"attributes": {},
}
trailer_span = {
"name": "GET / http send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "http.response.trailers"},
"attributes": {},
}
expected[2:2] = [body_span]
expected[4:4] = [trailer_span] * 2
Expand Down Expand Up @@ -582,33 +581,31 @@ def test_websocket(self):
{
"name": "/ websocket receive",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "websocket.connect"},
"attributes": {},
},
{
"name": "/ websocket send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "websocket.accept"},
"attributes": {},
},
{
"name": "/ websocket receive",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {
"type": "websocket.receive",
SpanAttributes.HTTP_STATUS_CODE: 200,
},
},
{
"name": "/ websocket send",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {
"type": "websocket.send",
SpanAttributes.HTTP_STATUS_CODE: 200,
},
},
{
"name": "/ websocket receive",
"kind": trace_api.SpanKind.INTERNAL,
"attributes": {"type": "websocket.disconnect"},
"attributes": {},
},
{
"name": "/",
Expand Down