Skip to content

MapConverter does not get initialized if OTEL_SDK_DISABLED is set to true #13191

@StiviiK

Description

@StiviiK

Describe the bug

When the SDK gets disabled via Environment Variable OTEL_SDK_DISABLED but the OTEL_RESOURCE_ATTRIBUTES or otel.resource.attributes env/configuration is present, the application fails to start. Due to the MapConverter not being enabled/present.

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'otel.resource.attributes' to java.util.Map<java.lang.String, java.lang.String>:

    Property: otel.resource.attributes
    Value: "service.name=workflow-backend-dev,service.version=3c8f9ce9"
    Origin: System Environment Property "OTEL_RESOURCE_ATTRIBUTES"
    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. Set up a Spring Boot sample project with OTEL as specified in https://opentelemetry.io/docs/languages/java/automatic/spring-boot/
  2. In envvars, include a sample OTEL_RESOURCE_ATTRIBUTES map (e.g. var1=sample1,var2=sample2), and set env OTEL_SDK_DISABLED to true.
  3. Run the application.

Expected behavior

The application starts up and/or ignores the configuration property.

Actual behavior

The application fails on

2025-02-04T14:47:14.868Z  WARN 8 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.boot.context.properties.ConfigurationPropertiesBindException: Error creating bean with name 'otel.resource-io.opentelemetry.instrumentation.spring.autoconfigure.internal.properties.OtelResourceProperties': Could not bind properties to 'OtelResourceProperties' : prefix=otel.resource, ignoreInvalidFields=false, ignoreUnknownFields=true

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'otel.resource.attributes' to java.util.Map<java.lang.String, java.lang.String>:

    Property: otel.resource.attributes
    Value: "service.name=workflow-backend-dev,service.version=3c8f9ce9"
    Origin: System Environment Property "OTEL_RESOURCE_ATTRIBUTES"
    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

Javaagent or library instrumentation version

2.12.0

Environment

JDK: public.ecr.aws/amazoncorretto/amazoncorretto:23-al2023-headless
OS: Amazon Linux 2023

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions