Skip to content

Commit dfcb05f

Browse files
authored
Decouple SigV4 from Application Signals (#1069)
*Description of changes:* We do not want to automatically disable Application Signals if SigV4 is enabled. This PR allows Application Signals to run normally with SigV4. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 8c14677 commit dfcb05f

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

awsagentprovider/src/main/java/software/amazon/opentelemetry/javaagent/providers/AwsApplicationSignalsCustomizerProvider.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,8 @@ public class AwsApplicationSignalsCustomizerProvider
123123
// This is a bit of a magic number, as there is no simple way to tell how many spans can make a
124124
// 64KB batch since spans can vary in size.
125125
private static final int LAMBDA_SPAN_EXPORT_BATCH_SIZE = 10;
126-
private static boolean isSigV4Enabled = false;
127126

128127
public void customize(AutoConfigurationCustomizer autoConfiguration) {
129-
isSigV4Enabled = AwsApplicationSignalsCustomizerProvider.isSigV4Enabled();
130128
autoConfiguration.addPropertiesCustomizer(this::customizeProperties);
131129
autoConfiguration.addPropertiesCustomizer(this::customizeLambdaEnvProperties);
132130
autoConfiguration.addResourceCustomizer(this::customizeResource);
@@ -327,10 +325,6 @@ private SdkTracerProviderBuilder customizeTracerProviderBuilder(
327325
return tracerProviderBuilder;
328326
}
329327

330-
if (isSigV4Enabled) {
331-
return tracerProviderBuilder;
332-
}
333-
334328
// Construct meterProvider
335329
MetricExporter metricsExporter =
336330
ApplicationSignalsExporterProvider.INSTANCE.createExporter(configProps);
@@ -398,13 +392,14 @@ private SpanExporter customizeSpanExporter(
398392
}
399393

400394
// When running OTLP endpoint for X-Ray backend, use custom exporter for SigV4 authentication.
401-
if (isSigV4Enabled) {
395+
if (isSigV4Enabled()) {
402396
// can cast here since we've checked that the environment variable is
403397
// set to http/protobuf
404-
return OtlpAwsSpanExporterBuilder.create(
405-
(OtlpHttpSpanExporter) spanExporter,
406-
System.getenv(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT_CONFIG))
407-
.build();
398+
spanExporter =
399+
OtlpAwsSpanExporterBuilder.create(
400+
(OtlpHttpSpanExporter) spanExporter,
401+
System.getenv(OTEL_EXPORTER_OTLP_TRACES_ENDPOINT_CONFIG))
402+
.build();
408403
}
409404

410405
if (isApplicationSignalsEnabled(configProps)) {

0 commit comments

Comments
 (0)