-
Notifications
You must be signed in to change notification settings - Fork 344
Mechanism to understand when ActiveSpan has been finished #155
Comments
b) +1, IMO, the return value should be enough. |
Very important issue for me as it seems my current wrapper implementation would not work with OT 0.30.0. |
The wrapper implementations are becoming more and more difficult with the growing API. I think an Observer facility would make more sense (Cf. opentracing/opentracing-go#135) |
(sorry for my delay getting to this) IMO we should not change core APIs for the convenience of wrappers. If there's a non-theoretical performance problem or something important is impossible, those would be different stories altogether. I think I'm basically agreeing with @yurishkuro on this: since we can factor this sort of thing into a dedicated TracerObserver, that seems like the safest (i.e., most minimal) place to start. |
I like an Observer as it is clearer on how to extend an existing tracer. |
+1 on observable for span events. Something like finish event should do the job here.
|
I think this can be done at the moment by simply doing this: // span builder wrapper code..
@Override
public ActiveSpan startActive() {
Span span = startManual();
return wrappedTracer.makeActive(span);
} and you don't have to wrap any continuation or active span. Then |
Documentation note about I approach^^^ I proposed. The implementation shouldn't do something like this: |
Maybe |
@felixbarny it makes more sense on |
I'm not too sure about that. When its on BaseSpan, its available on Span and ActiveSpan. Do you mean we don't need it on Span? |
I don't think it's needed on Span. Do you have a concrete example? |
No, I don't have a concrete use case. I'm not too familiar with the new api tbh. Why do you think |
Hey all, Wondering if we should rename this issue to something such as "Observer API"? (which, I think, many people would like to have eventually). (Also, the |
I would recommend a new issue with such title and refer to this one. In Go there is already an observer API (in contrib only), which only applies to the span life cycle, not the Scope life cycle, so it's a decision whether those should be merged or not. Also, it has been often mentioned that observers would work better if there was a stable span ID exposed from the SpanContext, so we can also link to that issue/PR as a dependency. |
Currently, if writing a wrapper tracer, there is no way to know when the ActiveSpan has actually been finished, as the application (or framework integrations) simply call
deactivate
, but as this is ref counted, any call to this method could potentially finish the span.Options are:
a) The wrapper tracer would also need to reference count
b) The
deactivate
method could return a boolean indicating whether the associatedActiveSpan
has been finishedc) The BaseSpan could support an
isFinished
method which could be checked afterdeactivate
d) Implement some active span lifecycle support
The text was updated successfully, but these errors were encountered: