prometheus

package
v0.0.0-...-aac4589 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TagValueToString

func TagValueToString(vI interface{}) string

TagValueToString converts any value to a string, which could be used as label value in prometheus.

Types

type Count

Count is an implementation of metrics.Count.

func (*Count) Add

func (metric *Count) Add(delta uint64) uint64

Add implementations metrics.Count.

func (*Count) WithOverriddenTags

func (metric *Count) WithOverriddenTags(tags Fields) metrics.Count

WithOverriddenTags implementations metrics.Count.

type CounterVec

type CounterVec struct {
	*prometheus.CounterVec
	Key            string
	PossibleLabels []string
}

func (*CounterVec) AddPossibleLabels

func (v *CounterVec) AddPossibleLabels(newLabels []string)

func (*CounterVec) GetMetricWith

func (v *CounterVec) GetMetricWith(labels prometheus.Labels) (prometheus.Counter, error)

type Fields

type Fields = fields.Fields

type Gauge

Gauge is an implementation of metrics.Gauge.

func (*Gauge) Add

func (metric *Gauge) Add(delta float64) float64

Add implementations metrics.Count.

func (*Gauge) WithOverriddenTags

func (metric *Gauge) WithOverriddenTags(tags Fields) metrics.Gauge

WithOverriddenTags implementations metrics.Count.

type GaugeVec

type GaugeVec struct {
	*prometheus.GaugeVec
	Key            string
	PossibleLabels []string
}

func (*GaugeVec) AddPossibleLabels

func (v *GaugeVec) AddPossibleLabels(newLabels []string)

func (*GaugeVec) GetMetricWith

func (v *GaugeVec) GetMetricWith(labels prometheus.Labels) (prometheus.Gauge, error)

type IntGauge

IntGauge is an implementation of metrics.IntGauge.

func (*IntGauge) Add

func (metric *IntGauge) Add(delta int64) int64

Add implementations metrics.Count.

func (*IntGauge) WithOverriddenTags

func (metric *IntGauge) WithOverriddenTags(tags Fields) metrics.IntGauge

WithOverriddenTags implementations metrics.Count.

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

Metrics implements a wrapper of prometheus metrics to implement metrics.Metrics.

Pretty slow and naive implementation. Could be improved by on-need basis. If you need a faster implementation, then try `tsmetrics`.

Warning! This implementation does not remove automatically metrics, thus if a metric was created once, it will be kept in memory forever. If you need a version of metrics which automatically removes metrics non-used for a long time, then try `tsmetrics`.

Warning! Prometheus does not support changing amount of labels for a metric, therefore we delete and create a metric from scratch if it is required to extend the set of labels. This procedure leads to a reset of the metric value. If you need a version of metrics which does not have such flaw, then try `tsmetrics` or `simplemetrics`.

func New

func New(registerer prometheus.Registerer) *Metrics

New returns a new instance of Metrics

func (*Metrics) Count

func (m *Metrics) Count(key string) metrics.Count

Count implements context.Metrics (see the description in the interface).

func (*Metrics) Gauge

func (m *Metrics) Gauge(key string) metrics.Gauge

Gauge implements context.Metrics (see the description in the interface).

func (*Metrics) IntGauge

func (m *Metrics) IntGauge(key string) metrics.IntGauge

IntGauge implements context.Metrics (see the description in the interface).

func (*Metrics) List

func (m *Metrics) List() []prometheus.Collector

func (*Metrics) Registerer

func (m *Metrics) Registerer() prometheus.Registerer

func (*Metrics) WithTag

func (m *Metrics) WithTag(key string, value interface{}) metrics.Metrics

WithTag implements context.Metrics (see the description in the interface).

func (*Metrics) WithTags

func (m *Metrics) WithTags(tags Fields) metrics.Metrics

WithTags implements context.Metrics (see the description in the interface).

Jump to

Keyboard shortcuts

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