Comments (10)
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.
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.
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.
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.
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.
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.
see also opentracing-contrib/java-tracerresolver#24
from java-spring-web.
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.
@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.
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)
- Spring MVC integration example HOT 1
- Why is TracingHandlerInterceptor conditional on missing TracingFilter? HOT 3
- upgrade to opentracing 0.33.0 HOT 1
- Clarify project status HOT 3
- Error when running @SpringBootTest with SpringBootTest.WebEnvironment.NONE HOT 1
- `Scope` should be closed in the method of `afterConcurrentHandlingStarted` for async request
- Putting handlers into log fields makes ZipkinV2Reporter cause Gson errors
- Version 0.3.4 fails with OpenTracing API 0.33.0 HOT 3
- Bug: Span has already been finished; will not be reported again HOT 2
- spans not marked as error when Exceptions handled by @ControllerAdvice
- TracingHandlerInterceptor order cannot be changed and even overridden
- Span not finished when subscription is cancelled HOT 8
- Span finishes before webclient completes
- Span customization - Extend WebFluxSpanDecorator HOT 1
- Skip patterns does not apply to RestTemplate client requests
- use controller method name as operation name in webflux
- Span object is null when passing RequestEntity<?> as a request parameter
- TracingRestTemplateInterceptor does not support sorting
- Bug: (java.lang.IllegalArgumentException) Service name must not be null or empty HOT 1
- opentracing-spring-web-starter incompatible with Spring Boot 2.6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-spring-web.