public class SamplingMeasurementSink extends Object implements StepMeasurementSink
A StepMeasurementSink
which collects only a particular fraction of
events (e.g. for performance or log-space-saving reasons). A record is kept
of what fraction of 'candidate' StepMeasurements have already been passed to
the delegate; an incoming event will be passed through if and only if to
ignore it would take that fraction below the desired sampling fraction
specified at construction time.
Note that this class makes a slight sacrifice of accuracy for performance; interleaving during increment of the internal counters may mean that very slightly more or fewer events than the desired fraction end up being captured in the long term.
Note also that this class will only pass on 'top-level' events (depth = 0).
Constructor and Description |
---|
SamplingMeasurementSink(StepMeasurementSink delegate,
float samplingFraction) |
public SamplingMeasurementSink(StepMeasurementSink delegate, float samplingFraction)
public void handle(StepMeasurements measurements, int level)
handle
in interface StepMeasurementSink
Copyright © 2009–2019 Performance Co-Pilot. All rights reserved.