Module contexts

Module contexts 

Source
Expand description

The context protocol: reusable DogStatsD identities a driver renders load against.

A Context is a per-type stable identity — a metric’s (kind, name, tags), an event’s title + tags + option fields, a service check’s name + tags + host. It is minted over the content alphabet in payload/dogstatsd/common.rs and accepted only when a probe render is !is_malformed, see crate::dogstatsd, conforming to the Agent parser and nothing stricter. The driver varies the per-occurrence payload each render, the value, text, status, extensions and timestamp, so a pooled identity recurs while its load varies.

Context::mint_non_utf8_within mints an identity carrying an invalid UTF-8 byte in its name or a tag. That is the only source of such a byte in generated load, and it lives in the identity so the pool counts it against a cap. Poisoning a rendered datagram instead would invent an identity the pool never issued, one per datagram, which is how bounded cardinality leaks.

A shared intake pool mints identities up to a per-kind cap then recurs them, and serves them to drivers over the length-prefixed binary codec here (encode_response / decode_response), which carries non-UTF-8 names and tags that JSON could not.

Modules§

event
Event contexts: the stable _e{} identity a driver renders text and timestamps against.
metric
Metric contexts: the (kind, name, tags) identity a driver renders values against.
service_check
Service-check contexts: the stable _sc identity a driver renders status, message, and timestamp against.

Enums§

Context
A reusable DogStatsD identity of one of the three kinds.
Kind
The three context kinds.

Functions§

decode_response
Decode a GET /contexts response body. Returns None on any truncation or malformed field, so a partial or corrupt body is an error, not a panic. Never pre-sizes from the wire count.
encode_response
Encode a GET /contexts response body: a u32 count then each context.