-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
OpenTelemetry: Quarkus GraalVM AWS lambda-rest- issue #26250
Comments
Is there any stack trace or warning? Is the telemetry server visible to the lambda? I don't know if you have to do any AWS config magic to allow a lambda to connect outside its process. |
+1 |
@brunobat Any update on this? |
Hi, is this still being looked at please? @brunobat |
Not in the next couple of weeks, sorry @RobDTech |
Hi @brunobat any update on this one please? Apologies for hassling, we have a number of teams requesting this at the moment and it has been months. |
Will pick it up next |
That's fantastic, many thanks |
I'm also experiencing this issue, but with another sample lambda: the one from Amazon Lambda guide. I did add the opentelemetry dependency to it using My
I added a couple of log messages to the lambda to see whether any spans, traces or something gets created. So far, nothing:
and I don't see any traffic coming in on port 4317 of my agent. Whenever I run code provided by @fazeem84 locally, I can see traffic coming in on the port as well as traces showing up in our monitoring system. |
@brunobat we deployed directly to aws |
Deployed directly |
Have you guys added this property to the resource under sam.*.yaml? |
Yes I have tried enabling Active Tracing in Xray for the lambda (I have tried this with the Quarkus libraries without compilation so running as Java11) |
Did you follow the AWS configuration instructions in here? |
I did not use the aws ADOT layer as in that example, I followed this guide: where the instructions set up the same configuration as the AWS layer. (I was comparing them whilst doing it) I have attached some logs: removed logs |
asimpson2004, the https://quarkus.io/guides/opentelemetry is a generic guide that assumes an OTLP collector will be available. It doesn't include the AWS specific configurations that you need to perform at your AWS account in order to activate tracing on your lambdas. |
@brunobat Thanks, I also set up the otlp collector and enabled active tracing in xray. looking through the guide you provided I don't think there is anything missed. |
@brunobat I managed to spend some time on this and figured out what the problem is. The problem is not Quarkus specific, it is an opentelemetry / lambda issue that the lambda invocation ends and pauses before the BatchSpanProcessor has time to flush it's contents to the collector, therefore nothing is being sent to the collector. The problem has been detailed here in point 2.1. The above link describes the following solution: The SDK side needs to call force_flush() at the end of Lambda instrumentation. Is there any way to get hold of the SdkTracerProvider created by io.quarkus.opentelemetry.runtime.tracing.TracerRecorder so we can manually call forceFlush()? Is there some other preferred way to force flush? |
Just to add, I've managed to prove that this is the issue by setting the following environment variables: OTEL_BSP_MAX_QUEUE_SIZE = 0 Setting these allows the BatchSpanProcessor to flush data occasionally before the lambda invocation ends but not 100% of the time. |
We would need an implementation of a SimpleSpanProcessor. However, right now there is no way to wire that in Quarkus. The spans might be lost because the thread doing the export might not have started (it's scheduled) before the service shuts down. |
I can see in the Quarkus TracerRecorder this is set: However, I'm unsure if this is invoked when the lambda pauses |
I have managed to get this working 100% of the time without setting the queue size or delay mentioned above. Following the suggested force flush solution from here, I have created an interceptor that calls force flush on the LateBoundBatchSpanProcessor:
|
@brunobat I agree the proper solution would be the ability to use SimpleSpanProcessor so that we don't need to call force flush :) |
Have you added an issue in the OTel side? I think this missing flush should be reported as a bug. |
Added an issue on the Quarkus side to support SimpleSpanProcessor... And others, effectively. |
@asimpson2004 Could you please provide extended example of usage of your interceptor for flushing and your lambda setup? I'm set up lambda from Quarkus docs (https://quarkus.io/guides/amazon-lambda), added OTeL for Quarkus (https://quarkus.io/guides/opentelemetry) and implemented this interceptor, but lambda still don't send any data. |
@KriBetko Collector setup yaml:
Environment vars:
Lambda Layer: Extra libraries build.gradle:
Interceptor annotation:
Then annotate lambda handler with @OtelLambdaHandler You need to make sure that the yaml file is included in the root of the zip that is uploaded to the lambda for this to be picked up using the above. You should see the collector booting up in the lambda logs and then at the end of the lambda you should see the collector log the spans. |
The above also doesn't create any spans, you will need to generate a span to be sent |
Describe the bug
25708, the pull request raised against this issue solved open telemetry connection issue from my local environment ,but when I deployed it as lambda service ,it seems communication between the AWS lambda and open telemetry server(Elastic APM in my case) is not established
Expected behavior
AWS Lambda should be able to send the application performance data to OpenTelemetry server during lambda execution
Actual behavior
it seems communication between the AWS lambda and open telemetry server(Elastic APM in my case) is not established .and no data received in the Server side
How to Reproduce?
1 .Create Gradle project using the following gradle file
6.Invoke lambda by exposing it through AWS API gateway
Output of
uname -a
orver
No response
Output of
java -version
No response
GraalVM version (if different from Java)
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response
The text was updated successfully, but these errors were encountered: