Hello,
we are upgrading from SB2.7 to SB3 and the migration from Sleuth to Micrometer is causing problems.
We register an ObservationPredicate Bean to ignore some observerations. For testing, we return false in all cases:
@Bean
public ObservationPredicate ignoreAllObservations() {
return (name, context) -> false;
}
```
However, to our surprise, some traces are still displayed in Zipkin. These are metrics from methods with are annotated with `@Scheduled(fixedRateString = X)`. Why are these Observations still being considered?
Also, we have some Sleuth configurations in our SB2.7 application, and we can't find any documentation to migrate the old configuration to Micrometer.
In particular, the following configuration parameters are the problem:
```yaml
sleuth:
tx:
enabled: false
span-filter:
additional-span-name-patterns-to-ignore:
- '(?i)^messagebrokertaskscheduler$'
- '(?i)^clientinboundchannelexecutor$'
web:
additional-skip-pattern: '/websocket.*|/connect.*'
integration:
websockets:
enabled: false
Is there any guidance on how we can migrate this configuration to Micrometer?
Thanks in advance! :)
Comment From: bclozel
@benediktwetzel Could you share which metrics are published for @Scheduled methods and how they're instrumented? I don't think Spring Framework currently instruments those so knowing how this is supported currently would help.
Comment From: benediktwetzel
Thanks for your answer!
I took another look at our code and found that we are creating a new span for some method calls (via AOP and annotations, so didn't see it before).
Span newSpan = this.tracer.nextSpan().name(methodName);
this.tracer.withSpanInScope(newSpan.start());
Hower, shouldn't this also be affected by the ObservationPredicate?
Comment From: bclozel
This code snippet is directly calling the tracing API and is not affected by the Observation support. If you want to leverage this support, you can rewrite this using the Observation API instead. For minimal disruption, you can use a different filter mechanism that's specific to the tracing API.
@Scheduled instrumentation should come in a future Spring Framework version, see https://github.com/spring-projects/spring-framework/issues/29883.
I'm closing this issue since the current behavior is expected from a Spring Boot point of view. Thanks for reporting this!
Comment From: benediktwetzel
@bclozel Thank you a lot! Can you also help me by the migration from the Sleuth configuration to Micrometer?
Comment From: bclozel
@benediktwetzel You'll get better support with the Micrometer docs and Community (there's a dedicated Slack instance, see the https://micrometer.io/ homepage).
Comment From: wilkinsona
@benediktwetzel If you haven't seen it already, you may also be interested in the migration guide that the Micrometer team have produced.