Skip to content

Setting OTEL_EXPORTER_OTLP_HEADERS when using SpringBoot starter fails with ConverterNotFoundException #10268

@c-north-8

Description

@c-north-8

Describe the bug

Using spring boot starter v2.0.0, which introduced an improvement for using the OTEL_EXPORTER_OTLP_HEADERS property, I get the following error message.


APPLICATION FAILED TO START


Description:

Failed to bind properties under 'otel.exporter.otlp.headers' to java.util.Map<java.lang.String, java.lang.String>:

Property: otel.exporter.otlp.headers
Value: "api-key=12345"
Origin: System Environment Property "OTEL_EXPORTER_OTLP_HEADERS"
Reason: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]

Action:

Update your application's configuration

Steps to reproduce

  1. Add opentelemetry-spring-boot-starter to Maven dependency (v2.0.0) in app
  2. Set the following environment variables
    • OTEL_EXPORTER_OTLP_HEADERS=api-key=123
  3. Run the app and see error message

Expected behavior

Setting the environment variable as described by the documentation would result in an api-key property being added to the headers Map for the OTLP exporter.

Actual behavior

Application fails to start with a ConverterNotFoundException

Javaagent or library instrumentation version

2.0.0_alpha

Environment

Spring Boot 3.2.1, Java 17

Additional context

When setting the headers via application.properties (e.g. otel.exporter.otlp.headers.api-key=12345), the application works as intended. It is only when trying to set via environment variables that the header is not respected or read.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions