Skip to content

feat(nodejs): drop the trailing comma from OTEL_RESOURCE_ATTRIBUTES#2171

Merged
wpessers merged 1 commit intoopen-telemetry:mainfrom
wpessers:feat/nodejs/handler-script-drop-trailing-comma
Mar 14, 2026
Merged

feat(nodejs): drop the trailing comma from OTEL_RESOURCE_ATTRIBUTES#2171
wpessers merged 1 commit intoopen-telemetry:mainfrom
wpessers:feat/nodejs/handler-script-drop-trailing-comma

Conversation

@wpessers
Copy link
Member

@wpessers wpessers commented Mar 14, 2026

For the @opentelemetry/core upgrade to 2.6.0 in #2165 there's a breaking change regarding parsing of the OTEL_RESOURCE_ATTRIBUTES and:

Per spec, any parsing error results in ignoring the entire environment variable.

Due to the current code leaving a trailing comma in the $OTEL_RESOURCE_ATTRIBUTES value in the case where the user has it unset or empty, specifically this code in the upstream package would lead to an error being thrown:
https://github.com/open-telemetry/opentelemetry-js/blob/425bbfe4b341de82a07f16086a69787b31e97b9d/packages/opentelemetry-resources/src/detectors/EnvDetector.ts#L76-L92

@wpessers wpessers requested a review from a team as a code owner March 14, 2026 15:59
@wpessers wpessers merged commit 60f8ccf into open-telemetry:main Mar 14, 2026
12 checks passed
@herin049
Copy link
Contributor

herin049 commented Mar 14, 2026

Honestly, it might be worth submitting a PR to OpenTelemetry Node.js to fix this, since I wouldn't expect trailing commas to be an error. Pretty sure in Python we just ignore anything that parses to pure whitespace after splitting the string.

@wpessers
Copy link
Member Author

wpessers commented Mar 15, 2026

Honestly, it might be worth submitting a PR to OpenTelemetry Node.js to fix this, since I wouldn't expect trailing commas to be an error. Pretty sure in Python we just ignore anything that parses to pure whitespace after splitting the string.

Fair point @herin049! I will follow up in the js-contrib on this!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants