Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
fb6e20d
Add OpenTelemetry-based tracing module (powertools-tracing-openteleme…
David-DAM Aug 9, 2026
4aa5229
Introduce TracingOpenTelemetryAspect for annotation-based span creation
David-DAM Aug 15, 2026
e01f87d
Add JavaDoc to TracingOtel annotation for OpenTelemetry tracing confi…
David-DAM Aug 15, 2026
bac5e69
Refactor TracingOpenTelemetry for handler-specific attributes, respon…
David-DAM Aug 16, 2026
c424115
Introduce Lambda event context extraction and enrichment for OpenTele…
David-DAM Aug 16, 2026
288878e
Add SNS and SQS context extraction and enrichment for OpenTelemetry t…
David-DAM Aug 18, 2026
371ae83
Add context extraction and enrichment for DynamoDB, Kinesis, and S3 e…
David-DAM Aug 22, 2026
3a72011
Introduce Span Links and TraceContextPropagationMode for advanced tra…
David-DAM Aug 22, 2026
df7fae0
Refactor context extractors and `ExtractedTraceContext` to support `S…
David-DAM Aug 22, 2026
a5ff6f5
Add AWS X-Ray Propagator support in OpenTelemetry tracing module, enh…
David-DAM Aug 23, 2026
456d800
Add OpenTelemetry dependencies and deprecate tests for unsupported sc…
David-DAM Aug 23, 2026
cf17e40
Refactor OpenTelemetry provider to support GlobalOpenTelemetry instan…
David-DAM Aug 23, 2026
afd1d7b
Add support for OTLP HTTP/Protobuf protocol in OpenTelemetry provider…
David-DAM Aug 23, 2026
1ed0368
Add support for custom OTLP exporter configuration, including endpoin…
David-DAM Aug 29, 2026
d8880a2
Add flush support in `TracingOpenTelemetry` and `OpenTelemetryProvide…
David-DAM Aug 29, 2026
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
43 changes: 38 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>software.amazon.lambda</groupId>
Expand All @@ -25,7 +25,8 @@

<name>Powertools for AWS Lambda (Java) - Parent</name>
<description>
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating custom metrics asynchronously easier.
A suite of utilities for AWS Lambda Functions that makes tracing with AWS X-Ray, structured logging and creating
custom metrics asynchronously easier.
</description>
<scm>
<url>https://github.com/aws-powertools/powertools-lambda-java</url>
Expand Down Expand Up @@ -77,6 +78,7 @@
<module>powertools-parameters/powertools-parameters-appconfig</module>
<module>powertools-parameters/powertools-parameters-tests</module>
<module>examples</module>
<module>powertools-tracing-opentelemetry</module>
</modules>

<properties>
Expand Down Expand Up @@ -119,6 +121,8 @@
<junit-pioneer.version>2.3.0</junit-pioneer.version>
<crac.version>1.5.0</crac.version>
<native-maven-plugin.version>0.11.5</native-maven-plugin.version>
<opentelemetry-api.version>1.65.0</opentelemetry-api.version>
<opentelemetry.aws.xray.propagator.version>1.59.0-alpha</opentelemetry.aws.xray.propagator.version>

<!-- As we have a .mvn directory at the root of the project, this will evaluate to the root directory
regardless of where maven is run - sub-module, or root. -->
Expand Down Expand Up @@ -313,6 +317,26 @@
<artifactId>commons-lang3</artifactId>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>${opentelemetry-api.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
<version>${opentelemetry-api.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
<version>${opentelemetry-api.version}</version>
</dependency>
<dependency>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-aws-xray-propagator</artifactId>
<version>${opentelemetry.aws.xray.propagator.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
Expand Down Expand Up @@ -393,6 +417,12 @@
<version>3.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
<version>${opentelemetry-api.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -471,7 +501,8 @@
<enabled>true</enabled>
<options>
<enableExperimentalPredefinedClasses>true</enableExperimentalPredefinedClasses>
<enableExperimentalUnsafeAllocationTracing>true</enableExperimentalUnsafeAllocationTracing>
<enableExperimentalUnsafeAllocationTracing>true
</enableExperimentalUnsafeAllocationTracing>
</options>
<metadataCopy>
<disabledStages>
Expand Down Expand Up @@ -692,7 +723,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<JDK_JAVA_OPTIONS>--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED</JDK_JAVA_OPTIONS>
<JDK_JAVA_OPTIONS>--add-opens java.base/java.util=ALL-UNNAMED --add-opens
java.base/java.lang=ALL-UNNAMED
</JDK_JAVA_OPTIONS>
</environmentVariables>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ public static String getenv(String name) {
return System.getenv(name);
}

public static boolean containsKey(String key) {
return System.getenv().containsKey(key);
}

public static String getProperty(String name) {
return System.getProperty(name);
}
Expand Down
151 changes: 151 additions & 0 deletions powertools-tracing-opentelemetry/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2023 Amazon.com, Inc. or its affiliates.
~ Licensed under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~ http://www.apache.org/licenses/LICENSE-2.0
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>powertools-tracing-opentelemetry</artifactId>
<packaging>jar</packaging>

<parent>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-parent</artifactId>
<version>2.10.0</version>
</parent>

<name>Powertools for AWS Lambda (Java) - Tracing OpenTelemetry</name>
<description>
A suite of utilities for AWS Lambda Functions that makes tracing with OpenTelemetry, structured logging and
creating custom metrics asynchronously easier.
</description>

<dependencies>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry.contrib</groupId>
<artifactId>opentelemetry-aws-xray-propagator</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-common</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-core</artifactId>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sdk-core</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-sdk-testing</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>software.amazon.lambda</groupId>
<artifactId>powertools-common</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit-pioneer</groupId>
<artifactId>junit-pioneer</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<environmentVariables>
<AWS_LAMBDA_INITIALIZATION_TYPE>on-demand</AWS_LAMBDA_INITIALIZATION_TYPE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package software.amazon.lambda.powertools.tracing.opentelemetry;

/**
* Defines how method responses and errors are captured by tracing.
*/
public enum CaptureMode {

/**
* Capture response and errors according to environment variables.
*/
ENVIRONMENT_VAR,

/**
* Capture the method response.
*/
RESPONSE,

/**
* Capture errors thrown by the method.
*/
ERROR,

/**
* Capture both the method response and errors.
*/
RESPONSE_AND_ERROR,

/**
* Disable response and error capture.
*/
DISABLED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package software.amazon.lambda.powertools.tracing.opentelemetry;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Annotation to enable OpenTelemetry tracing for the annotated method.
* Automatically creates and manages an OpenTelemetry span for the method invocation.
* <p>
* This annotation allows configuration of the namespace, span name, and capture mode
* for tracing purposes. If no explicit configuration is provided, default values are used.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Tracing {
/**
* The namespace associated with the span.
*
* <p>If empty, the default Powertools service name is used.
*
* @return the namespace
*/
String namespace() default "";

/**
* The name of the span.
*
* <p>If empty, the annotated method name is used.
*
* @return the span name
*/
String spanName() default "";

/**
* Controls whether the method response and/or errors are captured
* as span data.
*
* @return the capture mode
*/
CaptureMode captureMode() default CaptureMode.ENVIRONMENT_VAR;
}
Loading