Add Span#isRoot
felixbarny opened this issue · 4 comments
I want to make sampling decisions independently of the tracer implementation. But obviously, I must only set the sampling priority on root spans to not end up with partial traces. Right now, only a Tracer implementation is able to do that. That makes it impossible for libraries like stagemonitor to provide a tracer independent sampling mechanism.
I think your question is bigger than isRoot
. It is actually about adding a new sampling mechanism. IMHO, isRoot
is the check before using shouldSample
, right? I prefer to provide to provide Tracer#newTraceListener . In that, you can decide to sample or not.
I like the idea of Tracer#newTraceListener
. But there are alternatives for that, for example java-api-extensions. I wrote my own tracer wrapper and SpanEventListener for stagemonitor. In SpanEventListener#onStart(SpanWrapper spanWrapper)
I can do my own sampling decisions.
So for now, this issue is really only about adding the Span#isRoot
method
IMHO, isRoot is the check before using shouldSample, right?
correct
In skywalking, also have similar sampling mechanism. But is it suitable for spec level? hard to say now.
@tedsuo @yurishkuro @bhs @pavolloffay opinion?
Any opinions? I currently have to use quite a bad hack for that I'd like to get rid of.