prometheus

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: GPL-3.0 Imports: 14 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetaEntry added in v0.20.0

type MetaEntry struct {
	Help string
	Type textparse.MetricType
}

type Metadata added in v0.20.0

type Metadata map[string]*MetaEntry

func (Metadata) Help added in v0.20.0

func (m Metadata) Help(name string) string

func (Metadata) Type added in v0.20.0

func (m Metadata) Type(name string) textparse.MetricType

type Metric

type Metric struct {
	Labels labels.Labels
	Value  float64
}

Metric is a pair of label set and value

func (Metric) Name

func (m Metric) Name() string

Name the __name__ label value

type Metrics

type Metrics []Metric

Metrics is a list of Metric

func (*Metrics) Add

func (m *Metrics) Add(kv Metric)

Add appends a metric.

func (Metrics) FindByName

func (m Metrics) FindByName(name string) Metrics

FindByName finds metrics where it's __name__ label matches given name. It expects the metrics is sorted. Complexity: O(log(N))

func (Metrics) FindByNames added in v0.2.0

func (m Metrics) FindByNames(names ...string) Metrics

FindByNames finds metrics where it's __name__ label matches given any of names. It expects the metrics is sorted. Complexity: O(log(N))

func (Metrics) Len

func (m Metrics) Len() int

Len returns metric length.

func (Metrics) Less

func (m Metrics) Less(i, j int) bool

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

func (Metrics) Match

func (m Metrics) Match(matcher *labels.Matcher) Metrics

Match match finds metrics where it's label matches given matcher. It does NOT expect the metrics is sorted. Complexity: O(N)

func (Metrics) Max

func (m Metrics) Max() float64

Max returns the max value. It do NOT expect the metrics is sorted. Complexity: O(N)

func (*Metrics) Reset

func (m *Metrics) Reset()

Reset resets the buffer to be empty, but it retains the underlying storage for use by future writes.

func (Metrics) Sort

func (m Metrics) Sort()

Sort sorts data.

func (Metrics) Swap

func (m Metrics) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Prometheus

type Prometheus interface {
	// Scrape and parse prometheus format metrics
	Scrape() (Metrics, error)
	// Metadata returns last scrape metrics metadata
	Metadata() Metadata
}

Prometheus is a helper for scrape and parse prometheus format metrics.

func New

func New(client *http.Client, request web.Request) Prometheus

New creates a Prometheus instance.

func NewWithSelector added in v0.21.0

func NewWithSelector(client *http.Client, request web.Request, sr selector.Selector) Prometheus

New creates a Prometheus instance with the selector.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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