pub struct ContextSourceConfig {
pub datagram_byte_limit: usize,
pub metric_contexts: usize,
pub event_contexts: usize,
pub service_check_contexts: usize,
}Expand description
The per-kind caps a timeline’s shared context pool fills to before it recurs existing contexts.
first_sample_config samples this beside datadog.yaml so cardinality varies per timeline. Each
cap is drawn against the budget the earlier draws left, so a kind’s cardinality still varies at
random while the three together stay under MAX_CONTEXTS_TOTAL.
Fields§
§datagram_byte_limit: usizeBytes a rendered line of any pooled context must fit, this timeline’s real datagram budget
rather than the protocol ceiling. Mint builds identities against it, so every served context
has a rendering the driver can pack. Defaults to the sampled datagram_byte_limit, which is the
smaller of the SUT’s receive buffer and DATAGRAM_BYTE_LIMIT.
metric_contexts: usizeDistinct metric contexts the pool holds before it recurs the ones it has.
Sampled in 2..=MAX_CONTEXTS_TOTAL minus what the other kinds took. A larger cap explores more
identities and puts fewer points in each, and costs memory: the pool retains every context it
mints for the life of the run. Two is the floor because the pool holds one context carrying an
invalid UTF-8 byte per kind alongside the rest, and a kind capped at one could hold only one of
the two.
event_contexts: usizeDistinct event contexts the pool holds. Same range and trade as Self::metric_contexts.
service_check_contexts: usizeDistinct service-check contexts the pool holds. Same range and trade as
Self::metric_contexts.
Implementations§
Source§impl ContextSourceConfig
impl ContextSourceConfig
Sourcepub fn sample<R: Rng + ?Sized>(rng: &mut R, datagram_byte_limit: usize) -> Self
pub fn sample<R: Rng + ?Sized>(rng: &mut R, datagram_byte_limit: usize) -> Self
Sample the per-kind caps, each boundary-biased log-uniform against the budget still free.
The draws run in order and each spends from one shared ceiling, so the total is bounded by construction rather than by scaling three independent draws afterwards. Every kind keeps at least two contexts, one of which carries an invalid UTF-8 byte.
Sourcepub fn read(config_dir: &Path) -> Result<Self>
pub fn read(config_dir: &Path) -> Result<Self>
Read the context-source config from the context_source.yaml that first_sample_config wrote
to config_dir.
§Errors
Returns an error if the config is unreadable, is not valid YAML, or caps a kind below two. The
pool seeds every kind with one context carrying an invalid UTF-8 byte and one without, so a cap of
one cannot hold both and the pool would exceed its own cap assertion. Self::sample never draws
below two, and this rejects a config that reached the pool by another route rather than letting it
redden a run.
Trait Implementations§
Source§impl Clone for ContextSourceConfig
impl Clone for ContextSourceConfig
Source§fn clone(&self) -> ContextSourceConfig
fn clone(&self) -> ContextSourceConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more