-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace ALWAYS_PARENT with a composite ParentOrElse sampler #609
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I think we should revise the naming of the SamplingResult
s, however. NOT_RECORD
and RECORD_AND_SAMPLED
(mixed tenses) sounds a bit awkward IMHO.
Also, where and how is RECORD
(but not sampled) used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: I misread this, sorry. Please disregard this review.
You do fix the first point in this PR, but the two new samplers cannot replace the behavior of the old ALWAYS_PARENT in the second point.
Maybe a just stared at this for too long but I am still not sure I'm reading this right. I'll try to restate this spec: ALWAYS_PARENT_OR_ON, ALWAYS_PARENT_OR_OFF:
If this is correct, I suggest renaming ALWAYS_PARENT_OR_OFF to ONLY_PARENT. Also, I would really love to see the "no-parent" case explicitly addressed. As it reads now, it's still ambiguous, whether the no-parent case falls under "otherwise" or "the writer of the spec did not consider that case". |
@bogdandrutu you could add a table that shows the logic at one glance:
|
@Oberon00 Personally I find the (
I assumed the former implicitly but it certainly makes sense to spell this out clearly. |
Looks great to me. The table definitely helps a lot ;) |
A final remark: Do we actually need both ALWAYS_PARENT_OR_* variants? |
@Oberon00 Do you mean the feature of either default on or off if no parent is present in general or having it as two separate samplers? |
I forgot about using the ProbabilitySampler implementation! Makes sense. Maybe the spec should even state, normatively, that ALWAYS_PARENT_OR_ON is equivalent to a Probability(1) and _OR_OFF to (0). |
Signed-off-by: Bogdan Drutu <[email protected]>
@yurishkuro @arminru @Oberon00 updated to use a composite |
Reposting my comment as the containing conversation was marked resolved: I think the ALWAYS_PARENT pattern is still common enough to warrant it's own sampler. We should take care not to fall into the inner-platform trap here. After all, I can already write something like this today (using Java 8 functional interfaces, pseudo-code): setSampler((parent, attrs) -> new Decision(
!parent.isValid() || parent.getTraceFlags().isSampled())) This could be written as |
@Oberon00 the reason I am not a fan of ALWAYS_PARENT is because it conflates two different questions - WHETHER a sampling decision must be made, and WHAT that decision should be. For example, in Jaeger clients the former is never even an issue because it's enforced by the tracer itself, so the sampler is only every concerned with the decision itself. OTEL's model is more flexible as it allows up-sampling lower in the call graph. If we were to support ALWAYS_PARENT (which, btw, is named backwards because it works as |
@Oberon00 sorry for resolving that, my github did not get updated so I did not see the comment. If that happens again consider to press "Unresolve conversation" instead of duplicating the comment. Thanks and sorry for closing that with your comment. |
@yurishkuro are you ok with the proposed name? We can later add |
Hi @bogdandrutu, no problem, I already assumed that's what happened. 😃 But as I have no write-access and also did not create the PR, I cannot (un)resolve anything. |
Signed-off-by: Bogdan Drutu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the RootOnly name, LGTM
Signed-off-by: Bogdan Drutu <[email protected]>
The CI failure for the link https://marc.info/?l=apache-cvs&m=130928191414740 is transient, the problem is that the link takes a lot of time to load (probably something on their server side, I expect they need opentelemetry :) ). |
|
||
#### Probability | ||
|
||
* The default behavior should be to trust the parent `SampledFlag`. However |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the "always" behavior instead of trusting parent, to be consistent? If trusting parent is needed, use Sampers.parentOrElse(Samplers.probabilistic(r))
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you have added TODO, so will be in the separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
Signed-off-by: Bogdan Drutu <[email protected]>
* Changes AlwaysParentSample to ParentSample(fallback) To match https://github.com/open-telemetry/opentelemetry-specification/blob/v0.5.0/specification/trace/sdk.md#parentorelse introduced in open-telemetry/opentelemetry-specification#609 * Fix lint
* Changes AlwaysParentSample to ParentSample(fallback) To match https://github.com/open-telemetry/opentelemetry-specification/blob/v0.5.0/specification/trace/sdk.md#parentorelse introduced in open-telemetry/opentelemetry-specification#609 * Fix lint
…emetry#609) * Split ALWAYS_PARENT based on default behavior if no parent Signed-off-by: Bogdan Drutu <[email protected]> * Rename RootOnly to ParentOrElse Signed-off-by: Bogdan Drutu <[email protected]> * Address feedback Signed-off-by: Bogdan Drutu <[email protected]> * More feedback Signed-off-by: Bogdan Drutu <[email protected]>
Fixes #492