Skip to content

All flask spans are INTERNAL and belong to the same trace #4420

Closed
@tchowice

Description

@tchowice

Describe your environment

OS: Windows 10
Python version: 3.11.4
SDK version: 1.29.0
API version: 1.29.0

What happened?

All incoming flask requests end up as INTERNAL spans (instead of SERVER spans as expected), and they all belong to the same trace:

{
    "name": "GET /rolldice",
    "context": {
        "trace_id": "0x841af2901c9ca6fb2ab20041e732e198",
        "span_id": "0xe4146244abe71974",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x27645c64c6029b2e",
    "start_time": "2025-02-06T01:49:58.042586Z",
    "end_time": "2025-02-06T01:49:58.044586Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "http.method": "GET",
        "http.server_name": "127.0.0.1",
        "http.scheme": "http",
        "net.host.name": "127.0.0.1:8080",
        "http.host": "127.0.0.1:8080",
        "net.host.port": 8080,
        "http.target": "/rolldice",
        "net.peer.ip": "127.0.0.1",
        "net.peer.port": 57591,
        "http.user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
        "http.flavor": "1.1",
        "http.route": "/rolldice",
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.29.0",
            "service.name": "dice-server",
            "telemetry.auto.version": "0.50b0"
        },
        "schema_url": ""
    }
}
{
    "name": "GET /rolldice",
    "context": {
        "trace_id": "0x841af2901c9ca6fb2ab20041e732e198",
        "span_id": "0xd4c9e36a7c8a5ea4",
        "trace_state": "[]"
    },
    "kind": "SpanKind.INTERNAL",
    "parent_id": "0x27645c64c6029b2e",
    "start_time": "2025-02-06T01:49:58.193224Z",
    "end_time": "2025-02-06T01:49:58.194153Z",
    "status": {
        "status_code": "UNSET"
    },
    "attributes": {
        "http.method": "GET",
        "http.server_name": "127.0.0.1",
        "http.scheme": "http",
        "net.host.name": "127.0.0.1:8080",
        "http.host": "127.0.0.1:8080",
        "net.host.port": 8080,
        "http.target": "/rolldice",
        "net.peer.ip": "127.0.0.1",
        "net.peer.port": 57592,
        "http.user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
        "http.flavor": "1.1",
        "http.route": "/rolldice",
        "http.status_code": 200
    },
    "events": [],
    "links": [],
    "resource": {
        "attributes": {
            "telemetry.sdk.language": "python",
            "telemetry.sdk.name": "opentelemetry",
            "telemetry.sdk.version": "1.29.0",
            "service.name": "dice-server",
            "telemetry.auto.version": "0.50b0"
        },
        "schema_url": ""
    }
}

Steps to Reproduce

Follow the instructions on https://opentelemetry.io/docs/zero-code/python/ to the letter. I didn't make any modifications.

Expected Result

Each request to /rolldice should result in a new trace. The span should be of type SERVER.

Actual Result

All incoming flask requests end up as INTERNAL spans (instead of SERVER spans as expected), and they all belong to the same trace.

Additional context

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions