Skip to content

OTLP exporter is encoding invalid span/trace IDs in the logs #3828

@yurishkuro

Description

@yurishkuro

Describe your environment
Using v1.23.0, configured OTLP HTTP exporter for logs

Steps to reproduce
Running a sample code that roughly looks like https://github.com/open-telemetry/opentelemetry-python/blob/main/docs/examples/logs/example.py

What is the expected behavior?
When there is no active trace, the exporter should not be including trace/span IDs into Protobuf messages

What is the actual behavior?
When I serialize received protobuf to JSON it looks like this:

              "traceId": "AAAAAAAAAAAAAAAAAAAAAA==",
              "spanId": "AAAAAAAAAAA="

That means the exporter is sending 00....00 bytes as trace and span IDs. The zero values indicate invalid trace/span ID, and the fields in the protobuf are optional, so the right behavior would be to not include these fields in the output. This will also minimize the size of the exported messages.

If maintainers agree with this, I can create a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglogging

    Type

    No type

    Projects

    Status

    Done

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions