Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,6 +60,8 @@ public void transform(TypeTransformer transformer) {
@SuppressWarnings("unused")
public static class HandleRequestAdvice {

private static final long flushTimeoutNanos = flushTimeout().toNanos();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@Advice.OnMethodEnter(suppress = Throwable.class)
public static void onEnter(
@Advice.Argument(value = 0, typing = Typing.DYNAMIC) Object arg,
Expand Down Expand Up @@ -90,7 +93,7 @@ public static void stopSpan(
functionInstrumenter().end(functionContext, input, null, throwable);
}

OpenTelemetrySdkAccess.forceFlush(1, TimeUnit.SECONDS);
OpenTelemetrySdkAccess.forceFlush(flushTimeoutNanos, TimeUnit.NANOSECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OpenTelemetrySdkAccess.forceFlush(flushTimeoutNanos, TimeUnit.NANOSECONDS);
OpenTelemetrySdkAccess.forceFlush(flushTimeout(), TimeUnit.SECONDS);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTEL_LAMBDA_FLUSH_TIMEOUT_DEFAULT is 10 seconds.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
How to add proper changelog?

}
}
}
Loading