Package com.tnsai.quality.sampling
Interface EventSamplingPolicy
- All Known Implementing Classes:
AdaptiveSamplingPolicy,AlwaysCapturePolicy,ErrorAlwaysPolicy,HeadBasedSamplingPolicy,PriorityBasedSamplingPolicy,RuleBasedSamplingPolicy,TenantPolicySamplingPolicy
public interface EventSamplingPolicy
SPI for deciding whether to capture an event (issue #82).
Policies are pure functions of SamplingInput — no I/O, no
mutable state. A single instance is shared across the framework and
MUST be safe to call concurrently from any number of publisher threads.
Default implementations shipped in this package:
AlwaysCapturePolicy— capture everything; the dev / single-tenant default.HeadBasedSamplingPolicy— coin-flip per event at a fixed rate; the simplest production policy.PriorityBasedSamplingPolicy— level-aware: ERROR / CRITICAL always, INFO / DEBUG sampled.
Heavier policies (tail-based per-session, adaptive backpressure- driven, YAML-rule-driven) are out of scope for the foundation slice and land in follow-up PRs.
- Since:
- 0.5.0 (issue #82)
-
Method Summary
Modifier and TypeMethodDescriptionsample(SamplingInput input) Inspect an event's metadata and return whether to capture, drop, or capture-with-downsampling marker.
-
Method Details
-
sample
Inspect an event's metadata and return whether to capture, drop, or capture-with-downsampling marker.
-