spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Spring Cloud Sleuth integration

Open adeel718 opened this issue 3 years ago • 5 comments

Type: Feature

Is your feature request related to a problem? Please describe. As part of spring 2.2.x before this was moved to aws spring spring sleuth integration worked by default, this is no longer working and someone had raised it here but I cant seem to find the ticket here to get this integrated - https://github.com/spring-cloud/spring-cloud-sleuth/issues/1956

Describe the solution you'd like Integrate spring cloud sleuth so that tracing works by default

Describe alternatives you've considered NA

Additional context NA

adeel718 avatar May 18 '22 13:05 adeel718

Thanks for bringing it to our attention. Thats something definitely nice to add in 3.0.

maciejwalkowiak avatar May 18 '22 15:05 maciejwalkowiak

Would it be better to instead integrate opentracing? It would support more tracing backends.

sgarfinkel avatar May 26 '22 21:05 sgarfinkel

Sleuth under the hood integrates with OpenTelemetry (which is a opentracing successor) and few more tracing backends AFAIR, so actually staying compatible with Sleuth opens up doors for supporting even more backends.

maciejwalkowiak avatar May 30 '22 04:05 maciejwalkowiak

For the moment while waiting for this to be released in version 3 where we are in need of a traceId which was originally supplied using sleuth (uses Brave underneath by default I believe) we are using the @NewSpan annotation. This is supplied by the current spring-cloud-sleuth-api library which generates the Span each time the listen() method is called as part of our SQS Listeners:

@SqsListener( value = ..., deletionPolicy = ...)
@NewSpan()
public void listen(@Payload String message) throws JsonProcessingException {
...
}

Works well so far with it registering with the SLF4J MDC so it's worth noting as a temporary solution.

iranicus avatar Jun 08 '22 10:06 iranicus

Just as an FYI, Brave supports instrumentation of AWS SDK v1 and v2 out of the box https://github.com/openzipkin/zipkin-aws/tree/master/brave/instrumentation-aws-java-sdk-v2-core. You can use this until a higher level integration is supported by Spring.

sgarfinkel avatar Jun 18 '22 21:06 sgarfinkel

Closed in favor of https://github.com/awspring/spring-cloud-aws/issues/566

maciejwalkowiak avatar Jan 04 '23 12:01 maciejwalkowiak