GithubHelp home page GithubHelp logo

Comments (8)

michaelsembwever avatar michaelsembwever commented on August 20, 2024

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.

mabn avatar mabn commented on August 20, 2024

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.

michaelsembwever avatar michaelsembwever commented on August 20, 2024

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.

bhs avatar bhs commented on August 20, 2024

@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.

michaelsembwever avatar michaelsembwever commented on August 20, 2024

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.

mabn avatar mabn commented on August 20, 2024

@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.

michaelsembwever avatar michaelsembwever commented on August 20, 2024

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.

tedsuo avatar tedsuo commented on August 20, 2024

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)

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.