Skip to content

fix: Recognize OTEL_EXPORTER_OTLP_ENDPOINT as custom endpoint in Lambda environment#298

Open
garysassano wants to merge 3 commits intoaws-observability:mainfrom
garysassano:fix-env-var
Open

fix: Recognize OTEL_EXPORTER_OTLP_ENDPOINT as custom endpoint in Lambda environment#298
garysassano wants to merge 3 commits intoaws-observability:mainfrom
garysassano:fix-env-var

Conversation

@garysassano
Copy link

Fixes #297

Solution

Updated hasCustomOtlpTraceEndpoint() to also check for the generic OTEL_EXPORTER_OTLP_ENDPOINT environment variable, per the OpenTelemetry OTLP Exporter specification:

function hasCustomOtlpTraceEndpoint() {
  // Check for signal-specific endpoint first, then fall back to generic endpoint
  // per OpenTelemetry OTLP Exporter specification
  return (
    process.env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'] !== undefined ||
    process.env['OTEL_EXPORTER_OTLP_ENDPOINT'] !== undefined
  );
}

Changes

  • aws-distro-opentelemetry-node-autoinstrumentation/src/aws-opentelemetry-configurator.ts: Updated hasCustomOtlpTraceEndpoint() to recognize both OTEL_EXPORTER_OTLP_TRACES_ENDPOINT and OTEL_EXPORTER_OTLP_ENDPOINT as custom endpoints.
  • aws-distro-opentelemetry-node-autoinstrumentation/test/aws-opentelemetry-configurator.test.ts: Added test case to verify that setting OTEL_EXPORTER_OTLP_ENDPOINT in Lambda environment uses OTLP exporter instead of UDP.

@garysassano garysassano requested a review from a team as a code owner December 4, 2025 05:24
@wangzlei
Copy link
Contributor

wangzlei commented Dec 8, 2025

@garysassano Thanks for the contribution! This issue might happen in other language SDKs as well, we will audit if it should be applied to other SDK repos.

@wangzlei wangzlei added the skip changelog doesn't need a CHANGELOG entry label Dec 15, 2025
@garysassano
Copy link
Author

I audited the other language SDKs and attempted fixes:

Language Status Details
.NET ✅ Already fixed HasCustomTracesEndpoint() already checks both endpoints
Python 🔄 PR opened #562 - same pattern as this JS fix
Java ❌ Needs fix Same issue exists, but couldn't run tests since project requires internal ADOT-patched Maven dependencies (opentelemetry-aws-xray:1.48.0-adot1) not available in public repos

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

Labels

skip changelog doesn't need a CHANGELOG entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADOT Lambda Layer ignores OTEL_EXPORTER_OTLP_ENDPOINT in favor of OTEL_EXPORTER_OTLP_TRACES_ENDPOINT

2 participants