metrics

package
v1.9.0-community Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeCounter   metricType = "counter"
	TypeGauge     metricType = "gauge"
	TypeHistogram metricType = "histogram"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCounter

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

func (*ErrorCounter) WithErrorName

func (c *ErrorCounter) WithErrorName(component, errName string, severity ErrorSeverity) prometheus.Counter

type ErrorSeverity

type ErrorSeverity string
const (
	HighSeverity   ErrorSeverity = "high"
	MediumSeverity ErrorSeverity = "medium"
	LowSeverity    ErrorSeverity = "low"
)

type EvictionCounter

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

EvictionCounter provides syntactic sugar hidding prom's counter for eviction purpose

func (*EvictionCounter) WithSource

func (c *EvictionCounter) WithSource(source string) prometheus.Counter

func (*EvictionCounter) WithSourceAndReason

func (c *EvictionCounter) WithSourceAndReason(source, reason string) prometheus.Counter

type FlowBufferSizeGauge

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

FlowBufferSizeGauge provides syntactic sugar hidding prom's gauge tailored for flows buffer size, backed by GaugeVec

func (*FlowBufferSizeGauge) WithBufferName

func (g *FlowBufferSizeGauge) WithBufferName(bufferName string) prometheus.Gauge

type FlowEnrichmentCounter

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

func (*FlowEnrichmentCounter) Increase

func (c *FlowEnrichmentCounter) Increase(hasDNS, hasRTT, hasDrops, hasNetEvents, hasXlat, hasIPSec bool)

type InterfaceEventsCounter

type InterfaceEventsCounter struct {
	Increase func(typez, ifname string, ifindex int, netns string, mac [6]uint8, retries int)
}

type Level

type Level string
const (
	LevelTrace Level = "trace!" // exclamation mark mean "warning" (avoid using for too long, unbounded cardinality)
	LevelDebug Level = "debug"
	LevelInfo  Level = "info"
)

type MetricDefinition

type MetricDefinition struct {
	Name   string
	Help   string
	Type   metricType
	Labels []string
}

type Metrics

type Metrics struct {
	Settings *Settings

	// Shared metrics:
	EvictionCounter        *EvictionCounter
	EvictedFlowsCounter    *EvictionCounter
	EvictedPacketsCounter  *EvictionCounter
	DroppedFlowsCounter    *EvictionCounter
	FilteredFlowsCounter   *EvictionCounter
	NetworkEventsCounter   *EvictionCounter
	FlowBufferSizeGauge    *FlowBufferSizeGauge
	Errors                 *ErrorCounter
	FlowEnrichmentCounter  *FlowEnrichmentCounter
	InterfaceEventsCounter *InterfaceEventsCounter
}

func NewMetrics

func NewMetrics(settings *Settings) *Metrics

func NoOp

func NoOp() *Metrics

func (*Metrics) CreateBatchCounter

func (m *Metrics) CreateBatchCounter(exporter string) prometheus.Counter

func (*Metrics) CreateInterfaceBufferGauge

func (m *Metrics) CreateInterfaceBufferGauge(name string, f func() float64)

func (*Metrics) CreateSamplingRate

func (m *Metrics) CreateSamplingRate() prometheus.Gauge

func (*Metrics) CreateTimeSpendInLookupAndDelete

func (m *Metrics) CreateTimeSpendInLookupAndDelete() prometheus.Histogram

func (*Metrics) NewCounter

func (m *Metrics) NewCounter(def *MetricDefinition, labels ...string) prometheus.Counter

func (*Metrics) NewCounterVec

func (m *Metrics) NewCounterVec(def *MetricDefinition) *prometheus.CounterVec

func (*Metrics) NewGauge

func (m *Metrics) NewGauge(def *MetricDefinition, labels ...string) prometheus.Gauge

func (*Metrics) NewGaugeFunc

func (m *Metrics) NewGaugeFunc(def *MetricDefinition, function func() float64, labelValues ...string)

func (*Metrics) NewGaugeVec

func (m *Metrics) NewGaugeVec(def *MetricDefinition) *prometheus.GaugeVec

func (*Metrics) NewHistogram

func (m *Metrics) NewHistogram(def *MetricDefinition, buckets []float64, labels ...string) prometheus.Histogram

type PromConnectionInfo

type PromConnectionInfo struct {
	Address string
	Port    int
	TLS     *PromTLS
}

type PromTLS

type PromTLS struct {
	CertPath string
	KeyPath  string
}

type Settings

type Settings struct {
	PromConnectionInfo
	Prefix string
	Level  Level
}

Jump to

Keyboard shortcuts

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