-
Notifications
You must be signed in to change notification settings - Fork 1k
feat: Aws Lambda Request Handler instrumentation uses OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT
#12375
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
feat: Aws Lambda Request Handler instrumentation uses OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT
#12375
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,7 @@ | |||||
|
|
||||||
| package io.opentelemetry.javaagent.instrumentation.awslambdacore.v1_0; | ||||||
|
|
||||||
| import static io.opentelemetry.instrumentation.awslambdacore.v1_0.internal.WrapperConfiguration.flushTimeout; | ||||||
| import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.hasClassesNamed; | ||||||
| import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface; | ||||||
| import static io.opentelemetry.javaagent.instrumentation.awslambdacore.v1_0.AwsLambdaInstrumentationHelper.functionInstrumenter; | ||||||
|
|
@@ -59,6 +60,8 @@ public void transform(TypeTransformer transformer) { | |||||
| @SuppressWarnings("unused") | ||||||
| public static class HandleRequestAdvice { | ||||||
|
|
||||||
| private static final long flushTimeoutNanos = flushTimeout().toNanos(); | ||||||
|
|
||||||
| @Advice.OnMethodEnter(suppress = Throwable.class) | ||||||
| public static void onEnter( | ||||||
| @Advice.Argument(value = 0, typing = Typing.DYNAMIC) Object arg, | ||||||
|
|
@@ -90,7 +93,7 @@ public static void stopSpan( | |||||
| functionInstrumenter().end(functionContext, input, null, throwable); | ||||||
| } | ||||||
|
|
||||||
| OpenTelemetrySdkAccess.forceFlush(1, TimeUnit.SECONDS); | ||||||
| OpenTelemetrySdkAccess.forceFlush(flushTimeoutNanos, TimeUnit.NANOSECONDS); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTEL_LAMBDA_FLUSH_TIMEOUT_DEFAULT is 10 seconds. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, OTEL_LAMBDA_FLUSH_TIMEOUT_DEFAULT is 10, that is a braking change from 1 second. |
||||||
| } | ||||||
| } | ||||||
| } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't add fields to advice classes. Either inline it or move the field to https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/aws-lambda/aws-lambda-core-1.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdacore/v1_0/AwsLambdaInstrumentationHelper.java
It would be best to keep changes here aligned with
opentelemetry-java-instrumentation/instrumentation/aws-lambda/aws-lambda-events-2.2/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/awslambdaevents/v2_2/AwsLambdaRequestHandlerInstrumentation.java
Line 109 in 4497fbf