prometheus

package
v0.0.0-...-6ade924 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetaEntry

type MetaEntry struct {
	Help string
	Type textparse.MetricType
}

type Metadata

type Metadata map[string]*MetaEntry

func (Metadata) Help

func (m Metadata) Help(name string) string

func (Metadata) Type

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

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 matches 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 does 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

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

NewWithSelector 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