opentelemetry-instrumentation-asgi: always set status code on duration attributes#2627
Conversation
|
@danielhochman You need the CLA signed to get your contribution accepted |
|
@xrmx Thanks, was waiting on Corp CLA approval. It's signed now! |
…-contrib into middleware-always-set-status-code-on-duration-attrs
|
@xrmx lint should pass now (tested locally), sorry for the churn. |
|
@xrmx Thanks again. I think this should be ready to merge! |
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Outdated
Show resolved
Hide resolved
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Outdated
Show resolved
Hide resolved
|
@xrmx Thanks for your review! Are we ready to merge? |
|
Recent changes to asgi instrumentation changes has caused some conflicts. I will resolve them by directly committing to your branch. |
...tation/opentelemetry-instrumentation-asgi/src/opentelemetry/instrumentation/asgi/__init__.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Did som runs in some scenarios I have here and it's working as expected:
For old semconv:
{
"name": "http.server.duration",
"description": "Duration of HTTP server requests.",
"unit": "ms",
"data": {
"data_points": [
{
"attributes": {
"http.scheme": "http",
"http.host": "127.0.0.1:8000",
"net.host.port": 8000,
"http.flavor": "1.1",
"http.method": "GET",
"http.server_name": "localhost:8000",
"http.status_code": 500,
"http.target": "/foobar"
},
}For new semconv:
{
"name": "http.server.request.duration",
"description": "Duration of HTTP server requests.",
"unit": "s",
"data": {
"data_points": [
{
"attributes": {
"url.scheme": "http",
"network.protocol.version": "1.1",
"http.request.method": "GET",
"http.route": "/foobar",
"http.response.status_code": 500,
"error.type": "500"
}| elif message["type"] == "websocket.send": | ||
| status_code = 200 |
There was a problem hiding this comment.
If anything... It should be 101, not 200.
There was a problem hiding this comment.
Please open an issue or a PR, I don't think many people will see a comment on a PR closed months ago.
Description
Bug:
OpenTelemetryMiddlewarerecords histograms with no status code if the span is non-recording. The decision to include status code on a histogram should not be dependent on tracing decisions.Type of change
How Has This Been Tested?
Does This PR Require a Core Repo Change?
Checklist: