The TracingRequestHandler in brave-instrumentation/aws-java-sdk-core can throw NPE due to an application span not being present in both the beforeAttempt and afterAttempt callback.
The root cause here is the s3 client executes a stealth HEAD request for many of the operations like CreateBucket, doesBucketExistV2 to do some preliminary checking and caching. Unfortunately, these HEAD requests do not invoke beforeExecution so an application span is never created for them, but they do invoke beforeAttempt.
This means the overall aws-sdk span isn't available and results in the NPE.
A couple of options:
Capture the head request and correctly map it to its parent. I'm not sure this is possible with what the callback provides.
ignore requests that don't have the span from beforeExecution
The TracingRequestHandler in brave-instrumentation/aws-java-sdk-core can throw NPE due to an application span not being present in both the
beforeAttempt
andafterAttempt
callback.The root cause here is the s3 client executes a stealth HEAD request for many of the operations like
CreateBucket
,doesBucketExistV2
to do some preliminary checking and caching. Unfortunately, these HEAD requests do not invokebeforeExecution
so an application span is never created for them, but they do invokebeforeAttempt
.This means the overall
aws-sdk
span isn't available and results in the NPE.A couple of options:
beforeExecution