org.springframework.boot.actuate.metrics.web.servlet.DefaultWebMvcTagsProvider Java Examples

The following examples show how to use org.springframework.boot.actuate.metrics.web.servlet.DefaultWebMvcTagsProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: K8sMetricsAutoConfiguration.java    From foremast with Apache License 2.0 5 votes vote down vote up
@Bean
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public WebMvcTagsProvider serviceCallerTag() {
    if (metricsProperties.hasCaller()) {
        return new CallerWebMvcTagsProvider(metricsProperties.getCallerHeader());
    }
    else {
        return new DefaultWebMvcTagsProvider();
    }
}
 
Example #2
Source File: HttpMetricsTagConfiguration.java    From micrometer with Apache License 2.0 5 votes vote down vote up
@Bean
WebMvcTagsProvider webMvcTagsProvider() {
    return new DefaultWebMvcTagsProvider() {
        @Override
        public Iterable<Tag> getTags(HttpServletRequest request, HttpServletResponse response,
                                     Object handler, Throwable exception) {
            return Tags.concat(
                    super.getTags(request, response, handler, exception),
                    Optional.ofNullable(responseTags.remove(response)).orElse(Tags.empty())
            );
        }
    };
}