prom

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrometheusEndpoint

func PrometheusEndpoint(ctx context.Context, cfg *PrometheusConfig, promMgr *connector.PrometheusManager) (pipe.FinalFunc[[]*ebpf.Record], error)

Types

type Expirer

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

Expirer drops metrics from labels that haven't been updated during a given timeout TODO: generify and move to a common section for using it also in AppO11y, supporting more prometheus metrics

func NewExpirer

func NewExpirer(wrapped *prometheus.CounterVec, expireTime time.Duration) *Expirer

NewExpirer creates a metric that wraps a given CounterVec. Its labeled instances are dropped if they haven't been updated during the last timeout period

func (*Expirer) Collect

func (ex *Expirer) Collect(metrics chan<- prometheus.Metric)

Collect wraps prometheus.Collector Wrap method

func (*Expirer) Describe

func (ex *Expirer) Describe(descs chan<- *prometheus.Desc)

Describe wraps prometheus.Collector Describe method

func (*Expirer) UpdateTime

func (ex *Expirer) UpdateTime()

UpdateTime updates the last access time to be annotated to any new or existing metric. It is a required operation before processing a given batch of metrics (invoking the WithLabelValues).

func (*Expirer) WithLabelValues

func (ex *Expirer) WithLabelValues(lbls ...string) prometheus.Counter

WithLabelValues returns the Counter for the given slice of label values (same order as the variable labels in Desc). If that combination of label values is accessed for the first time, a new Counter is created. If not, a cached copy is returned and the "last access" cache time is updated.

type PrometheusConfig

type PrometheusConfig struct {
	Config            *prom.PrometheusConfig
	AllowedAttributes []string
}

PrometheusConfig for network metrics just wraps the global prom.PrometheusConfig as provided by the user

func (PrometheusConfig) Enabled

func (p PrometheusConfig) Enabled() bool

nolint:gocritic

Jump to

Keyboard shortcuts

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