Documentation ¶
Index ¶
- type MetaEntry
- type Metadata
- type Metric
- type Metrics
- func (m *Metrics) Add(kv Metric)
- func (m Metrics) FindByName(name string) Metrics
- func (m Metrics) FindByNames(names ...string) Metrics
- func (m Metrics) Len() int
- func (m Metrics) Less(i, j int) bool
- func (m Metrics) Match(matcher *labels.Matcher) Metrics
- func (m Metrics) Max() float64
- func (m *Metrics) Reset()
- func (m Metrics) Sort()
- func (m Metrics) Swap(i, j int)
- type Prometheus
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 Metrics ¶
type Metrics []Metric
Metrics is a list of Metric
func (Metrics) FindByName ¶
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
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) Less ¶
Less reports whether the element with index i should sort before the element with index j.
func (Metrics) Match ¶
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 ¶
Max returns the max value. It do NOT expect the metrics is sorted. Complexity: O(N)
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
New creates a Prometheus instance with the selector.