Skip to content

chore: fixing issue with extension service files being overriden#2886

Merged
laurit merged 2 commits into
open-telemetry:mainfrom
arinn1204:main
Jun 19, 2026
Merged

chore: fixing issue with extension service files being overriden#2886
laurit merged 2 commits into
open-telemetry:mainfrom
arinn1204:main

Conversation

@arinn1204

@arinn1204 arinn1204 commented May 29, 2026

Copy link
Copy Markdown
Contributor

Description:

The maven-extension service files were being overridden, which lead to EnvironmentResourceProvider not being respected and forcing the span attributes to be whatever is defaulted. This lead to things like service.name and service.version always being hard coded to the maven version (see below)

Snippets from a build job where i had this jar committed

old

16:30:38  [DEBUG] OpenTelemetry: OpenTelemetrySdkService initialized, resource:Resource{schemaUrl=null, attributes={service.name="maven", service.version="3.8.9", telemetry.distro.name="opentelemetry-maven-extension", telemetry.distro.version="1.57.0-alpha", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.62.0"}}

new

15:18:46  [DEBUG] OpenTelemetry: OpenTelemetry SDK initialized with  Configuration: otel.traces.exporter=otlp, otel.exporter.otlp.endpoint=http://<otlp endpoint>, otel.resource.attributes=deployment.environment=prod,service.version=1.0.27-20260528151646,location=CI,build.release=false, otel.service.name=build, Resource: {build.release="false", deployment.environment="prod", location="CI", service.name="build", service.version="1.0.27-20260528151646", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.27.0"}

Existing Issue(s):

#2537

Testing:

I wired up the jar by overriding the maven extension path to see the debug logs showing the OTEL_RESOURCE_ATTRIBUTES was being respected by adding our custom tags

Copilot AI review requested due to automatic review settings May 29, 2026 23:58
@arinn1204
arinn1204 requested a review from a team as a code owner May 29, 2026 23:58
@linux-foundation-easycla

linux-foundation-easycla Bot commented May 29, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the Maven extension packaging to preserve Service Provider Interface (SPI) registrations when building the shaded/bundled JAR, preventing META-INF/services files from overwriting each other.

Changes:

  • Enable merging of colliding META-INF/services entries during JAR creation.
  • Configure duplicate handling to support service file merging.

The maven-extension service files were being overriden, which lead to EnvironmentResourceProvider
not being respected and forcing the span attributes to be whatever is
defaulted.

Snippets from a build job where i had this jar committed

old
```
16:30:38  [DEBUG] OpenTelemetry: OpenTelemetrySdkService initialized, resource:Resource{schemaUrl=null, attributes={service.name="maven", service.version="3.8.9", telemetry.distro.name="opentelemetry-maven-extension", telemetry.distro.version="1.57.0-alpha", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.62.0"}}
```

new
```
15:18:46  [DEBUG] OpenTelemetry: OpenTelemetry SDK initialized with  Configuration: otel.traces.exporter=otlp, otel.exporter.otlp.endpoint=http://<otlp endpoint>, otel.resource.attributes=deployment.environment=prod,service.version=1.0.27-20260528151646,location=CI,build.release=false, otel.service.name=build, Resource: {build.release="false", deployment.environment="prod", location="CI", service.name="build", service.version="1.0.27-20260528151646", telemetry.sdk.language="java", telemetry.sdk.name="opentelemetry", telemetry.sdk.version="1.27.0"}
```
@arinn1204

Copy link
Copy Markdown
Contributor Author

will reopen once i figure out the CLA stuff

@arinn1204

Copy link
Copy Markdown
Contributor Author

CLA is signed and should be good to review.

@arinn1204
arinn1204 requested a review from Copilot June 11, 2026 07:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread maven-extension/build.gradle.kts Outdated
@arinn1204

Copy link
Copy Markdown
Contributor Author
Resource attributes:
     -> build.release: Str(false)
     -> deployment.environment: Str(local)
     -> location: Str(local)
     -> service.name: Str(build.lib)
     -> service.version: Str(1.0.29-20260611084709)
     -> telemetry.distro.name: Str(opentelemetry-maven-extension)
     -> telemetry.distro.version: Str(1.58.0-alpha-SNAPSHOT)
     -> telemetry.sdk.language: Str(java)
     -> telemetry.sdk.name: Str(opentelemetry)
     -> telemetry.sdk.version: Str(1.62.0)

with the latest change, still getting everything as expected compared to the service.name=mvn and maven version

Applying DuplicatesStrategy.INCLUDE to the entire shaded JAR could
duplicate non-service resources (e.g. signature files) non-deterministically.
Scope it to META-INF/services/** so only SPI files are merged.
@laurit
laurit added this pull request to the merge queue Jun 19, 2026
Merged via the queue into open-telemetry:main with commit b83a776 Jun 19, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants