Skip to content

Adding AWS Lambda Configurations prevents adding resource attributes via environment variable #379

Open
@DanDanN00dle

Description

@DanDanN00dle

Issue with OpenTelemetry.Contrib.Instrumentation.AWSLambda

Using:

  • OpenTelemetry 1.3.0-beta.2
  • OpenTelemetry.Contrib.Instrumentation.AWS 1.0.1
  • OpenTelemetry.Contrib.Instrumentation.AWSLambda 1.1.0-beta1
  • OpenTelemetry.Exporter.Console 1.3.0-beta.2
  • OpenTelemetry.Exporter.OpenTelemetryProtocol 1.3.0-beta.2
  • OpenTelemetry.Exporter.OpenTelemetryProtocol.Logs 1.0.0-rc9.3
  • OpenTelemetry.Instrumentation.MySqlData 1.0.0-beta.2

On runtime net6.0

Is this a feature request or a bug?

  • Feature Request
  • Bug

What is the expected behavior?

When setting the environment variable OTEL_RESOURCE_ATTRIBUTES for the lambda I expect to be able to add additional resource attributes to my lambda (per the specificaton).

What is the actual behavior?

The resource does not have the additional attributes specified in the environment variable.

        [Fact]
        public void TestResourceAdditionalAttributesFromEnvVar()
        {
            Environment.SetEnvironmentVariable("OTEL_RESOURCE_ATTRIBUTES", "application=TestApplication");

            using (var tracerProvider = Sdk.CreateTracerProviderBuilder()
                .AddAWSLambdaConfigurations()
                .Build())
            {
                var result = AWSLambdaWrapper.Trace(tracerProvider, this.sampleHandlers.SampleHandlerSyncReturn, "TestStream", this.sampleLambdaContext);
                var resource = tracerProvider.GetResource();
                this.AssertResourceAttributes(resource, new Dictionary<string, object> { ["application"] = "TestApplication" });
            }
        }

See test case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions