Serverless observability made easy with Lambda Powertools for Java — Tracing

Duke Lambda Powertools

Tracing

FunctionProps.builder()
.runtime(Runtime.JAVA_11)
.code(...)
.timeout(Duration.seconds(29))
.memorySize(2048)
.handler("...")
.role(role)
.tracing(Tracing.ACTIVE)
.build());
CfnApiProps.builder()
.stageName(apiStageName)
.definitionBody(openapiSpecAsObject)
.tracingEnabled(true)
.build());
X-Ray service map
X-Ray Service Map
plugins{
id ‘io.freefair.aspectj.post-compile-weaving’ version ‘6.4.1’
}
dependencies {
aspect ‘software.amazon.lambda:powertools-tracing:1.12.1’
}
@Tracing
public APIGatewayProxyResponseEvent handleRequest(APIGatewayProxyRequestEvent input, Context context) {
//...
}
@Tracing(segmentName = "Book_Delivery_Transaction")
public Delivery bookDelivery(Integer farmId, Integer slotId, Integer userId) throws SQLException {
//...
}
X-Ray traces with segments and subsegments
X-Ray traces with segments and subsegments
TracingUtils.putAnnotation("farmId", farmId);
Trace annotations with additional context (business data and coldstart)
Trace annotations with additional context

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jérôme Van Der Linden

Jérôme Van Der Linden

103 Followers

Senior Solution Architect @AWS - software craftsman, agile and devops enthusiastic, cloud advocate. Opinions are my own.