Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlobalOpenTelemetry.get() returns Noop implementation when using java lambda layer #1061

Open
Thul95 opened this issue Dec 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Thul95
Copy link

Thul95 commented Dec 15, 2023

Describe the bug
When in AWS lambda using the java agent layer, both for layer v1 and v2. You can't access the Opentelemetry instance defined by the layer. GlobalOpenTelemetry.get() returns a DefaultOpenTelemetry{propagators=DefaultContextPropagators{textMapPropagator=NoopTextMapPropagator}}.

However my code is correctly instrumented and traces are being forwarded to my collector also context is correctly propagated/injected on to produced records on my Kafka topic.

Steps to reproduce
Deploy AWS java lambda with layer arn:aws:lambda:${aws:region}:184161586896:layer:opentelemetry-javaagent-0_2_0:1. Add implementation("io.opentelemetry:opentelemetry-api:1.32.0") to the classpath and try to get the global opentelemetry instance using GlobalOpenTelemetry.get()

What did you expect to see?
GlobalOpenTelemetry.get() returns the OpenTelemetry instance used by layer.

What did you see instead?
GlobalOpenTelemetry.get() returns OpenTelemetry.noop()

What version of collector/language SDK version did you use?

  • arn:aws:lambda:${aws:region}:184161586896:layer:opentelemetry-javaagent-0_1_0:1
  • arn:aws:lambda:${aws:region}:184161586896:layer:opentelemetry-javaagent-0_2_0:1

What language layer did you use?
Java 17

@Thul95 Thul95 added the bug Something isn't working label Dec 15, 2023
@Thul95 Thul95 changed the title GlobalOpenTelemetry.get() return Noop implementation when using java lambda layer GlobalOpenTelemetry.get() returns Noop implementation when using java lambda layer Dec 15, 2023
@tylerbenson
Copy link
Member

You still need to add the javaagent or use the wrapper.

Try adding the following environment variable.

AWS_LAMBDA_EXEC_WRAPPER=/opt/otel-handler

@serkan-ozal
Copy link
Contributor

@Thul95 Yes, @tylerbenson is correct. You are missing setting AWS_LAMBDA_EXEC_WRAPPER environment variable. Otherwise, Java agent is not activated and in this case it is expected that there is no trace context started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants