Skip to content
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

[processor/tailsampling] Fix SpanCount sampler not using the correct span count for decision #13386

Merged

Conversation

Symbianx
Copy link
Contributor

@Symbianx Symbianx commented Aug 16, 2022

Fixes #13865
Description:
There is a bug with the SpanCount sampler. If spans are put in different batches, it may make a wrong decision.

e.g.
With SpanCount minSpans set to 2; if 2 spans of the same trace are put into different batches, the trace will not be sampled.

@Symbianx Symbianx requested a review from a team August 16, 2022 16:59
@Symbianx Symbianx requested a review from jpkrohling as a code owner August 16, 2022 16:59
@Symbianx Symbianx changed the title Fixes SpanCount sampler not using the correct count for decision Fixes SpanCount sampler not using the correct span count for decision Aug 16, 2022
Signed-off-by: Miguel Alexandre <[email protected]>
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Aug 31, 2022
@Symbianx
Copy link
Contributor Author

@dmitryax can you approve the the running workflows and take a look at the PR? Thank you!

@jpkrohling jpkrohling assigned jpkrohling and unassigned dmitryax Aug 31, 2022
@github-actions github-actions bot removed the Stale label Sep 1, 2022
if trace.SpanCount() >= int(c.minSpans) {
return Sampled, nil
}
if int(traceData.SpanCount.Load()) >= int(c.minSpans) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add a new test, to demonstrate the problem and ensure we don't have a regression in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like 1 of the tests was already covering this but with the incorrect expected outcome. Fixed it and should now cover this logic.

@jpkrohling
Copy link
Member

Is there a GitHub issue tracking this?

@jpkrohling jpkrohling changed the title Fixes SpanCount sampler not using the correct span count for decision [processor/tailsampling] Fix SpanCount sampler not using the correct span count for decision Sep 2, 2022
@Symbianx
Copy link
Contributor Author

Symbianx commented Sep 5, 2022

@jpkrohling there wasn't but I created #13865 to track it and updated the changelog

@Symbianx Symbianx force-pushed the fix-span-count-incorrect-tracking branch from d4dace5 to ad2f932 Compare September 5, 2022 08:14
Signed-off-by: Miguel Alexandre <[email protected]>
@Symbianx Symbianx force-pushed the fix-span-count-incorrect-tracking branch from ad2f932 to 28e4096 Compare September 5, 2022 08:16
@jpkrohling
Copy link
Member

An issue isn't strictly required, although bug reports usually start with an issue. I'll review this soon.

[]int32{
1, 1, 1,
},
Sampled,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, this was not sampled. This was the bug, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's right

@jpkrohling jpkrohling merged commit 7adcabf into open-telemetry:main Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[processor/tailsampling] SpanCount sampler makes incorrect decision on high volume of spans
3 participants