Package com.tnsai.quality.sampling
Class PriorityBasedSamplingPolicy
java.lang.Object
com.tnsai.quality.sampling.PriorityBasedSamplingPolicy
- All Implemented Interfaces:
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.1EventLevel.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 Summary
ConstructorsConstructorDescriptionPriorityBasedSamplingPolicy(Map<com.tnsai.observability.events.EventLevel, Double> rates) -
Method Summary
Modifier and TypeMethodDescriptionsample(SamplingInput input) Inspect an event's metadata and return whether to capture, drop, or capture-with-downsampling marker.static PriorityBasedSamplingPolicyConvenience: policy with the documented default rates per level.
-
Constructor Details
-
PriorityBasedSamplingPolicy
-
-
Method Details
-
withDefaults
Convenience: policy with the documented default rates per level. -
sample
Description copied from interface:EventSamplingPolicyInspect an event's metadata and return whether to capture, drop, or capture-with-downsampling marker.- Specified by:
samplein interfaceEventSamplingPolicy
-