improved ForcedSampling support - #232
Conversation
| return segment; | ||
| } else if (this.getSamplingStrategy().isForcedSamplingSupported()) { | ||
| Segment segment = beginSegment(name); | ||
| segment.setSampled(false); |
There was a problem hiding this comment.
From what I understand of ForcedSampling is that it can be used to force sample a segment which is un-sampled when created. Or is it only to keep the segment in context even though it is un-sampled?
There was a problem hiding this comment.
Forced sampling forces the creation of a regular instead of no-op segment when not sampled, which also places it in context. Then forceSamplingOfCurrentSegment can be used in conjunction to actually switch an unsampled segment to sampled.
| @@ -149,7 +155,6 @@ private synchronized void startPoller() { | |||
| @Override | |||
| public boolean isForcedSamplingSupported() { | |||
| //TODO address this | |||
There was a problem hiding this comment.
This is addressed now right? :)
There was a problem hiding this comment.
Fair enough haha
anuraaga
left a comment
There was a problem hiding this comment.
I think the constructor parameters are OK - the builder seems nice if we were to also hide the classes, but that would be breaking, so maybe a future cleanup
Issue #, if available:
#230
Description of changes:
Adds check for
ForcedSamplingSupporttobeginSegmentWithSampling. Also makesForcedSamplinga configurable property for the existingCentralizedandLocalizedsampling strategies via new constructors. I did not add them to theAllorNostrategies since forced sampling doesn't make sense in either case, they should be all or nothing, respectively.I used constructor parameters to keep the new field
final. One alternative would be to implement builder classes for the strategies (4 new builder classes seems overkill tho) or just one sampling strategy builder that works like:Thoughts @anuraaga ?
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.