Class TraceSampler.RateLimitedSampler
java.lang.Object
com.loomcache.server.tracing.TraceSampler.RateLimitedSampler
- All Implemented Interfaces:
TraceSampler
- Enclosing interface:
TraceSampler
Rate-limited sampler (N spans per second).
- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface TraceSampler
TraceSampler.AlwaysSampler, TraceSampler.NeverSampler, TraceSampler.ProbabilisticSampler, TraceSampler.RateLimitedSampler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongGet the number of samples taken.booleanshouldSample(String traceId, String spanName) Determine if a span should be sampled.
-
Constructor Details
-
RateLimitedSampler
public RateLimitedSampler(int samplesPerSecond) Create a rate-limited sampler.- Parameters:
samplesPerSecond- maximum samples per second
-
-
Method Details
-
shouldSample
Description copied from interface:TraceSamplerDetermine if a span should be sampled.- Specified by:
shouldSamplein interfaceTraceSampler- Parameters:
traceId- the trace IDspanName- the span name- Returns:
- true if the span should be sampled
-
getSampleCount
public long getSampleCount()Get the number of samples taken.
-