Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
StiviiK opened this issue Feb 4, 2025 · 2 comments · Fixed by #13224
Closed

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

StiviiK opened this issue Feb 4, 2025 · 2 comments · Fixed by #13224
Assignees
Labels
bug Something isn't working needs triage New issue that requires triage spring boot starter

Comments

@StiviiK
Copy link

StiviiK commented Feb 4, 2025

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

@StiviiK StiviiK added bug Something isn't working needs triage New issue that requires triage labels Feb 4, 2025
@trask
Copy link
Member

trask commented Feb 4, 2025

cc @jeanbisutti @zeitlinger

@zeitlinger zeitlinger self-assigned this Feb 5, 2025
@zeitlinger
Copy link
Member

zeitlinger commented Feb 5, 2025

Reproduced in a test case with

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

...

No converter found capable of converting from type [java.lang.String] to type [java.util.Map<java.lang.String, java.lang.String>]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New issue that requires triage spring boot starter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants