@@ -48,9 +48,6 @@ public class Plugin
4848 private static readonly string BackupSamplerEnabledConfig = "BACKUP_SAMPLER_ENABLED" ;
4949 private static readonly string BackupSamplerEnabled = System . Environment . GetEnvironmentVariable ( BackupSamplerEnabledConfig ) ?? "true" ;
5050
51- private static readonly string AwsLambdaFunctionNameConfig = "AWS_LAMBDA_FUNCTION_NAME" ;
52- private static readonly string ? AwsLambdaFunctionName = System . Environment . GetEnvironmentVariable ( AwsLambdaFunctionNameConfig ) ;
53-
5451 private static readonly string AwsXrayDaemonAddressConfig = "AWS_XRAY_DAEMON_ADDRESS" ;
5552 private static readonly string ? AwsXrayDaemonAddress = System . Environment . GetEnvironmentVariable ( AwsXrayDaemonAddressConfig ) ;
5653
@@ -106,7 +103,7 @@ public void TracerProviderInitialized(TracerProvider tracerProvider)
106103
107104 // We want to be adding the exporter as the last processor in the traceProvider since processors
108105 // are executed in the order they were added to the provider.
109- if ( this . IsLambdaEnvironment ( ) && ! this . HasCustomTracesEndpoint ( ) )
106+ if ( AwsSpanProcessingUtil . IsLambdaEnvironment ( ) && ! this . HasCustomTracesEndpoint ( ) )
110107 {
111108 Resource processResource = tracerProvider . GetResource ( ) ;
112109
@@ -120,7 +117,7 @@ public void TracerProviderInitialized(TracerProvider tracerProvider)
120117 }
121118
122119 // Disable Application Metrics for Lambda environment
123- if ( ! this . IsLambdaEnvironment ( ) )
120+ if ( ! AwsSpanProcessingUtil . IsLambdaEnvironment ( ) )
124121 {
125122 string ? intervalConfigString = System . Environment . GetEnvironmentVariable ( MetricExportIntervalConfig ) ;
126123 int exportInterval = DefaultMetricExportInterval ;
@@ -183,7 +180,6 @@ public TracerProviderBuilder BeforeConfigureTracerProvider(TracerProviderBuilder
183180 builder . AddProcessor ( processor ) ;
184181 }
185182
186- // My custom logic here
187183 builder . AddAWSInstrumentation ( ) ;
188184#if ! NETFRAMEWORK
189185 builder . AddAWSLambdaConfigurations ( ) ;
@@ -260,6 +256,11 @@ public void ConfigureTracesOptions(HttpClientTraceInstrumentationOptions options
260256 return false ;
261257 }
262258
259+ if ( request . RequestUri ? . AbsolutePath . Contains ( "/runtime/invocation/" ) == true )
260+ {
261+ return false ;
262+ }
263+
263264 return true ;
264265 } ;
265266
@@ -409,7 +410,7 @@ private ResourceBuilder ResourceBuilderCustomizer(ResourceBuilder builder)
409410
410411 // Resource detectors are disabled if the environment variable is explicitly set to false or if the
411412 // application is in a lambda environment
412- if ( resourceDetectorsEnabled != "true" || this . IsLambdaEnvironment ( ) )
413+ if ( resourceDetectorsEnabled != "true" || AwsSpanProcessingUtil . IsLambdaEnvironment ( ) )
413414 {
414415 return builder ;
415416 }
@@ -460,12 +461,6 @@ private OtlpMetricExporter ApplicationSignalsExporterProvider()
460461 return new OtlpMetricExporter ( options ) ;
461462 }
462463
463- private bool IsLambdaEnvironment ( )
464- {
465- // detect if running in AWS Lambda environment
466- return AwsLambdaFunctionName != null ;
467- }
468-
469464 private bool HasCustomTracesEndpoint ( )
470465 {
471466 // detect if running in AWS Lambda environment
0 commit comments