Documentation
¶
Overview ¶
Package sampler implements per-kind sampling and post-bus filtering for the agent.
The bus's own Filter narrows by EventKind and NodeID — coarse-grained, fast. The Sampler refines this with two further dimensions the bus deliberately does not know about:
- Per-kind sampling rate (0.0–1.0). The admin server may say "ship 10 % of SQL events but 100 % of HTTP" because SQL volume can overwhelm the channel during normal load.
- HTTP-specific filters (path glob, method, status class) and SQL- specific filters (model name) that the bus is intentionally agnostic about. Forwarding these to the bus would couple it to wire concepts it does not own.
Sampler is goroutine-safe; the rate map and the filter are read on every event. Rates and filters can be updated atomically via Update.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sampler ¶
type Sampler struct {
// contains filtered or unexported fields
}
Sampler groups one filter and its sampling rates, behind an RWMutex so the server-driven Subscribe can update it without tearing.
func New ¶
New constructs a Sampler with the given starting filter and rate map. Pass nil filter for "no constraint" and nil rates for "100 % all kinds".