Skip to content

fix(opentelemetry): avoid duplicate service.name/service.version in OtlpResource.fromConfig#6299

Open
jrmdayn wants to merge 1 commit into
Effect-TS:mainfrom
jrmdayn:fix-otlp-resource-duplicate-service-attrs
Open

fix(opentelemetry): avoid duplicate service.name/service.version in OtlpResource.fromConfig#6299
jrmdayn wants to merge 1 commit into
Effect-TS:mainfrom
jrmdayn:fix-otlp-resource-duplicate-service-attrs

Conversation

@jrmdayn

@jrmdayn jrmdayn commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

What

OtlpResource.fromConfig was duplicating the service.name and service.version attributes when they were provided through the OTEL_RESOURCE_ATTRIBUTES environment variable.

The merged attributes record (env + options) was passed straight to make, which also appends service.name/service.version explicitly. The result was two KeyValue entries for each of those keys.

This is a problem when using Axiom for example: the collector prints a warning that there are duplicate metric tags.

Fix

Filter service.name/service.version out of the attributes record (via Record.filter) before handing it to make, since make already adds them.

Test

Added packages/opentelemetry/test/OtlpResource.test.ts, which sets OTEL_RESOURCE_ATTRIBUTES (including both service keys plus a regular attribute) through a map ConfigProvider and asserts each service key appears exactly once while other attributes are preserved. The first test fails on main (two service.name entries) and passes with this fix.

🤖 Generated with Claude Code

…tlpResource.fromConfig

When service.name and/or service.version are set in OTEL_RESOURCE_ATTRIBUTES,
fromConfig passed them through to `make`, which also appends them explicitly,
producing duplicate KeyValue entries. Filter those keys out of the attributes
record before calling `make`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jrmdayn jrmdayn requested a review from tim-smart as a code owner June 29, 2026 21:39
@github-project-automation github-project-automation Bot moved this to Discussion Ongoing in PR Backlog Jun 29, 2026
@changeset-bot

changeset-bot Bot commented Jun 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2446586

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/opentelemetry Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

1 participant