java - Spring boot 3 with micrometer 1.4+, how to skip tracing but continue to report metrics - Stack Overflow

admin2025-04-17  1

While upgrading to Spring boot 3.4 I'm struggling to figure out how to "only" skip tracing for certain uris/paths while continuing to report metrics.

For some endpoints like actuators and heart-beats I need metrics to be exported, but I don't want to report tracing.

First tried using the ObservationPredicate, but quickly realized this affects "all" observations (both metrics and tracing). So not quite what I need.

Then found SamplerFunction, but this was deprecated and no in latest micrometer versions removed.

What is the new way to only suppress tracing or metrics?

Many thanks, Mike

转载请注明原文地址:http://anycun.com/QandA/1744871329a88800.html