prometheus

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: GPL-3.0 Imports: 11 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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)
}

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.

Jump to

Keyboard shortcuts

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