mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-30 05:32:30 +08:00
rename type
to asgi.event.type
in ASGI instrumentation (#2300)
This commit is contained in:
10
CHANGELOG.md
10
CHANGELOG.md
@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Breaking changes
|
||||||
|
|
||||||
|
- Rename `type` attribute to `asgi.event.type` in `opentelemetry-instrumentation-asgi`
|
||||||
|
([#2300](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2300))
|
||||||
|
|
||||||
## Version 1.24.0/0.45b0 (2024-03-28)
|
## Version 1.24.0/0.45b0 (2024-03-28)
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
- `opentelemetry-instrumentation-psycopg` Async Instrumentation for psycopg 3.x
|
- `opentelemetry-instrumentation-psycopg` Async Instrumentation for psycopg 3.x
|
||||||
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))
|
([#2146](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2146))
|
||||||
|
|
||||||
@ -30,9 +37,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- AwsLambdaInstrumentor sets `cloud.account.id` span attribute
|
- AwsLambdaInstrumentor sets `cloud.account.id` span attribute
|
||||||
([#2367](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2367))
|
([#2367](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2367))
|
||||||
|
|
||||||
|
|
||||||
## Version 1.23.0/0.44b0 (2024-02-23)
|
## Version 1.23.0/0.44b0 (2024-02-23)
|
||||||
|
|
||||||
- Drop uspport for 3.7
|
- Drop support for 3.7
|
||||||
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151))
|
([#2151](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2151))
|
||||||
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
|
- `opentelemetry-resource-detector-azure` Added 10s timeout to VM Resource Detector
|
||||||
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))
|
([#2119](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2119))
|
||||||
|
@ -672,7 +672,9 @@ class OpenTelemetryMiddleware:
|
|||||||
if receive_span.is_recording():
|
if receive_span.is_recording():
|
||||||
if message["type"] == "websocket.receive":
|
if message["type"] == "websocket.receive":
|
||||||
set_status_code(receive_span, 200)
|
set_status_code(receive_span, 200)
|
||||||
receive_span.set_attribute("type", message["type"])
|
receive_span.set_attribute(
|
||||||
|
"asgi.event.type", message["type"]
|
||||||
|
)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
return otel_receive
|
return otel_receive
|
||||||
@ -703,7 +705,7 @@ class OpenTelemetryMiddleware:
|
|||||||
elif message["type"] == "websocket.send":
|
elif message["type"] == "websocket.send":
|
||||||
set_status_code(server_span, 200)
|
set_status_code(server_span, 200)
|
||||||
set_status_code(send_span, 200)
|
set_status_code(send_span, 200)
|
||||||
send_span.set_attribute("type", message["type"])
|
send_span.set_attribute("asgi.event.type", message["type"])
|
||||||
if (
|
if (
|
||||||
server_span.is_recording()
|
server_span.is_recording()
|
||||||
and server_span.kind == trace.SpanKind.SERVER
|
and server_span.kind == trace.SpanKind.SERVER
|
||||||
|
@ -268,20 +268,20 @@ class TestAsgiApplication(AsgiTestBase):
|
|||||||
{
|
{
|
||||||
"name": "GET / http receive",
|
"name": "GET / http receive",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "http.request"},
|
"attributes": {"asgi.event.type": "http.request"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GET / http send",
|
"name": "GET / http send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
SpanAttributes.HTTP_STATUS_CODE: 200,
|
SpanAttributes.HTTP_STATUS_CODE: 200,
|
||||||
"type": "http.response.start",
|
"asgi.event.type": "http.response.start",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GET / http send",
|
"name": "GET / http send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "http.response.body"},
|
"attributes": {"asgi.event.type": "http.response.body"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "GET /",
|
"name": "GET /",
|
||||||
@ -358,7 +358,7 @@ class TestAsgiApplication(AsgiTestBase):
|
|||||||
more_body_span = {
|
more_body_span = {
|
||||||
"name": "GET / http send",
|
"name": "GET / http send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "http.response.body"},
|
"attributes": {"asgi.event.type": "http.response.body"},
|
||||||
}
|
}
|
||||||
extra_spans = [more_body_span] * 3
|
extra_spans = [more_body_span] * 3
|
||||||
expected[2:2] = extra_spans
|
expected[2:2] = extra_spans
|
||||||
@ -396,12 +396,12 @@ class TestAsgiApplication(AsgiTestBase):
|
|||||||
body_span = {
|
body_span = {
|
||||||
"name": "GET / http send",
|
"name": "GET / http send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "http.response.body"},
|
"attributes": {"asgi.event.type": "http.response.body"},
|
||||||
}
|
}
|
||||||
trailer_span = {
|
trailer_span = {
|
||||||
"name": "GET / http send",
|
"name": "GET / http send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "http.response.trailers"},
|
"attributes": {"asgi.event.type": "http.response.trailers"},
|
||||||
}
|
}
|
||||||
expected[2:2] = [body_span]
|
expected[2:2] = [body_span]
|
||||||
expected[4:4] = [trailer_span] * 2
|
expected[4:4] = [trailer_span] * 2
|
||||||
@ -582,18 +582,18 @@ class TestAsgiApplication(AsgiTestBase):
|
|||||||
{
|
{
|
||||||
"name": "/ websocket receive",
|
"name": "/ websocket receive",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "websocket.connect"},
|
"attributes": {"asgi.event.type": "websocket.connect"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "/ websocket send",
|
"name": "/ websocket send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "websocket.accept"},
|
"attributes": {"asgi.event.type": "websocket.accept"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "/ websocket receive",
|
"name": "/ websocket receive",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"type": "websocket.receive",
|
"asgi.event.type": "websocket.receive",
|
||||||
SpanAttributes.HTTP_STATUS_CODE: 200,
|
SpanAttributes.HTTP_STATUS_CODE: 200,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -601,14 +601,14 @@ class TestAsgiApplication(AsgiTestBase):
|
|||||||
"name": "/ websocket send",
|
"name": "/ websocket send",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"type": "websocket.send",
|
"asgi.event.type": "websocket.send",
|
||||||
SpanAttributes.HTTP_STATUS_CODE: 200,
|
SpanAttributes.HTTP_STATUS_CODE: 200,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "/ websocket receive",
|
"name": "/ websocket receive",
|
||||||
"kind": trace_api.SpanKind.INTERNAL,
|
"kind": trace_api.SpanKind.INTERNAL,
|
||||||
"attributes": {"type": "websocket.disconnect"},
|
"attributes": {"asgi.event.type": "websocket.disconnect"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "/",
|
"name": "/",
|
||||||
|
Reference in New Issue
Block a user