Class PriorityBasedSamplingPolicy

java.lang.Object
com.tnsai.quality.sampling.PriorityBasedSamplingPolicy
All Implemented Interfaces:
EventSamplingPolicy

public final class PriorityBasedSamplingPolicy extends Object implements EventSamplingPolicy
Level-aware sampling policy (issue #82). Each EventLevel has its own sampling rate, defaulting to:
  • EventLevel.CRITICAL → 1.0 (always)
  • EventLevel.ERROR → 1.0 (always)
  • EventLevel.WARN → 1.0 (always)
  • EventLevel.INFO → 0.1
  • EventLevel.DEBUG → 0.01

The default rates encode the production observability rule of thumb: never drop anything that's already a problem (WARN+), heavily down-sample chatty informational events. Operators override per level when their volume profile differs.

Captured events at rate < 1.0 surface as SamplingDecision.CaptureDownsampled so aggregators report extrapolated counts.

Since:
0.5.0 (issue #82)
  • Constructor Details

    • PriorityBasedSamplingPolicy

      public PriorityBasedSamplingPolicy(Map<com.tnsai.observability.events.EventLevel,Double> rates)
  • Method Details