Description
Component(s)
service
What happened?
Describe the bug
The upgrade to opentelemetry-go-contrib v1.35.0/v0.60.0/v0.29.0/v0.15.0/v0.10.0/v0.8.0/v0.7.0 in #12575 broke backward-compatibility for the headers
field in the OTLPMetric
type.
Using OpenTelemetry Collector 0.127.0, this was a valid configuration but breaks with OpenTelemetry Collector 0.128.0:
service:
telemetry:
metrics:
address: "..."
readers:
- periodic:
exporter:
otlp:
headers:
"Authorization": "Basic abcdef"
"My-Header": "My-Value"
Before the upgrade, telemetry.metrics.readers.periodic.exporter.otlp.headers
was a map, after the update it's a list of name
/value
pairs.
Additionally, the telemetry.metrics.address
key is not valid anymore but I am not sure what the reason is for that and what the replacement might be. Hints appreciated. 😉
Old type:
- https://github.com/open-telemetry/opentelemetry-go-contrib/blob/otelconf/v0.16.0/otelconf/v0.2.0/generated_config.go#L205-L206
- https://github.com/open-telemetry/opentelemetry-go-contrib/blob/otelconf/v0.16.0/otelconf/v0.2.0/generated_config.go#L112
New type:
- https://github.com/open-telemetry/opentelemetry-go-contrib/blob/otelconf/v0.16.0/otelconf/v0.3.0/generated_config.go#L308-L309
- https://github.com/open-telemetry/opentelemetry-go-contrib/blob/otelconf/v0.16.0/otelconf/v0.3.0/generated_config.go#L248-L254
Working configuration with OTel Collector v0.128.0:
service:
telemetry:
metrics:
readers:
- periodic:
exporter:
otlp:
headers:
- name: "Authorization"
value: "Basic abcdef"
- name: "My-Header"
value: "My-Value"
What did you expect to see?
Successful startup of OpenTelemetry Collector with the configuration which was working with OpenTelemetry Collector 0.127.0.
What did you see instead?
opentelemetry-collector Error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):
opentelemetry-collector
opentelemetry-collector error decoding 'service.telemetry.metrics': decoding failed due to the following error(s):
opentelemetry-collector
opentelemetry-collector 'readers[0].periodic.exporter.otlp.headers': source data must be an array or slice, got map
opentelemetry-collector 'readers[1] periodic.exporter.otlp headers': source data must be an array or slice, got map
opentelemetry-collector '' has invalid keys: address
opentelemetry-collector 2025/06/24 10:40:00 collector server run finished with error: failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):
opentelemetry-collector
opentelemetry-collector error decoding 'service.telemetry metrics': decoding failed due to the following error(s):
opentelemetry-collector
opentelemetry-collector 'readers[0].periodic.exporter.otlp.headers': source data must be an array or slice,
opentelemetry-collector 'readers[1].periodic.exporter.otlp.headers': source data must be an array or slice, got map
opentelemetry-collector '' has invalid keys: address
Collector version
v0.128.0
Environment information
Environment
OS: Linux (Docker container)
OpenTelemetry Collector configuration
service:
telemetry:
metrics:
address: "..."
readers:
- periodic:
exporter:
otlp:
headers:
"Authorization": "Basic abcdef"
"My-Header": "My-Value"
Log output
'readers[0].periodic.exporter.otlp.headers': source data must be an array or slice, got map
'' has invalid keys: address
Additional context
No response