Comments (8)
I expect that a child of a "no span" (or NoopSpan, or null) is just a span without a parent.
This is the false premise (to the direction taken so far).
An empty context provides a noop span, and the child of a noop span is implicitly another noop span.
An explicit action is required to go from an empty context to an empty (rather than noop) span.
This is what provides the most fluent api for users.
Though it might be better to add SpanContext.isEmpty method to the API, make it explicit and get rid of this weird "instanceof".
I suspect this has a lot of merit. The current situation does lead to having to understand a number of complexities in the design and use patterns.
from opentracing-java.
I do not follow...
When a request is received I want a span to start which will be tracked/reported no matter if the request(carrier) contains span context or not. In both these cases I'd like following code to work properly:
SpanContext parent = tracer.extract(Format.Builtin.TEXT_MAP, adapter);
Span span = tracer.buildSpan("some-name").asChildOf(parent).start())
But if empty context provides a noop span, then I'll need some conditional like:
SpanContext parent = tracer.extract(Format.Builtin.TEXT_MAP, adapter);
SpanBuilder builder = tracer.buildSpan("some-name");
Span span;
if(parent is empty-context) {
span = builder.build(); // can't use asChildOf because it will create NoopSpan and I don't want it
} else {
span = builder.asChildOf(parent).build();
}
Do I understand this correctly?
from opentracing-java.
This is in a direct contradiction to the changes done in #56 ("A child of a NoopSpan is a NoopSpan"), but I believe that the behaviour introduced there is not correct.
FTR i think it'll be more constructive focusing on discussions that happened in #58
But if empty context provides a noop span, then I'll need some conditional likeβ¦
That is correct.
The premise is that in any decent sized microservices platform the majority of services do not force sampling/tracing, that they only continue tracing requests that are already being traced. This would also be the default approach when adding tracing to libraries and frameworks. For more info see #58 (comment)
from opentracing-java.
@michaelsembwever as has been demonstrated in other OT language implementations, there is no need for this sort of conditional as long as asChildOf
(and followsFrom
) are documented to accept the empty/null/whatever SpanContext
... I feel rather strongly that we should allow the user to just write
span = builder.asChildOf(parentContext).build();
regardless of whether parentContext is an EmptyContext
or null
or whatever we've agreed is most appropriate in modern Java.
from opentracing-java.
span = builder.asChildOf(parentContext).build();
They can. The discussion here is to whether tracing off an empty context here is implicitly forced or not. My argument in #58 (comment) is that you can easily save yourself hundreds or thousands of lines of code by not implicitly forcing tracing.
Both side of the argument though clarify the need for a better mechanism, like spanContext.isEmpty()
to exist.
from opentracing-java.
@michaelsembwever I've read #58 discussion - it makes sense for it to behave like you described.
But if it's a part of some instrumented framework you'll still need some extra code to decide if this the instrumented service is the service which starts traces or not.
It would be ideal if the same construction (builder.asChildOf(parentContext).build()
) could be used in both cases and the behaviour explicitly configurable (via sampling policy?).
from opentracing-java.
It would be ideal if the same construction (builder.asChildOf(parentContext).build()) could be used in both cases and the behaviour explicitly configurable (via sampling policy?)
Agreed. And it's been previously discussed and agreed upon :-)
from opentracing-java.
Spring cleaning here: closing this issue as it is out of date. Feel free to reopen or create a new issue if you'd like to continue.
from opentracing-java.
Related Issues (20)
- Why doesn't Span support try-with-resources? HOT 4
- Docs reference outdated API HOT 3
- Correct way how to not report fast spans HOT 12
- Unit tests fail with "AbstractMethodError" HOT 2
- Access Custom Tracer's fields through GlobalTracer.get() HOT 4
- Overriding timestamp on spans HOT 3
- TextMapInjectAdapter does not implement TextMap HOT 1
- Not able to get simple opentracing code to work HOT 3
- Missing ScopeManager.active() method HOT 1
- `NoopSpan` cannot be used as a default, parent span without throwing Exception. HOT 6
- try-with-resources (which doesn't work) is still the main documented way to use OpenTracing in java
- Breaking change from 0.31 to 0.33 HOT 6
- TracingKafkaConsumer incompatible with Kafka >= 2.4.0 HOT 1
- access to registered tracer
- Migrating the CI CD from Travis to GitHub Actions HOT 4
- Are there version mappings to OpenTracing Specification?
- Span object is null when passing RequestEntity<?> as a request parameter
- Possible to terminate span on remote system? HOT 2
- State of opentracing-java HOT 1
- Why are some tags missing in the releases? 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 opentracing-java.