Git Product home page Git Product logo

Comments (10)

pavolloffay avatar pavolloffay commented on June 7, 2024 1

To clarify this issue, the use case is to provide a way to quickly disable instrumentation.

I can think of two solutions:

1. disable all auto-configs with a property

This is by means is the best from the performance perspective. However, if users are using tracer inside the app it can fail in some scenarios (e.g. fails to autowire tracer bean).

2. use noop tracer

The only issue I currently have with noop tracer is that it does not use span source inside so switching from real tracer to noop can result in NPEs (e.g. tracer.activeSpan() retruns null (https://github.com/opentracing/opentracing-java/blob/master/opentracing-noop/src/main/java/io/opentracing/noop/NoopTracer.java#L41)). I would like to address this in the next version of the API.

When somebody is not using tracerresolver and would like to disable instrumentation it can simply return NoopTracer bean or use:

@ConditionalOnProperty(name = "instrumenation.enabled", havingValue = "true", matchIfMissing = true)
@Bean
Tracer tracer() {...}

So when he start app using java -jar -Dinstrumentation.enabled=false foo.jar our auto-config will use NoopTracer.

However, if you are using tracerrresolver you cannot do ^^^. Tracer impl can be removed from classpath, however, it is not ideal for k8s deployment where you would like to control things via env properties.

from java-spring-web.

objectiser avatar objectiser commented on June 7, 2024

As TracerResolver relies on the relevant tracer being in the classpath, wouldn't another option just be to comment out the tracer dependency? Not saying a config option wouldn't be ok, but just looking at alternatives.

from java-spring-web.

pavolloffay avatar pavolloffay commented on June 7, 2024

Yeah, that is one possibility although it might be inconvenient.

I would like to port https://github.com/redhat-helloworld-msa/ola and other SB services to use tracerresolver. Currently the code use noop is tracer server URL is not specified.

from java-spring-web.

jpkrohling avatar jpkrohling commented on June 7, 2024

I think your case is one that warrants setting the "skip tracer resolver" flag and dealing with the GlobalTracer at your application level. After all, the logic of "if tracer server URL is not specified, use the NoopTracer` is an application logic :)

from java-spring-web.

pavolloffay avatar pavolloffay commented on June 7, 2024

if tracer server URL is not specified, use the NoopTracer it is kind of "a" logic. How would you solve my use case then?

I would like to get rid of all app level logic regarding tracing. And I would like to be able to enable/disable tracing with some ENV property. (currently it can be done by using noop, we could also use one conf. property on all auto-configs)

from java-spring-web.

objectiser avatar objectiser commented on June 7, 2024

If this was going to be done via env/property - then it would be better done in the TracerResolver itself, so it would be applicable outside any particular instrumentation/framework.

from java-spring-web.

pavolloffay avatar pavolloffay commented on June 7, 2024

see also opentracing-contrib/java-tracerresolver#24

from java-spring-web.

ask4gilles avatar ask4gilles commented on June 7, 2024

I'd like to be able to completely skip the autoconfig (like we can do in https://github.com/opentracing-contrib/java-spring-cloud/) It would be the responsibility of the user to inject the tracer with required=false Currently, what would be the alternative to skip web tracing? (for IT tests for example or for some environments where you are not interested in tracing metrics?)

from java-spring-web.

pavolloffay avatar pavolloffay commented on June 7, 2024

@ask4gilles I have created a separate issue for this: #65. Let me know if you would like to contribute it, it seems like a simple fix.

from java-spring-web.

pavolloffay avatar pavolloffay commented on June 7, 2024

I will close this for now.

At the moment all auto-configurations can be disabled with a property. Tracer configuration has been moved here https://github.com/opentracing-contrib/java-spring-tracer-configuration.

from java-spring-web.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.