promclient

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeLabelSets added in v0.0.31

func MergeLabelSets(a, b []model.LabelSet) []model.LabelSet

func MergeLabelValues added in v0.0.18

func MergeLabelValues(a, b []model.LabelValue) []model.LabelValue

func NormalizePromError added in v0.0.31

func NormalizePromError(err error) error

NormalizePromError converts the errors that the prometheus API client returns into errors that the prometheus API server actually handles and returns proper error codes for

Types

type API added in v0.0.31

type API interface {
	// LabelValues performs a query for the values of the given label.
	LabelValues(ctx context.Context, label string) (model.LabelValues, error)
	// Query performs a query for the given time.
	Query(ctx context.Context, query string, ts time.Time) (model.Value, error)
	// QueryRange performs a query for the given range.
	QueryRange(ctx context.Context, query string, r v1.Range) (model.Value, error)
	// Series finds series by label matchers.
	Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, error)
}

API Subset of the interface defined in the prometheus client

type DataResult

type DataResult struct {
	Status    promhttputil.Status    `json:"status"`
	Data      promhttputil.QueryData `json:"data"`
	ErrorType promhttputil.ErrorType `json:"errorType,omitempty"`
	Error     string                 `json:"error,omitempty"`
}

func (*DataResult) UnmarshalEasyJSON

func (out *DataResult) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DataResult) UnmarshalJSON

func (v *DataResult) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type MultiAPI added in v0.0.31

type MultiAPI struct {
	// contains filtered or unexported fields
}

MultiAPI implements the API interface while merging the results from the apis it wraps

func NewMultiAPI added in v0.0.31

func NewMultiAPI(apis []API, antiAffinity model.Time, metricFunc MultiAPIMetricFunc) *MultiAPI

NewMultiAPI returns a MultiAPI

func (*MultiAPI) LabelValues added in v0.0.31

func (m *MultiAPI) LabelValues(ctx context.Context, label string) (model.LabelValues, error)

LabelValues performs a query for the values of the given label.

func (*MultiAPI) Query added in v0.0.31

func (m *MultiAPI) Query(ctx context.Context, query string, ts time.Time) (model.Value, error)

Query performs a query for the given time.

func (*MultiAPI) QueryRange added in v0.0.31

func (m *MultiAPI) QueryRange(ctx context.Context, query string, r v1.Range) (model.Value, error)

QueryRange performs a query for the given range.

func (*MultiAPI) Series added in v0.0.31

func (m *MultiAPI) Series(ctx context.Context, matches []string, startTime time.Time, endTime time.Time) ([]model.LabelSet, error)

Series finds series by label matchers.

type MultiAPIMetricFunc added in v0.0.31

type MultiAPIMetricFunc func(i int, api, status string, took float64)

MultiAPIMetricFunc defines a method where a client can record metrics about the specific API calls made through this multi client

type SeriesIterator

type SeriesIterator struct {
	V interface{}
	// contains filtered or unexported fields
}

func IteratorsForValue

func IteratorsForValue(v model.Value) []*SeriesIterator

func NewSeriesIterator

func NewSeriesIterator(v interface{}) *SeriesIterator

NewSeriesIterator return a series iterator for the given value TODO: error return if the type is incorrect?

func (*SeriesIterator) At added in v0.0.2

func (s *SeriesIterator) At() (t int64, v float64)

At returns the current timestamp/value pair.

func (*SeriesIterator) Err added in v0.0.2

func (s *SeriesIterator) Err() error

Err returns the current error.

func (*SeriesIterator) Labels added in v0.0.2

func (s *SeriesIterator) Labels() labels.Labels

Returns the metric of the series that the iterator corresponds to.

func (*SeriesIterator) Next added in v0.0.2

func (s *SeriesIterator) Next() bool

Next advances the iterator by one.

func (*SeriesIterator) Seek added in v0.0.2

func (s *SeriesIterator) Seek(t int64) bool

Seek advances the iterator forward to the value at or after the given timestamp.

Jump to

Keyboard shortcuts

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