Documentation ¶
Index ¶
- Constants
- func MatcherToString(matchers []*labels.Matcher) (string, error)
- func MergeSampleStream(antiAffinityBuffer model.Time, a, b *model.SampleStream) (*model.SampleStream, error)
- func MergeValues(antiAffinityBuffer model.Time, a, b model.Value) (model.Value, error)
- func ParseDuration(s string) (time.Duration, error)
- func ParseTime(s string) (model.Time, error)
- func ValueAddLabelSet(a model.Value, l model.LabelSet) error
- type ErrorType
- type QueryData
- type Status
Constants ¶
const ( ErrorNone ErrorType = "" ErrorTimeout = "timeout" ErrorCanceled = "canceled" ErrorExec = "execution" ErrorBadData = "bad_data" ErrorInternal = "internal" )
Variables ¶
This section is empty.
Functions ¶
func MatcherToString ¶ added in v0.0.2
convert list of labelMatchers to a promql string 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 ¶
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
Types ¶
type QueryData ¶
type QueryData struct { ResultType model.ValueType `json:"resultType"` Result model.Value `json:"result"` }
func (*QueryData) UnmarshalEasyJSON ¶
UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (*QueryData) UnmarshalJSON ¶
UnmarshalJSON supports json.Unmarshaler interface
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 = "error" )