javaspring-bootspring-cloudjaegeropentracing

What does the 'opentracing: spring: web: ignoreAutoConfiguredSkipPatterns: true' do?


Hi am using the below tracing framework in my spring boot project.

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-spring-jaeger-cloud-starter</artifactId>
    <version>3.3.1</version>
</dependency>

I get the following exception when I start my application.

┌─────┐
|  org.springframework.cloud.netflix.zuul.ZuulProxyAutoConfiguration (field private java.util.List org.springframework.cloud.netflix.zuul.ZuulServerAutoConfiguration.configurers)
↑     ↓
|  io.opentracing.contrib.spring.web.starter.ServerTracingAutoConfiguration (field private java.util.regex.Pattern io.opentracing.contrib.spring.web.starter.ServerTracingAutoConfiguration.skipPattern)
↑     ↓
|  skipPattern defined in class path resource [io/opentracing/contrib/spring/web/starter/SkipPatternAutoConfiguration.class]
↑     ↓
|  org.springframework.cloud.client.CommonsClientAutoConfiguration$ActuatorConfiguration (field private java.util.List org.springframework.cloud.client.CommonsClientAutoConfiguration$ActuatorConfiguration.hasFeatures)
└─────┘

I can get rid of the error by placing the below attribute in my application.yml file. However, I do not know the impact of this flag.. Can someone throw some light on the consequence of this setting?

  spring:
    web:
      ignoreAutoConfiguredSkipPatterns: true

Solution

  • The issue you have mentioned is caused to due to circular dependency. All the above library in the error log use Spring Boot actuator and autoconfigure libraries.
    There are few known Github issues. You can find details in the skip-pattern circular dependency and Zuul Proxy circular dependency.

    Solution is correct

    spring.web.ignoreAutoConfiguredSkipPatterns: true
    

    I see that @saver has provided good information. I would like to explain in a bit details.

    By opentracing-spring-jaeger-cloud-starter dependency all the applications are automatically instrumented with a OpenTracing agent, that will create traces/spans related to internal operations (app, db, cache etc. etc.).

    There is class called SkipPatternAutoConfiguration which configures all the actuator skip patterns. So, your issue is related to here

    Through the TracingFilter, all sampled incoming requests result in creation of a Span. By the skip-pattern property we configure which URIs we would like to skip. By default, all the spring boot actuator endpoints are automatically added to the skip pattern. If you want to disable this behavior set *.skip-patterns to true.

    The reason I have used * here because this skip pattern is used by a lot of libraries which use telemetry and tracing. e.g. Opentracing, Sleuth, Spring cloud actuatorsetc.

    The property you have set is read by ConditionalOnProperty

     @ConditionalOnProperty(value = "opentracing.spring.web.ignoreAutoConfiguredSkipPatterns", havingValue = "false", matchIfMissing = true)
    

    Default value is matchIfMissing = true , so whenever you don't provide the value application tries to configure the skip-pattern. It fails here for you in the circular dependency. As now you have set ignoreAutoConfiguredSkipPatterns to true, the property havingValue = "false" doesn't satisfy and skip patterns are not configured. Hence, the issue will not reproduce.

    Few links:
    SkipPatternAutoConfiguration
    ServerTracingAutoConfiguration
    CommonsClientAutoConfiguration
    ZuulProxyAutoConfiguration