use of io.opentracing.contrib.web.servlet.filter.ServletFilterSpanDecorator in project java-spring-web by opentracing-contrib.
the class ServerTracingAutoConfiguration method tracingFilter.
@Bean
@ConditionalOnMissingBean(TracingFilter.class)
public FilterRegistrationBean tracingFilter(Tracer tracer, WebTracingProperties tracingConfiguration) {
log.info(format("Creating %s bean with %s mapped to %s, skip pattern is \"%s\"", FilterRegistrationBean.class.getSimpleName(), TracingFilter.class.getSimpleName(), tracingConfiguration.getUrlPatterns().toString(), tracingConfiguration.getSkipPattern()));
List<ServletFilterSpanDecorator> decorators = servletFilterSpanDecorator.getIfAvailable();
if (CollectionUtils.isEmpty(decorators)) {
decorators = Collections.singletonList(ServletFilterSpanDecorator.STANDARD_TAGS);
}
TracingFilter tracingFilter = new TracingFilter(tracer, decorators, tracingConfiguration.getSkipPattern());
FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(tracingFilter);
filterRegistrationBean.setUrlPatterns(tracingConfiguration.getUrlPatterns());
filterRegistrationBean.setOrder(tracingConfiguration.getOrder());
filterRegistrationBean.setAsyncSupported(true);
return filterRegistrationBean;
}
Aggregations