Skip to content

Commit e787615

Browse files
authored
Remove transitive dependency on log4j (#71)
1 parent 38a0360 commit e787615

File tree

7 files changed

+39
-42
lines changed

7 files changed

+39
-42
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ repositories {
2323
}
2424

2525
dependencies {
26-
implementation 'com.amazonaws:aws-lambda-java-log4j2:1.4.0'
26+
implementation 'com.amazonaws:aws-lambda-java-core:1.2.1'
2727
implementation 'com.amazonaws:aws-lambda-java-events:3.10.0'
2828
compileOnly 'com.amazonaws:aws-java-sdk-kinesis:1.12.100'
2929
implementation 'com.google.code.gson:gson:2.8.9'
@@ -39,6 +39,7 @@ dependencies {
3939

4040
// Use JUnit test framework
4141
testImplementation 'junit:junit:4.13.2'
42+
//log4j imported for running unit tests. Doesn't get bundled with the build artifact.
4243
testImplementation 'org.apache.logging.log4j:log4j-api:2.17.0'
4344
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.0'
4445
testImplementation 'com.github.stefanbirkner:system-rules:1.19.0'
@@ -52,7 +53,7 @@ sourceCompatibility = 1.8
5253
targetCompatibility = 1.8
5354

5455
group = 'com.datadoghq'
55-
version= '1.4.2'
56+
version= '1.4.3'
5657
archivesBaseName = "datadog-lambda-java"
5758
description = "datadog-lambda-java"
5859

tests/testfunctions/snapshots/logs/helloApiGatewayV2_Java11.log

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ START RequestId: XXXX Version: $LATEST
1616
[dd.trace 1970-01-01 00:00:00 +0000] [main] INFO datadog.trace.agent.common.writer.WriterFactory - Detected serverless environment. Serverless extension has not been detected, using PrintingWriter
1717
{"level": "ERROR", "message": "datadog: The request passed to DDLambda contained null headers. Are you sure the handler signature matches the event provided?"}
1818
{"level": "ERROR", "message": "datadog: The request passed to DDLambda contained null headers. Are you sure the handler signature matches the event provided?"}
19-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
20-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
21-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:true", "runtime:xxxx"], "e": 1234567890}
22-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
23-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
24-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "true", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
19+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
20+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
21+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java11", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:true", "runtime:xxxx"], "e": 1234567890}
22+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}
23+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}
24+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java11", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "true", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java11", "functionname": "java-integration-test-dev-helloapigatewayv2_java11", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java11", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}

tests/testfunctions/snapshots/logs/helloApiGatewayV2_Java8.log

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ START RequestId: XXXX Version: $LATEST
1515
[dd.trace 1970-01-01 00:00:00 +0000] [main] INFO datadog.trace.agent.common.writer.WriterFactory - Detected serverless environment. Serverless extension has not been detected, using PrintingWriter
1616
{"level": "ERROR", "message": "datadog: The request passed to DDLambda contained null headers. Are you sure the handler signature matches the event provided?"}
1717
{"level": "ERROR", "message": "datadog: The request passed to DDLambda contained null headers. Are you sure the handler signature matches the event provided?"}
18-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
19-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
20-
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.0", "cold_start:true", "runtime:xxxx"], "e": 1234567890}
21-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
22-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
23-
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "true", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.0", "function_version": "$LATEST"}}]]}
18+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
19+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:false", "runtime:xxxx"], "e": 1234567890}
20+
{"m": "aws.lambda.enhanced.invocations", "v": 1.0, "t": ["memorysize:1024", "account_id:XXXX", "resource:Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname:Java-integration-test-dev-helloApiGatewayV2_Java8", "region:sa-east-1", "datadog_lambda:1.4.2", "cold_start:true", "runtime:xxxx"], "e": 1234567890}
21+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}
22+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "false", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}
23+
{"traces": [[{"service": "aws.lambda", "name": "aws.lambda", "resource": "Java-integration-test-dev-helloApiGatewayV2_Java8", "trace_id": "xxxxx", "span_id": "xxxxx", "parent_id": "0", "start": 1234567890, "duration": 12345, "error": 0, "metrics": {"_dd.agent_psr": 1.0, "_sample_rate": 1, "thread.id": 1}, "meta": {"language": "jvm", "thread.name": "main", "cold_start": "true", "resource_names": "Java-integration-test-dev-helloApiGatewayV2_Java8", "functionname": "java-integration-test-dev-helloapigatewayv2_java8", "function_arn": "arn:aws:lambda:sa-east-1:123456789012:function:java-integration-test-dev-helloapigatewayv2_java8", "runtime-id": "00000000-0000-0000-0000-000000000000", "request_id": "00000000-0000-0000-0000-000000000000", "datadog_lambda": "1.4.2", "function_version": "$LATEST"}}]]}

0 commit comments

Comments
 (0)