Documentation
¶
Index ¶
- func MatcherToString(matchers []*labels.Matcher) (string, error)
- func MergeSampleStream(antiAffinityBuffer model.Time, dynamic bool, a, b *model.SampleStream, ...) (*model.SampleStream, error)
- func MergeValues(antiAffinityBuffer model.Time, dynamic bool, a, b model.Value, preferMax bool) (model.Value, error)
- func ValueAddLabelSet(a model.Value, l model.LabelSet) error
- func WarningsConvert(ws v1.Warnings) annotations.Annotations
- type ErrorType
- type Status
- type WarningSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatcherToString ¶
MatcherToString converts a []*labels.Matcher into the actual matcher you would see on the wire (such as `metricname{label="value"}`)
func MergeSampleStream ¶
func MergeSampleStream(antiAffinityBuffer model.Time, dynamic bool, a, b *model.SampleStream, preferMax bool) (*model.SampleStream, error)
MergeSampleStream merges SampleStreams `a` and `b` with the given antiAffinityBuffer. When combining series from 2 different prometheus hosts we can run into clock-skew / scrape-skew issues (the timestamp prometheus stores is the *start* of the scrape, and exporter response time varies); refusing to merge any datapoint within antiAffinityBuffer of another lets us tolerate antiAffinityBuffer/2 on either side.
When dynamic is true the buffer is recomputed per series from the inter-sample spacing of the longer side: half the median gap, modelling "scrape interval / 2" without forcing operators to know the interval up front. antiAffinityBuffer is the floor / fallback when there are too few samples to estimate (< 3 gaps). See #734.
func MergeValues ¶
func MergeValues(antiAffinityBuffer model.Time, dynamic bool, a, b model.Value, preferMax bool) (model.Value, error)
MergeValues merges values `a` and `b` with the given antiAffinityBuffer. When dynamic is true, each merged SampleStream infers its own anti- affinity from the inter-sample spacing of the longer series and uses antiAffinityBuffer only as a fallback when there isn't enough data to estimate. See #734.
func ValueAddLabelSet ¶
ValueAddLabelSet adds the labelset `l` to the value `a`
func WarningsConvert ¶
func WarningsConvert(ws v1.Warnings) annotations.Annotations
WarningsConvert converts v1.Warnings (the JSON-decoded plain-string form of an annotation set) to an annotations.Annotations, preserving the info-vs-warning classification when the original prefix is present.
Types ¶
type Status ¶
type Status string
These really should be exported from the prom packages. This was attempted once already -- https://github.com/prometheus/prometheus/pull/3615
type WarningSet ¶
type WarningSet map[string]struct{}
WarningSet simply contains a set of warnings
func (WarningSet) AddWarning ¶
func (s WarningSet) AddWarning(w string)
AddWarning will add a given warning to the set
func (WarningSet) AddWarnings ¶
func (s WarningSet) AddWarnings(ws v1.Warnings)
AddWarnings will add all warnings to the set
func (WarningSet) Warnings ¶
func (s WarningSet) Warnings() v1.Warnings
Warnings returns all of the warnings contained in the set