open-telemetry / open-telemetry/opentelemetry-python-contrib

http.server.duration has http.status_code attribute set only when span is recording

Open
#1,876 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

using opentelemetry.instrumentation.asgi.OpenTelemetryMiddleware with the following packages installed

  • opentelemetry-api = "==1.18.0"
  • opentelemetry-exporter-otlp-proto-grpc = "==1.18.0"
  • opentelemetry-instrumentation-asgi = "==0.39b0"
  • opentelemetry-sdk = "==1.18.0"
  • opentelemetry-semantic-conventions = "==0.39b0"

Steps to reproduce

  • Don't record spans
  • Not seeing status code as attribute for http.server.duration

What is the expected behavior?

Seeing status code as attribute for http.server.duration regardless of whether we're recording spans or not

What is the actual behavior?

Not seeing status code as attribute for http.server.duration when not recording spans

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with opentelemetry.instrumentation.asgi.OpenTelemetryMiddleware and reproduce the behavior using the listed package versions with spans not recorded. Trace how http.server.duration receives the http.status_code attribute in that case; done means the attribute is present regardless of whether spans are recording.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.