-
Notifications
You must be signed in to change notification settings - Fork 870
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
Non-top level server span created by lambda instrumentation #7808
Comments
Try these environment variables combination for a workaround
Ensure that |
Hi @tylerbenson @cleverchuk @breedx-splk, Seems that this has been already fixed in the PR #9654: https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/9654/files#diff-47940a3adcec75b6ac500a403a33175706220b56017a6ca3034609a1b9bf5ebdR24-R29 Either one of the I have also verified no double span is created with Java agent in AWS Lambda since |
@serkan-ozal can you provide your repro setup? I'm using this sample and still see the issue with |
Then when I trigger the function, it produces single AWS Lambda span from Here it my simple Lambda function I have used for testing this issue: public class TestHandler implements RequestHandler<Map, Void> {
@Override
public Void handleRequest(Map event, Context context) {
System.out.println("Handling event: " + event);
return null;
}
} |
@serkan-ozal Thanks. I'm not seeing the same thing. Please, can you try using the sample aws-sdk app as your lambda function?
|
This workaround is flawed as the two instrumentation provide different capabilities which might be necessary for your deployment. So take it with a grain salt. |
Hi @cleverchuk, I was able to reproduce the problem both with the examples you provided and my own example. The double span is produced (and their trace ids are different too) when handler method is specified.
At the moment, not fully sure about the reason of the problem yet (need to verify that), but my theory is that the very first AWS Lambda span ( In the case here,
I will look into further to verify this behavior. The simplest (not sure it is the correct one yet) solution might be ignoring classes starts with @cleverchuk What are your thoughts on the problem and solution I have suggested? |
@cleverchuk Or we can let the trace start with runtime level and enrich it (don't start new span, but reuse the existing one) based on event in the |
@serkan-ozal Thanks for the continued research into this. I have been banging head at this for sometime and I can't seem to understand what's is going on. Your theory seems very sound to me because whenever I see the double spans I always see the instrumentation getting applied twice, first on the system loader then second on |
@serkan-ozal Made a custom build with your suggested modification as below and it seems like it is working okay. @Override
public ElementMatcher<TypeDescription> typeMatcher() {
return implementsInterface(named("com.amazonaws.services.lambda.runtime.RequestHandler"))
.and(not(nameStartsWith("com.amazonaws.services.lambda.runtime.api.client")));
} |
@cleverchuk Perfect! Couldn't find time to validate the theory. Thanks for looking into this |
@serkan-ozal How about a PR when you have time? |
@cleverchuk Sure. I would love to. This will be my first contribution! Looking forward to it. |
@serkan-ozal thanks for looking into this. The change mentioned in #9654 does indeed look like it should solve my original problem. I've been out for a bit and don't have time to validate though. |
@cleverchuk @tylerbenson Here it is: #10736 |
Describe the bug
When using javaagent with AWS Lambda application, instrumentation produces two server spans.
Both of these are applying:
io.opentelemetry.javaagent.instrumentation.awslambdacore.v1_0.AwsLambdaRequestHandlerInstrumentation
io.opentelemetry.javaagent.instrumentation.awslambdaevents.v2_2.AwsLambdaRequestHandlerInstrumentation
Steps to reproduce
Deploy and invoke an sqs lambda handler with the javaagent.
Here's my example:
What did you expect to see?
Only one server span.
What did you see instead?
Two server spans were created.
What version are you using?
1.22.1
Environment
Lambda java11 runtime
The text was updated successfully, but these errors were encountered: