opentelemetry-java-contrib icon indicating copy to clipboard operation
opentelemetry-java-contrib copied to clipboard

otel.resource.attributes and OTEL_RESOURCE_ATTRIBUTES doesn't work

Open marquiswang opened this issue 6 months ago • 1 comments

Component(s)

maven-extension

What happened?

Description

Setting the otel.resource.attributes doesn't work, contrary to documentation.

I tested a few versions - this was working in 1.27, and stopped working in 1.28 and does not work in latest.

Steps to Reproduce

Configure the opentelemetry-maven-extension (I'm exporting to Honeycomb, but I don't expect it to make a difference).

Run:

mvn clean -Dotel.resource.attributes="key1=val1,key2=val2" 

Expected Result

These attributes are exported to the otel collector.

Actual Result

These attributes are missing.

Component version

v1.28.0 - v.37.0

Log output

When building with 1.27 and -X, I get

[DEBUG] ContextStorageClass=io.opentelemetry.context.ThreadLocalContextStorage, identity=375273627 classloader=ClassRealm[coreExtensi
on>io.opentelemetry.contrib:opentelemetry-maven-extension:1.27.0-alpha, parent: ClassRealm[plexus.core, parent: null]] codeLocation=f
ile:/Users/mwang/.m2/repository/io/opentelemetry/contrib/opentelemetry-maven-extension/1.27.0-alpha/opentelemetry-maven-extension-1.2
7.0-alpha.jar
[DEBUG] OpenTelemetry: Initialize OpenTelemetrySdkService v1.27.0-alpha...
[DEBUG] OpenTelemetry: OpenTelemetry SDK initialized with  Configuration: otel.traces.exporter=otlp, otel.exporter.otlp.endpoint=https://api.honeycomb.io, otel.resource.attributes=key1=val1,key2=val2, Resource: {key1="val1", key2="val2", service.name="maven", service.version="3.9.8", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.27.0"}
[DEBUG] OpenTelemetry: OpenTelemetry extension registered as execution listener. InitialExecutionListener: org.apache.maven.eventspy.internal.EventSpyExecutionListener@7e7fe6d
[DEBUG] OpenTelemetry: afterSessionStart

When building with 1.28, I just see:

[DEBUG] OpenTelemetry: Initialize OpenTelemetrySdkService v1.28.0-alpha...
[DEBUG] OpenTelemetry: OpenTelemetry SDK initialized
[DEBUG] OpenTelemetry: OpenTelemetry extension registered as execution listener. InitialExecutionListener: org.apache.maven.eventspy.internal.EventSpyExecutionListener@4c447c09
[DEBUG] OpenTelemetry: afterSessionStart

Additional context

No response

marquiswang avatar Aug 15 '24 13:08 marquiswang