prometheus

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ClientInterface
	// contains filtered or unexported fields
}

Client for Prometheus API. It hides the way we query Prometheus offering a layer with a high level defined API.

func NewClient

func NewClient(cfg extconfig.PrometheusConfig) (*Client, error)

NewClient creates a new client to the Prometheus API. It returns an error on any problem.

func (*Client) FetchHistogramRange

func (in *Client) FetchHistogramRange(metricName, labels, grouping string, q *MetricsQuery) Histogram

FetchHistogramRange fetches bucketed metric as histogram in given range

func (*Client) FetchRange

func (in *Client) FetchRange(metricName, labels, grouping, aggregator string, q *MetricsQuery) Metric

FetchRange fetches a simple metric (gauge or counter) in given range

func (*Client) FetchRateRange

func (in *Client) FetchRateRange(metricName, labels, grouping string, q *MetricsQuery) Metric

FetchRateRange fetches a counter's rate in given range

func (*Client) GetMetricsForLabels

func (in *Client) GetMetricsForLabels(labels []string) ([]string, error)

GetMetricsForLabels returns a list of metrics existing for the provided labels set

type ClientInterface

type ClientInterface interface {
	FetchHistogramRange(metricName, labels, grouping string, q *MetricsQuery) Histogram
	FetchRange(metricName, labels, grouping, aggregator string, q *MetricsQuery) Metric
	FetchRateRange(metricName, labels, grouping string, q *MetricsQuery) Metric
	GetMetricsForLabels(labels []string) ([]string, error)
}

type Histogram

type Histogram = map[string]Metric

Histogram contains Metric objects for several histogram-kind statistics

type Metric

type Metric struct {
	Matrix model.Matrix `json:"matrix"`
	Err    error
}

Metric holds the Prometheus Matrix model, which contains one or more time series (depending on grouping)

type Metrics

type Metrics struct {
	Metrics    map[string]*Metric   `json:"metrics"`
	Histograms map[string]Histogram `json:"histograms"`
}

Metrics contains all simple metrics and histograms data

type MetricsQuery

type MetricsQuery struct {
	v1.Range
	RateInterval string
	RateFunc     string
	Quantiles    []string
	Avg          bool
	ByLabels     []string
}

MetricsQuery holds common parameters for all kinds of queries

func (*MetricsQuery) FillDefaults

func (q *MetricsQuery) FillDefaults()

FillDefaults fills the struct with default parameters

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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