Skip to main content

Module decode_limits

Module decode_limits 

Source
Expand description

Bounded decoding of chunk payloads.

A chunk payload declares how many buckets and samples it contains. Those numbers come straight from the file, so a corrupt or hostile chunk could otherwise make the decoder allocate hundreds of megabytes for a 100-byte record. DecodeLimits caps the four things a payload controls:

LimitWhat it bounds
max_bucketspositive + negative buckets of one histogram
max_spansspan entries of one histogram layout
max_custom_valuescustom bucket bounds
max_samplessamples in one chunk

The defaults are generous enough for anything Prometheus writes (a chunk holds at most 120 samples and at most a few thousand buckets) and small enough that a hostile payload fails immediately instead of exhausting memory.

Structsยง

DecodeLimits
Caps applied while decoding one chunk.