Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,12 @@ export function isLambdaEnvironment() {
}

function hasCustomOtlpTraceEndpoint() {
return process.env['OTEL_EXPORTER_OTLP_TRACES_ENDPOINT'] !== undefined;
// 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
);
}

function getXrayDaemonEndpoint() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,20 @@ describe('AwsOpenTelemetryConfiguratorTest', () => {
delete process.env.AWS_XRAY_DAEMON_ADDRESS;
});

it('tests configureOTLP on Lambda with generic OTEL_EXPORTER_OTLP_ENDPOINT uses OTLP exporter', () => {
process.env.AWS_LAMBDA_FUNCTION_NAME = 'TestFunction';
process.env.OTEL_TRACES_EXPORTER = 'otlp';
process.env.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://my-collector:4318';
process.env.OTEL_EXPORTER_OTLP_PROTOCOL = 'http/protobuf';
const spanExporter: SpanExporter = AwsSpanProcessorProvider.configureOtlp();
// Should use OTLP exporter, not UDP, when generic endpoint is set
expect(spanExporter).toBeInstanceOf(OTLPProtoTraceExporter);
delete process.env.AWS_LAMBDA_FUNCTION_NAME;
delete process.env.OTEL_TRACES_EXPORTER;
delete process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
delete process.env.OTEL_EXPORTER_OTLP_PROTOCOL;
});

it('Tests that OTLP exporter from the configurator is UDPExporter when Application Signals is disabled on Lambda', () => {
process.env.AWS_LAMBDA_FUNCTION_NAME = 'TestFunction';
process.env.OTEL_AWS_APPLICATION_SIGNALS_ENABLED = 'False';
Expand Down
160 changes: 141 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.