prometheus

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: Apache-2.0 Imports: 22 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterSeriesByOptions added in v0.15.0

func FilterSeriesByOptions(
	series []*ts.Series,
	opts *storage.FetchOptions,
) []*ts.Series

FilterSeriesByOptions removes series tags based on options.

func ParseSeriesMatchQuery added in v0.5.0

func ParseSeriesMatchQuery(
	r *http.Request,
	parseOpts xpromql.ParseOptions,
	tagOptions models.TagOptions,
) ([]*storage.FetchQuery, error)

ParseSeriesMatchQuery parses all params from the GET request.

func ParseStartAndEnd added in v1.0.1

func ParseStartAndEnd(
	r *http.Request,
	parseOpts xpromql.ParseOptions,
) (time.Time, time.Time, error)

ParseStartAndEnd parses start and end params from the request.

func ParseTime added in v1.2.0

func ParseTime(r *http.Request, key string, now time.Time) (time.Time, error)

ParseTime parses a time out of a request key, with a default value.

func SetDefaultStartEndParamsForInstant added in v1.2.0

func SetDefaultStartEndParamsForInstant(r *http.Request)

SetDefaultStartEndParamsForInstant sets the start and end values for instant queries. Instant queries don't specify start and end, but these params are required to be set to be successfully processed by storage.

Types

type MatchInformation added in v0.15.0

type MatchInformation struct {
	// FullMatch indicates a full match.
	FullMatch bool
	// NoMatch indicates that the responses do not match sufficiently.
	NoMatch bool
}

MatchInformation describes how well two responses match.

type MatrixResult added in v0.15.3

type MatrixResult struct {
	Result []matrixRow `json:"result"`
}

MatrixResult contains a list matrixRow.

func (MatrixResult) Len added in v0.15.3

func (r MatrixResult) Len() int

Len is the number of elements in the collection.

func (MatrixResult) Less added in v0.15.3

func (r MatrixResult) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (MatrixResult) Sort added in v0.15.3

func (r MatrixResult) Sort()

Sort sorts the MatrixResult.

func (MatrixResult) Swap added in v0.15.3

func (r MatrixResult) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type ParsePromCompressedRequestResult added in v0.13.0

type ParsePromCompressedRequestResult struct {
	CompressedBody   []byte
	UncompressedBody []byte
}

ParsePromCompressedRequestResult is the result of a ParsePromCompressedRequest call.

func ParsePromCompressedRequest

func ParsePromCompressedRequest(
	r *http.Request,
) (ParsePromCompressedRequestResult, error)

ParsePromCompressedRequest parses a snappy compressed request from Prometheus.

type ParsedMatch added in v1.2.0

type ParsedMatch struct {
	Match    string
	Matchers models.Matchers
}

ParsedMatch is a parsed matched.

func ParseMatch added in v1.2.0

func ParseMatch(
	r *http.Request,
	parseOpts xpromql.ParseOptions,
	tagOptions models.TagOptions,
) ([]ParsedMatch, bool, error)

ParseMatch parses all match params from the GET request.

type RenderSeriesMetadataOptions added in v1.2.0

type RenderSeriesMetadataOptions struct {
	ReturnedSeriesMetadataLimit int
}

RenderSeriesMetadataOptions is a set of options for rendering series metadata.

type RenderSeriesMetadataResult added in v1.2.0

type RenderSeriesMetadataResult struct {
	// Results is how many results were rendered.
	Results int
	// TotalResults is how many results in total there were regardless
	// of rendering.
	TotalResults int
	// LimitedMaxReturnedData indicates if results rendering
	// was truncated by a limit.
	LimitedMaxReturnedData bool
}

RenderSeriesMetadataResult returns results about a series metadata rendering.

func RenderListTagResultsJSON added in v0.9.0

RenderListTagResultsJSON renders list tag results to json format.

func RenderSeriesMatchResultsJSON added in v0.5.0

func RenderSeriesMatchResultsJSON(
	w io.Writer,
	results []models.Metrics,
	opts RenderSeriesMetadataOptions,
) (RenderSeriesMetadataResult, error)

RenderSeriesMatchResultsJSON renders series match results to json format.

func RenderTagCompletionResultsJSON added in v0.5.0

func RenderTagCompletionResultsJSON(
	w io.Writer,
	result consolidators.CompleteTagsResult,
	opts RenderSeriesMetadataOptions,
) (RenderSeriesMetadataResult, error)

RenderTagCompletionResultsJSON renders tag completion results to json format.

func RenderTagValuesResultsJSON added in v0.5.0

RenderTagValuesResultsJSON renders tag values results to json format.

type Response added in v0.15.0

type Response struct {
	// Status is the response status.
	Status string `json:"status"`
	// Data is the response data.
	Data data `json:"data"`
}

Response represents Prometheus's query response.

func (Response) Matches added in v0.15.0

func (r Response) Matches(other Response) (MatchInformation, error)

Matches compares two responses and determines how closely they match.

type ScalarResult added in v0.15.3

type ScalarResult struct {
	Result Value `json:"result"`
}

ScalarResult is the scalar Value for the response.

type StringResult added in v0.15.3

type StringResult struct {
	Result Value `json:"result"`
}

StringResult is the string Value for the response.

type TagCompletionQueries added in v0.15.0

type TagCompletionQueries struct {
	// Queries are the tag completion queries.
	Queries []*storage.CompleteTagsQuery
	// NameOnly indicates name only
	NameOnly bool
}

TagCompletionQueries are tag completion queries.

func ParseTagCompletionParamsToQueries added in v0.15.0

func ParseTagCompletionParamsToQueries(
	r *http.Request,
) (TagCompletionQueries, error)

ParseTagCompletionParamsToQueries parses all params from the GET request. Returns queries, a boolean indicating if the query completes names only, and any errors.

type Tags added in v0.15.0

type Tags map[string]string

Tags is a simple representation of Prometheus tags.

type TimeParams added in v1.2.0

type TimeParams struct {
	Now   time.Time
	Start time.Time
	End   time.Time
}

TimeParams represents the time parameters within a request.

func ParseTimeParams added in v1.2.0

func ParseTimeParams(r *http.Request) (TimeParams, error)

ParseTimeParams parses the time params (now, start, end) from a request.

type Value added in v0.15.0

type Value []interface{}

Value is a single value for Prometheus Result.

type Values added in v0.15.0

type Values []Value

Values is a list of values for the Prometheus Result.

type VectorResult added in v0.15.3

type VectorResult struct {
	Result []vectorItem `json:"result"`
}

VectorResult contains a list of vectorItem.

func (VectorResult) Len added in v0.15.3

func (r VectorResult) Len() int

Len is the number of elements in the vector.

func (VectorResult) Less added in v0.15.3

func (r VectorResult) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (VectorResult) Sort added in v0.15.3

func (r VectorResult) Sort()

Sort sorts the VectorResult.

func (VectorResult) Swap added in v0.15.3

func (r VectorResult) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Directories

Path Synopsis
Package native handles the prometheus api endpoints using m3.
Package native handles the prometheus api endpoints using m3.

Jump to

Keyboard shortcuts

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