Hello, I am currently configuring OpenTelemetry with Micrometer, and it seems we can configure the resourceAttributes. Docs: https://micrometer.io/docs/registry/otlp under 2. Configuring. However, when I'm configuring the following such as,
management:
endpoints:
web:
exposure:
include: "*"
exclude: env,beans
server:
port: 8081
otlp:
metrics:
export:
url: http://localhost:4318/v1/metrics
resourceAttributes: "key=value,service.name=test-service"
and try to boot up the application server, I am getting the following error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'management.otlp.metrics.export.resource-attributes' to java.util.Map<java.lang.String, java.lang.String>:
Property: management.otlp.metrics.export.resource-attributes
Value: "key=value,service.name=test-service"
Origin: class path resource [application.yml] - 39:29
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>]
spring boot version: 3.1.1
As a current workaround, I can set the OTEL_SERVICE_NAME for now or leverage common tags such as management.metrics.tags to override it (ref: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.metrics.customizing.common-tags).
Comment From: wilkinsona
Assuming that you're trying to set two attributes (key and service.name), your YAML's wrong. It should be:
management:
otlp:
metrics:
export:
url: http://localhost:4318/v1/metrics
resourceAttributes:
key: value
service.name: test-service