Both HttpRequestsObservationFilter and HttpRequestsObservationWebFilter record observations for Spring's web frameworks. It would be generally useful to provide an option to ignore some path prefixes entirely from instrumentation - for example, the Spring Boot Actuator endpoint should not be instrumented in an application.

Comment From: marcingrzejszczak

I'm wondering if it wouldn't be better to opt in for paths instead of opt out of them. The log in Sleuth is really complicated to automatically skip certain patterns. Maybe it would be easier to just say what you want to observe instead of what you don't want to observe?

Comment From: jonatan-ivanov

I've seen lots of teams building apps that has lot of "rpc-like" endpoints: every operation is a different endpoint which is named after what it does. In these situations, I think I would say opting-out is better. Also maybe we should opt-out actuator endpoints by default (something like this).

I guess the most important thing though is to make the path, host, method, etc. easily available through common getters from the context.

Comment From: bclozel

After considering different options here, it seems that there is no simple approach for filtering requests. Path prefixes might work for some cases, but the two comments above seem to show that the use cases can also be much more complex. This would also introduce a filtering mechanism that would cause a performance impact in all cases, even if not needed.

Additionally, "skipping" the observation here in some cases could confuse other instrumentations down the line. We could of course turn observations into "no-ops". At this stage, the ObservationPredicate is a much better place for that since it's got the entire observation context for matching and has the power to turn the observation into "no-ops".

As a result, I'm declining this change in favor of micrometer-metrics/micrometer#3678 (that should allow to "no-op" observations and child observations) and spring-projects/spring-boot#34801 (which should drive the entire feature through predicates).