metrics

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteMetricsForPod added in v0.11.0

func DeleteMetricsForPod(pod *corev1.Pod)

func EnableMetrics

func EnableMetrics(address string)

func GetPodQueue added in v0.11.0

func GetPodQueue() workqueue.DelayingInterface

func GetRegistry added in v0.11.0

func GetRegistry() *prometheus.Registry

func ListMetricsWithPod added in v0.11.0

func ListMetricsWithPod() []*prometheus.MetricVec

func NewCounterVecWithPod added in v0.11.0

func NewCounterVecWithPod(opts prometheus.CounterOpts, labels []string) *prometheus.CounterVec

NewCounterVecWithPod is a wrapper around prometheus.NewCounterVec that also registers the metric to be cleaned up when a pod is deleted. It should be used only to register metrics that have "pod" and "namespace" labels.

func NewGaugeVecWithPod added in v0.11.0

func NewGaugeVecWithPod(opts prometheus.GaugeOpts, labels []string) *prometheus.GaugeVec

NewGaugeVecWithPod is a wrapper around prometheus.NewGaugeVec that also registers the metric to be cleaned up when a pod is deleted. It should be used only to register metrics that have "pod" and "namespace" labels.

func NewHistogramVecWithPod added in v0.11.0

func NewHistogramVecWithPod(opts prometheus.HistogramOpts, labels []string) *prometheus.HistogramVec

NewHistogramVecWithPod is a wrapper around prometheus.NewHistogramVec that also registers the metric to be cleaned up when a pod is deleted. It should be used only to register metrics that have "pod" and "namespace" labels.

func RegisterPodDeleteHandler added in v0.11.0

func RegisterPodDeleteHandler()

RegisterPodDeleteHandler registers handler for deleting metrics associated with deleted pods. Without it, Tetragon kept exposing stale metrics for deleted pods. This was causing continuous increase in memory usage in Tetragon agent as well as in the metrics scraper.

func StartPodDeleteHandler added in v0.11.0

func StartPodDeleteHandler()

Types

type BPFMetric added in v1.0.0

type BPFMetric interface {
	Desc() *prometheus.Desc
	MustMetric(value float64, labelValues ...string) prometheus.Metric
}

BPFMetric represents a metric read directly from a BPF map. It's intended to be used in custom collectors. The interface doesn't provide any validation, so it's up to the collector implementer to guarantee the metrics consistency.

func NewBPFCounter added in v1.0.0

func NewBPFCounter(desc *prometheus.Desc) BPFMetric

func NewBPFGauge added in v1.0.0

func NewBPFGauge(desc *prometheus.Desc) BPFMetric

type FilteredLabels added in v1.1.0

type FilteredLabels interface {
	Keys() []string
	Values() []string
}

type GranularCounter added in v1.0.0

type GranularCounter[L FilteredLabels] struct {
	// contains filtered or unexported fields
}

func MustNewGranularCounter added in v1.0.0

func MustNewGranularCounter[L FilteredLabels](opts prometheus.CounterOpts, extraLabels []string) *GranularCounter[L]

func NewGranularCounter added in v1.0.0

func NewGranularCounter[L FilteredLabels](opts prometheus.CounterOpts, extraLabels []string) (*GranularCounter[L], error)

func (*GranularCounter[L]) Collect added in v1.1.0

func (m *GranularCounter[L]) Collect(ch chan<- prometheus.Metric)

func (*GranularCounter[L]) Describe added in v1.1.0

func (m *GranularCounter[L]) Describe(ch chan<- *prometheus.Desc)

func (*GranularCounter[L]) WithLabelValues added in v1.0.0

func (m *GranularCounter[L]) WithLabelValues(commonLvs *L, extraLvs ...string) prometheus.Counter

type GranularGauge added in v1.0.0

type GranularGauge[L FilteredLabels] struct {
	// contains filtered or unexported fields
}

func MustNewGranularGauge added in v1.0.0

func MustNewGranularGauge[L FilteredLabels](opts prometheus.GaugeOpts, extraLabels []string) *GranularGauge[L]

func NewGranularGauge added in v1.0.0

func NewGranularGauge[L FilteredLabels](opts prometheus.GaugeOpts, extraLabels []string) (*GranularGauge[L], error)

func (*GranularGauge[L]) Collect added in v1.1.0

func (m *GranularGauge[L]) Collect(ch chan<- prometheus.Metric)

func (*GranularGauge[L]) Describe added in v1.1.0

func (m *GranularGauge[L]) Describe(ch chan<- *prometheus.Desc)

func (*GranularGauge[L]) WithLabelValues added in v1.0.0

func (m *GranularGauge[L]) WithLabelValues(commonLvs *L, extraLvs ...string) prometheus.Gauge

type GranularHistogram added in v1.0.0

type GranularHistogram[L FilteredLabels] struct {
	// contains filtered or unexported fields
}

func MustNewGranularHistogram added in v1.0.0

func MustNewGranularHistogram[L FilteredLabels](opts prometheus.HistogramOpts, extraLabels []string) *GranularHistogram[L]

func NewGranularHistogram added in v1.0.0

func NewGranularHistogram[L FilteredLabels](opts prometheus.HistogramOpts, extraLabels []string) (*GranularHistogram[L], error)

func (*GranularHistogram[L]) Collect added in v1.1.0

func (m *GranularHistogram[L]) Collect(ch chan<- prometheus.Metric)

func (*GranularHistogram[L]) Describe added in v1.1.0

func (m *GranularHistogram[L]) Describe(ch chan<- *prometheus.Desc)

func (*GranularHistogram[L]) WithLabelValues added in v1.0.0

func (m *GranularHistogram[L]) WithLabelValues(commonLvs *L, extraLvs ...string) prometheus.Observer

type LabelFilter added in v1.0.0

type LabelFilter map[string]bool

func (LabelFilter) WithEnabledLabels added in v1.1.0

func (f LabelFilter) WithEnabledLabels(enabledLabels []string) LabelFilter

WithEnabledLabels returns a new LabelFilter with only the labels in enabledLabels enabled. If enabledLabels is nil, a copy of the original LabelFilter is returned. If enabledLabels is empty, all labels are disabled. If enabledLabels contains labels that are not in the original LabelFilter, they are ignored.

type ProcessLabels added in v1.1.0

type ProcessLabels struct {
	Namespace string
	Workload  string
	Pod       string
	Binary    string
}

func NewProcessLabels added in v1.1.0

func NewProcessLabels(namespace, workload, pod, binary string) *ProcessLabels

func (ProcessLabels) Keys added in v1.1.0

func (l ProcessLabels) Keys() []string

func (ProcessLabels) Values added in v1.1.0

func (l ProcessLabels) Values() []string

Jump to

Keyboard shortcuts

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