micrometer-metrics/tracing

@NewSpan/@SpanTag not working on Java interface methods

Opened this issue · 1 comments

The combination @NewSpan/@SpanTag seems not fully working on interface methods - like Spring Data JPA repo methods (tested with latest Spring Boot 3.3.1 release).

Instead of creating a new span for the actual repo call and parent span is getting duplicated. All declared span tags are also added to parent span.

Not sure if this is really a Micrometer topic or if it is more Spring Boot related? Already asked there - first feedback was that most of the functionality comes from Micrometer.

However, I didn't find a hint on the Micrometer docs if/how @NewSpan/@SpanTag annotation can be added to Java interfaces.

Based on the tests and the corresponding documentation, it appears to be a known limitation that @NewSpan doesn't work on interfaces, though I'm not sure why that would be without looking into it more.

// In Sleuth @NewSpan and @ContinueSpan annotations would be taken into
// consideration. In Micrometer Tracing due to limitations of @Aspect
// we can't do that. The @SpanTag annotation will work well though.

We'll have to take a look and make sure the aspect-related code is in-sync between the Micrometer repo (where I believe this kind of thing works) and the tracing repo.