Class TraceSampler.RateLimitedSampler

java.lang.Object
com.loomcache.server.tracing.TraceSampler.RateLimitedSampler
All Implemented Interfaces:
TraceSampler
Enclosing interface:
TraceSampler

public static class TraceSampler.RateLimitedSampler extends Object implements TraceSampler
Rate-limited sampler (N spans per second).
Since:
1.0
  • Constructor Details

    • RateLimitedSampler

      public RateLimitedSampler(int samplesPerSecond)
      Create a rate-limited sampler.
      Parameters:
      samplesPerSecond - maximum samples per second
  • Method Details

    • shouldSample

      public boolean shouldSample(String traceId, String spanName)
      Description copied from interface: TraceSampler
      Determine if a span should be sampled.
      Specified by:
      shouldSample in interface TraceSampler
      Parameters:
      traceId - the trace ID
      spanName - the span name
      Returns:
      true if the span should be sampled
    • getSampleCount

      public long getSampleCount()
      Get the number of samples taken.