Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

NOTES:

1.Using the ObservationRegistryCustomizer would still track /actuator manual calls, so but it was removedkept in to kept UnitTests running


Code Block
languagejava
collapsetrue
    ObservationRegistryCustomizer<ObservationRegistry> skipActuatorEndpointsFromObservation() {
        PathMatcher pathMatcher = new AntPathMatcher("/");
        return registry -> registry.observationConfig().observationPredicate(observationPredicate(pathMatcher));
    }

    static ObservationPredicate observationPredicate(PathMatcher pathMatcher) {
        return (name, context) -> {
            if (context instanceof ServerRequestObservationContext observationContext) {
                return !pathMatcher.match("/actuator/**", observationContext.getCarrier().getRequestURI());
            } else {
                return !SCHEDULED_TASK_NAME.equals(name);
            }
        };
    }

...