Skip to content
Merged
Show file tree
Hide file tree
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 @@ -12,7 +12,6 @@
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;

@SuppressWarnings("unused")
@AutoService(InstrumentationModule.class)
public class JexInstrumentationModule extends InstrumentationModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,10 @@ public AwsLambdaInstrumentationModule() {

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
return hasClassesNamed(
// added in 1.0.0
"com.amazonaws.services.lambda.runtime.RequestHandler")
.and(
not(
hasClassesNamed(
// added in 2.2.0 (in which case aws-lambda-events-2.2 is used)
"com.amazonaws.services.lambda.runtime.events.SQSEvent")));
// added in 1.0.0
return hasClassesNamed("com.amazonaws.services.lambda.runtime.RequestHandler")
// added in 2.2.0 (in which case aws-lambda-events-2.2 is used)
.and(not(hasClassesNamed("com.amazonaws.services.lambda.runtime.events.SQSEvent")));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void tearDown() {
}

@Test
void handlerTraced() throws Exception {
void handlerTraced() throws IOException {
InputStream input = new ByteArrayInputStream("hello\n".getBytes(UTF_8));
OutputStream output = new ByteArrayOutputStream();
RequestStreamHandlerTestImpl handler = new RequestStreamHandlerTestImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
*/
public final class WrapperConfiguration {

private WrapperConfiguration() {}

public static final String OTEL_LAMBDA_FLUSH_TIMEOUT_ENV_KEY =
"OTEL_INSTRUMENTATION_AWS_LAMBDA_FLUSH_TIMEOUT";
public static final Duration OTEL_LAMBDA_FLUSH_TIMEOUT_DEFAULT = Duration.ofSeconds(10);
Expand All @@ -30,4 +28,6 @@ public static Duration flushTimeout() {
}
return OTEL_LAMBDA_FLUSH_TIMEOUT_DEFAULT;
}

private WrapperConfiguration() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void tearDown() {
}

@Test
void handlerTraced() throws Exception {
void handlerTraced() throws IOException {
String content =
"{"
+ "\"headers\" : {"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void tearDown() {
}

@Test
void handlerTraced() throws Exception {
void handlerTraced() throws IOException {
InputStream input = new ByteArrayInputStream("hello\n".getBytes(UTF_8));
OutputStream output = new ByteArrayOutputStream();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ semantic_conventions:
library_link: https://docs.aws.amazon.com/lambda/latest/dg/java-handler.html
configurations:
- name: otel.instrumentation.aws-lambda.flush-timeout
declarative_name: java.aws_lambda.flush_timeout
type: int
default: 10000
description: Flush timeout in milliseconds.
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public static class AdviceScope {
private final AwsLambdaRequest lambdaRequest;
private final Scope functionScope;
private final io.opentelemetry.context.Context functionContext;
private final Scope messageScope;
private final io.opentelemetry.context.Context messageContext;
@Nullable private final Scope messageScope;
@Nullable private final io.opentelemetry.context.Context messageContext;

private AdviceScope(
AwsLambdaRequest lambdaRequest,
io.opentelemetry.context.Context functionContext,
Scope functionScope,
io.opentelemetry.context.Context messageContext,
Scope messageScope) {
@Nullable io.opentelemetry.context.Context messageContext,
@Nullable Scope messageScope) {
this.lambdaRequest = lambdaRequest;
this.functionContext = functionContext;
this.functionScope = functionScope;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void tearDown() {
}

@Test
void handlerTraced() throws Exception {
void handlerTraced() throws IOException {
InputStream input = new ByteArrayInputStream("hello\n".getBytes(UTF_8));
OutputStream output = new ByteArrayOutputStream();
RequestStreamHandlerTestImpl handler = new RequestStreamHandlerTestImpl();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ semantic_conventions:
library_link: https://docs.aws.amazon.com/lambda/latest/dg/java-handler.html
configurations:
- name: otel.instrumentation.aws-lambda.flush-timeout
declarative_name: java.aws_lambda.flush_timeout
type: int
default: 10000
description: Flush timeout in milliseconds.
- name: otel.instrumentation.http.known-methods
declarative_name: java.common.http.known_methods
description: >
Configures the instrumentation to recognize an alternative set of HTTP request methods. All
other methods will be treated as `_OTHER`.
Expand Down
Loading