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

Added Begin segment with sampling #196

Merged
merged 3 commits into from
Aug 23, 2020

Conversation

willarmiros
Copy link
Contributor

Issue #, if available:
#74

Description of changes:
Added an API to begin a segment and apply the recorder's sampling strategy to it. In the future, this API will be deprecated and this will be the default behavior of beginSegment. Tested on my sample app with centralized sampling.

Also improved debug logging within the centralized sampling module, and added a fast-fail to the endSegment to make sure we don't emit weird logs when ending a no-op segment.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

statistics.incBorrowed();
res.setSampled(true);

return res;
}

logger.debug("Sampling target has expired for rule " + getName() + ". Using fixed rate.");
if (logger.isDebugEnabled()) {
logger.debug(String.format("Sampling target has expired for rule %s. Using fixed rate of %d percent.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Think we should stick to concatenation, it's only when debug logs are enabled but still not worth taking the String.format hit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, will update.

@willarmiros willarmiros changed the title Begin segment sample Added Begin segment with sampling Aug 23, 2020
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.

None yet

2 participants