open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.13k stars 2.4k forks source link

fileexporter is not encoding traceId according to specification #36095

Open ncabanis opened 1 month ago

ncabanis commented 1 month ago

Component(s)

exporter/file

What happened?

Description

Traces written using the fileexporter have traceId, spanId or parentSpanId not base64 encoded. This leads to errors, when reading the JSON files back in.

Steps to Reproduce

Expected Result

Use proto3 standard defined JSON Mapping for mapping between protobuf and json. trace_id and span_id is base64 encoded in OTLP/HTTP+JSON. See: https://github.com/open-telemetry/oteps/blob/main/text/0122-otlp-http-json.md#json-mapping

Example:

        "traceId": "bHE84Qqb0uYWr9oebVYwsA==",
        "spanId": "ygGTpeX0WXc=",
        "parentSpanId": "wcxj0FhL6CU=",

Actual Result

Example:

              "traceId": "345b5f5b69e9d28a1fac695cb5e20543",
              "spanId": "02765e6140c37e6c",
              "parentSpanId": "b8271c949767b3ca",

Collector version

v106.1

Environment information

Environment

OS: (e.g., "Ubuntu 20.04") Compiler(if manually compiled): (e.g., "go 14.2")

OpenTelemetry Collector configuration

exporters:
      file:
        path: /data/traces.json
        rotation:
          max_days: 3
          max_megabytes: 10
          max_backups: 15
        format: json

Log output

No response

Additional context

No response

github-actions[bot] commented 1 month ago

Pinging code owners:

atoulme commented 1 month ago

This might be a problem with pdata - the fileexporter just calls pdata functions to marshal JSON.