Skip to content

Commit 5799696

Browse files
authored
Fix the pulse attribute decorations on unsampled lambda spans (#92)
*Issue #, if available:* Fix the pulse attribute decorations on unsampled lambda spans *Description of changes:* By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent e283cf2 commit 5799696

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

aws-distro-opentelemetry-node-autoinstrumentation/src/aws-opentelemetry-configurator.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -256,14 +256,13 @@ export class AwsOpentelemetryConfigurator {
256256

257257
// Register BatchUnsampledSpanProcessor to export unsampled traces in Lambda
258258
// when Application Signals enabled
259-
if (isLambdaEnvironment()) {
259+
if (isLambdaEnvironment() && !hasCustomOtlpTraceEndpoint()) {
260+
const udpSpanExporter = new OTLPUdpSpanExporter(getXrayDaemonEndpoint(), FORMAT_OTEL_UNSAMPLED_TRACES_BINARY_PREFIX);
261+
const configuredExporter = AwsMetricAttributesSpanExporterBuilder.create(udpSpanExporter, resource).build();
260262
spanProcessors.push(
261-
new AwsBatchUnsampledSpanProcessor(
262-
new OTLPUdpSpanExporter(getXrayDaemonEndpoint(), FORMAT_OTEL_UNSAMPLED_TRACES_BINARY_PREFIX),
263-
{
264-
maxExportBatchSize: getSpanExportBatchSize(),
265-
}
266-
)
263+
new AwsBatchUnsampledSpanProcessor(configuredExporter, {
264+
maxExportBatchSize: getSpanExportBatchSize(),
265+
})
267266
);
268267
diag.info('Enabled batch unsampled span processor for Lambda environment.');
269268
}

0 commit comments

Comments
 (0)