Description
Hi all,
I'm currently trying to setup individual subsegments for a dynamoDB and SQS call to see their individual performance.
My project is in Java using Micronaut and GraalVM (I followed these steps to add the needed classes for reflection to work)
After doing so I was able to see subsegment traces for SQS but when I add in a subsegment for dynamoDB call, I no longer see the SQS subsegment info for that trace.
After debugging a bit I see the parent traceIDs are the same for both but at the end of the call, there is only one subsegment added to the current segment which is the dynamo one.
Here are the way my current subsegments are setup:
SQS
`
SendMessageRequest sendMessageRequest =
SendMessageRequest.builder().messageBody(message).queueUrl(queueUrl).build();
Subsegment subsegment = AWSXRay.beginSubsegment("sqs");
return sqsAsyncClient
.sendMessage(sendMessageRequest)
.thenAccept(
x -> {
AWSXRay.endSubsegment(subsegment);
log.info("Successfully queued request: {}", message);
})
.exceptionally(throwable -> handleExceptions(throwable, message));`
I know I need to also close the subsegment in case of exception but for testing purposes I haven't done so yet and all my request are successful so far.
DynamoDb
`
Subsegment dbSegment = AWSXRay.beginSubsegment("db call");
boolean result =
dynamoDao
.messageExists(message)
.thenApply(
x -> {
AWSXRay.endSubsegment(dbSegment);
log.info("Successfully checked message status");
return x;
})
.exceptionally(
exception -> {
return false;
})
.join();
return result;`