zipkin-aws icon indicating copy to clipboard operation
zipkin-aws copied to clipboard

refs #174: adds AWS SDK V2 instrumentation support for SQS messages

Open JaidenAshmore opened this issue 5 years ago • 1 comments
trafficstars

As the AWS SDK changed in V2 the existing SQS brave instrumentation needed to be updated to the latest API.

This is mostly a copy of SendMessageTracingRequestHandler but with some breaking changes between the versions:

  • Spans can now error out for an individual message if the entire HTTP request failed or an individual message failed to be published in a batch.
  • Spans are now not 0 seconds in length and will instead be timed for the length of time it takes to send the message to SQS. Not sure if this is a problem.
  • The RemoteSetter and RemoteGetter have been pulled out to their own classes to allow for easier sharing with consumers. E.g. other SQS libraries like java-dynamic-sqs-listener should be able to easily extract this brave tracing information from the headers.
  • I did not provide a SqsMessageTracing class as it seemed a little unnecessary. Maybe I am missing why this class would be useful? Otherwise let me know and I can create this.
  • Instead of a single ExecutionInterceptor that handles both the single message and batch cases, I have split this into two classes to simplify testing and reduce the amount of branches that would have been present if this was merged into a single interceptor.
  • The batch send message does not have an overarching span that represents this operation and will just have the span for each message being sent. I am not sure whether I felt that was necessary to include but if you disagree I am happy to put it back.
  • Added integration tests so it runs against an actual SQS server. Only happy path is tested.
  • Added the ability to customize the default span tagging. I thought that consumers may want to override the tags with their own logic so I created a SpanDecorator that can be supplied to provide this customization.
  • This module was made to be Java 8 compliant. This was more a personal preference for having Java 8 classes like Optional, etc.

Looking forward to the feedback. Thanks!

JaidenAshmore avatar Jun 01 '20 02:06 JaidenAshmore

Awesome, thanks for the quick response. I'll take a look at making those changes

JaidenAshmore avatar Jun 01 '20 23:06 JaidenAshmore

closing as 3.5 years. if still needed, re-raise or someone else can!

codefromthecrypt avatar Dec 18 '23 06:12 codefromthecrypt