metrics

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 8 Imported by: 20

Documentation

Overview

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Package metrics is a generated GoMock package.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Copyright (c) Microsoft Corporation. Licensed under the MIT license.

Index

Constants

View Source
const (

	// Conntrack metrics
	ConntrackPacketTxDescription         = "Number of tx packets"
	ConntrackPacketRxDescription         = "Number of rx packets"
	ConntrackBytesTxDescription          = "Number of tx bytes"
	ConntrackBytesRxDescription          = "Number of rx bytes"
	ConntrackTotalConnectionsDescription = "Total number of connections"
)

Variables

View Source
var (

	// Common gauges across os distributions
	DropPacketsGauge    GaugeVec
	DropBytesGauge      GaugeVec
	ForwardPacketsGauge GaugeVec
	ForwardBytesGauge   GaugeVec

	// Windows
	HNSStatsGauge GaugeVec

	// Common gauges across os distributions
	NodeConnectivityStatusGauge  GaugeVec
	NodeConnectivityLatencyGauge GaugeVec

	// TCP Stats
	TCPStateGauge            GaugeVec
	TCPConnectionRemoteGauge GaugeVec
	TCPConnectionStatsGauge  GaugeVec
	TCPFlagGauge             GaugeVec

	// IP States
	IPConnectionStatsGauge GaugeVec

	// UDP Stats
	UDPConnectionStatsGauge GaugeVec

	// Interface Stats
	InterfaceStatsGauge GaugeVec

	// Control Plane Metrics
	PluginManagerFailedToReconcileCounter CounterVec
	LostEventsCounter                     CounterVec
	ParsedPacketsCounter                  CounterVec
	MetricsExpiredCounter                 CounterVec

	// DNS Metrics.
	DNSRequestCounter  CounterVec
	DNSResponseCounter CounterVec

	InfinibandStatsGauge        GaugeVec
	InfinibandStatusParamsGauge GaugeVec

	// Conntrack
	ConntrackPacketsTx        GaugeVec
	ConntrackPacketsRx        GaugeVec
	ConntrackBytesTx          GaugeVec
	ConntrackBytesRx          GaugeVec
	ConntrackTotalConnections GaugeVec
)

Metric Counters

Functions

func GetCounterValue

func GetCounterValue(m prometheus.Counter) float64

GetCounterValue returns the current value stored for the counter

func GetDropTypeFlowDropReason

func GetDropTypeFlowDropReason(dr flow.DropReason) string

func InitializeMetrics

func InitializeMetrics(logger *slog.Logger)

Initiates and creates the common metrics

func ToPrometheusType

func ToPrometheusType(metric interface{}) prometheus.Collector

Types

type CounterVec added in v0.0.16

type CounterVec interface {
	MetricVec
	WithLabelValues(lvs ...string) prometheus.Counter
	GetMetricWithLabelValues(lvs ...string) (prometheus.Counter, error)
}

type DropReasonType

type DropReasonType uint32
const (
	IPTABLE_RULE_DROP DropReasonType = iota
	IPTABLE_NAT_DROP
	TCP_CONNECT_BASIC
	TCP_ACCEPT_BASIC
	TCP_CLOSE_BASIC
	CONNTRACK_ADD_DROP
	UNKNOWN_DROP
)

Alert: this ordering should match the drop_reason_t enum ordering in dropreason.h of DropReason plugin

func GetDropType

func GetDropType(value uint32) DropReasonType

func (DropReasonType) String

func (d DropReasonType) String() string

type GaugeVec added in v0.0.16

type GaugeVec interface {
	MetricVec
	WithLabelValues(lvs ...string) prometheus.Gauge
	GetMetricWithLabelValues(lvs ...string) (prometheus.Gauge, error)
}

type Histogram added in v0.0.16

type Histogram interface {
	Observe(float64)
	// Keep the Write method for testing purposes.
	Write(*dto.Metric) error
}

type MetricVec added in v1.1.0

type MetricVec interface {
	DeleteLabelValues(lvs ...string) bool
}

type MockCounterVec added in v0.0.16

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

MockCounterVec is a mock of CounterVec interface.

func NewMockCounterVec added in v0.0.16

func NewMockCounterVec(ctrl *gomock.Controller) *MockCounterVec

NewMockCounterVec creates a new mock instance.

func (*MockCounterVec) DeleteLabelValues added in v1.1.0

func (m *MockCounterVec) DeleteLabelValues(lvs ...string) bool

DeleteLabelValues mocks base method.

func (*MockCounterVec) EXPECT added in v0.0.16

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockCounterVec) GetMetricWithLabelValues added in v0.0.16

func (m *MockCounterVec) GetMetricWithLabelValues(lvs ...string) (prometheus.Counter, error)

GetMetricWithLabelValues mocks base method.

func (*MockCounterVec) WithLabelValues added in v0.0.16

func (m *MockCounterVec) WithLabelValues(lvs ...string) prometheus.Counter

WithLabelValues mocks base method.

type MockCounterVecMockRecorder added in v0.0.16

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

MockCounterVecMockRecorder is the mock recorder for MockCounterVec.

func (*MockCounterVecMockRecorder) DeleteLabelValues added in v1.1.0

func (mr *MockCounterVecMockRecorder) DeleteLabelValues(lvs ...any) *gomock.Call

DeleteLabelValues indicates an expected call of DeleteLabelValues.

func (*MockCounterVecMockRecorder) GetMetricWithLabelValues added in v0.0.16

func (mr *MockCounterVecMockRecorder) GetMetricWithLabelValues(lvs ...any) *gomock.Call

GetMetricWithLabelValues indicates an expected call of GetMetricWithLabelValues.

func (*MockCounterVecMockRecorder) WithLabelValues added in v0.0.16

func (mr *MockCounterVecMockRecorder) WithLabelValues(lvs ...any) *gomock.Call

WithLabelValues indicates an expected call of WithLabelValues.

type MockGaugeVec added in v0.0.16

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

MockGaugeVec is a mock of GaugeVec interface.

func NewMockGaugeVec added in v0.0.16

func NewMockGaugeVec(ctrl *gomock.Controller) *MockGaugeVec

NewMockGaugeVec creates a new mock instance.

func (*MockGaugeVec) DeleteLabelValues added in v1.1.0

func (m *MockGaugeVec) DeleteLabelValues(lvs ...string) bool

DeleteLabelValues mocks base method.

func (*MockGaugeVec) EXPECT added in v0.0.16

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockGaugeVec) GetMetricWithLabelValues added in v0.0.16

func (m *MockGaugeVec) GetMetricWithLabelValues(lvs ...string) (prometheus.Gauge, error)

GetMetricWithLabelValues mocks base method.

func (*MockGaugeVec) WithLabelValues added in v0.0.16

func (m *MockGaugeVec) WithLabelValues(lvs ...string) prometheus.Gauge

WithLabelValues mocks base method.

type MockGaugeVecMockRecorder added in v0.0.16

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

MockGaugeVecMockRecorder is the mock recorder for MockGaugeVec.

func (*MockGaugeVecMockRecorder) DeleteLabelValues added in v1.1.0

func (mr *MockGaugeVecMockRecorder) DeleteLabelValues(lvs ...any) *gomock.Call

DeleteLabelValues indicates an expected call of DeleteLabelValues.

func (*MockGaugeVecMockRecorder) GetMetricWithLabelValues added in v0.0.16

func (mr *MockGaugeVecMockRecorder) GetMetricWithLabelValues(lvs ...any) *gomock.Call

GetMetricWithLabelValues indicates an expected call of GetMetricWithLabelValues.

func (*MockGaugeVecMockRecorder) WithLabelValues added in v0.0.16

func (mr *MockGaugeVecMockRecorder) WithLabelValues(lvs ...any) *gomock.Call

WithLabelValues indicates an expected call of WithLabelValues.

type MockHistogram added in v0.0.16

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

MockHistogram is a mock of Histogram interface.

func NewMockHistogram added in v0.0.16

func NewMockHistogram(ctrl *gomock.Controller) *MockHistogram

NewMockHistogram creates a new mock instance.

func (*MockHistogram) EXPECT added in v0.0.16

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockHistogram) Observe added in v0.0.16

func (m *MockHistogram) Observe(arg0 float64)

Observe mocks base method.

func (*MockHistogram) Write added in v0.0.16

Write mocks base method.

type MockHistogramMockRecorder added in v0.0.16

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

MockHistogramMockRecorder is the mock recorder for MockHistogram.

func (*MockHistogramMockRecorder) Observe added in v0.0.16

func (mr *MockHistogramMockRecorder) Observe(arg0 any) *gomock.Call

Observe indicates an expected call of Observe.

func (*MockHistogramMockRecorder) Write added in v0.0.16

func (mr *MockHistogramMockRecorder) Write(arg0 any) *gomock.Call

Write indicates an expected call of Write.

type MockMetricVec added in v1.1.0

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

MockMetricVec is a mock of MetricVec interface.

func NewMockMetricVec added in v1.1.0

func NewMockMetricVec(ctrl *gomock.Controller) *MockMetricVec

NewMockMetricVec creates a new mock instance.

func (*MockMetricVec) DeleteLabelValues added in v1.1.0

func (m *MockMetricVec) DeleteLabelValues(lvs ...string) bool

DeleteLabelValues mocks base method.

func (*MockMetricVec) EXPECT added in v1.1.0

EXPECT returns an object that allows the caller to indicate expected use.

type MockMetricVecMockRecorder added in v1.1.0

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

MockMetricVecMockRecorder is the mock recorder for MockMetricVec.

func (*MockMetricVecMockRecorder) DeleteLabelValues added in v1.1.0

func (mr *MockMetricVecMockRecorder) DeleteLabelValues(lvs ...any) *gomock.Call

DeleteLabelValues indicates an expected call of DeleteLabelValues.

Jump to

Keyboard shortcuts

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