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

Automatic instrument with `flask run` versus `python` results in `status_code` being `UNSET`

Open
#2,109 2 comments 0 reactions 1 assignee View on GitHub

@hamzmu is already working on this.

Since Jan 18, 2024.

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

Description

Describe your environment

Python 3.9+ with OTel supported Flask/Werkzeug

Steps to reproduce

Follow the steps here https://opentelemetry.io/docs/instrumentation/python/getting-started/ and check the JSON output

What is the expected behavior?

    ...
    "status": {
        "status_code": "OK"
    },
    ...

Like when following directions here: https://opentelemetry.io/docs/instrumentation/python/automatic/example/

What is the actual behavior?

    ...
    "status": {
        "status_code": "UNSET"
    },
    ...

Additional context

It appears when flask run is used, the status_code is not set properly even though the HTTP status code is set properly ("http.status_code": 200). If you start the app with python it works properly.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.