promhttputil

package
v0.0.59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2020 License: MIT Imports: 7 Imported by: 0

README

Rename to promutil?

This is a collection of a bunch of prometheus util methods etc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatcherToString

func MatcherToString(matchers []*labels.Matcher) (string, error)

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, a, b *model.SampleStream) (*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 some problems with clock skew (from a variety of sources). The primary one I've run into is issues with the time that prometheus stores. Since the time associated with the datapoint is the *start* time of the scrape, there can be quite a lot of time (which can vary dramatically between hosts) for the exporter to return. In an attempt to mitigate this problem we're going to *not* merge any datapoint within antiAffinityBuffer of another point we have. This means we can tolerate antiAffinityBuffer/2 on either side (which can be used by either clock skew or from this scrape skew).

func MergeValues

func MergeValues(antiAffinityBuffer model.Time, a, b model.Value) (model.Value, error)

MergeValues merges values `a` and `b` with the given antiAffinityBuffer TODO: always make copies? Now we sometimes return one, or make a copy, or do nothing

func ValueAddLabelSet

func ValueAddLabelSet(a model.Value, l model.LabelSet) error

ValueAddLabelSet adds the labelset `l` to the value `a`

func WarningsConvert

func WarningsConvert(ws api.Warnings) storage.Warnings

WarningsConvert simply converts api.Warnings to storage.Warnings

Types

type ErrorType

type ErrorType string
const (
	ErrorNone     ErrorType = ""
	ErrorTimeout  ErrorType = "timeout"
	ErrorCanceled ErrorType = "canceled"
	ErrorExec     ErrorType = "execution"
	ErrorBadData  ErrorType = "bad_data"
	ErrorInternal ErrorType = "internal"
)

type Status

type Status string

TODO: have the api.go thing export these attempted once already -- https://github.com/prometheus/prometheus/pull/3615

const (
	StatusSuccess Status = "success"
	StatusError   Status = "error"
)

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 api.Warnings)

AddWarnings will add all warnings to the set

func (WarningSet) Warnings

func (s WarningSet) Warnings() api.Warnings

Warnings returns all of the warnings contained in the set

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL