metrics

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 25 Imported by: 0

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.

Index

Constants

View Source
const (
	// Metric descriptions
	DNSRequestCountDesc  = "Total number of DNS query packets"
	DNSResponseCountDesc = "Total number of DNS response packets"
)
View Source
const (
	TotalDropCountName = "adv_drop_count"
	TotalDropBytesName = "adv_drop_bytes"

	TotalDropCountDesc = "Total number of dropped packets"
	TotalDropBytesDesc = "Total number of dropped bytes"
)
View Source
const (
	TotalCountName = "adv_forward_count"

	// TODO remove bytes as it is not being populated
	TotalBytesName = "adv_forward_bytes"

	TotalCountDesc = "Total number of forwarded packets"
	TotalBytesDesc = "Total number of forwarded bytes"
)
View Source
const (
	TTL   time.Duration = 500 * time.Millisecond
	LIMIT uint64        = 100000
)
View Source
const (
	// Metric names
	TCPFlagsCountName = "adv_tcpflags_count"

	// Metric descriptions
	TCPFlagsCountDesc = "Total number of packets by TCP flag"
)
View Source
const (
	// Metric names
	TCPRetransCountName = "adv_tcpretrans_count"

	// Metric descriptions
	TCPRetransCountDesc = "Total number of TCP retransmitted packets"
)

Variables

View Source
var (
	DNSRequestCountName  = fmt.Sprintf("adv_%s", utils.DNSRequestCounterName)
	DNSResponseCountName = fmt.Sprintf("adv_%s", utils.DNSResponseCounterName)
)

Functions

func DefaultCtxOptions

func DefaultCtxOptions() []string

DefaultCtxOptions used for enableAnnotations where it sets the source and destination labels so users will not have to manually define.

func DefaultMetrics

func DefaultMetrics() []string

DefaultMetrics used for enableAnnotations where it sets enabled advanced metrics so users will not have to manually define. For any new advanced metrics we want to have enabled by default for annotation based solution, add it here.

Types

type AdvMetricsInterface

type AdvMetricsInterface interface {
	Init(metricName string)
	// This func is used to clean up old metrics on reconcile.
	Clean()
	ProcessFlow(f *flow.Flow)
}

type ContextOptions

type ContextOptions struct {
	IP        bool
	Namespace bool
	Podname   bool
	Workload  bool
	Service   bool
	Port      bool
	// contains filtered or unexported fields
}

func NewCtxOption

func NewCtxOption(opts []string, option ctxOptionType) *ContextOptions

type ContextOptionsInterface

type ContextOptionsInterface interface {
	// contains filtered or unexported methods
}

type DNSMetrics

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

func NewDNSMetrics

func NewDNSMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *DNSMetrics

func (*DNSMetrics) Clean

func (d *DNSMetrics) Clean()

func (*DNSMetrics) Init

func (d *DNSMetrics) Init(metricName string)

func (*DNSMetrics) ProcessFlow

func (d *DNSMetrics) ProcessFlow(flow *v1.Flow)

type DirtyCachePod

type DirtyCachePod struct {
	// IP is the IP of the endpoint
	IP net.IP
	// indicates if pod is annotated / of interest
	Annotated bool
	// indicates if pod namespace is annotated / of interest
	Namespaced bool
}

type DropCountMetrics

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

func NewDropCountMetrics

func NewDropCountMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *DropCountMetrics

func (*DropCountMetrics) Clean

func (d *DropCountMetrics) Clean()

func (*DropCountMetrics) Init

func (d *DropCountMetrics) Init(metricName string)

func (*DropCountMetrics) ProcessFlow

func (d *DropCountMetrics) ProcessFlow(flow *v1.Flow)

TODO: update ProcessFlow with bytes metrics. We are only accounting for count. bytes metrics needs some additional work in ebpf and in this func to get the skb length

type ForwardMetrics

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

func NewForwardCountMetrics

func NewForwardCountMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *ForwardMetrics

func (*ForwardMetrics) Clean

func (f *ForwardMetrics) Clean()

func (*ForwardMetrics) Init

func (f *ForwardMetrics) Init(metricName string)

func (*ForwardMetrics) ProcessFlow

func (f *ForwardMetrics) ProcessFlow(flow *v1.Flow)

TODO: update ProcessFlow with bytes metrics. We are only accounting for count. bytes metrics needs some additional work in ebpf and in this func to get the skb length

type IModule

type IModule interface {
	Reconcile(spec *api.MetricsSpec) error
}

type LatencyMetrics

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

func NewLatencyMetrics

func NewLatencyMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *LatencyMetrics

func (*LatencyMetrics) Clean

func (lm *LatencyMetrics) Clean()

func (*LatencyMetrics) Init

func (lm *LatencyMetrics) Init(metricName string)

func (*LatencyMetrics) ProcessFlow

func (lm *LatencyMetrics) ProcessFlow(f *v1.Flow)

type MockAdvMetricsInterface

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

MockAdvMetricsInterface is a mock of AdvMetricsInterface interface.

func NewMockAdvMetricsInterface

func NewMockAdvMetricsInterface(ctrl *gomock.Controller) *MockAdvMetricsInterface

NewMockAdvMetricsInterface creates a new mock instance.

func (*MockAdvMetricsInterface) Clean

func (m *MockAdvMetricsInterface) Clean()

Clean mocks base method.

func (*MockAdvMetricsInterface) EXPECT

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

func (*MockAdvMetricsInterface) Init

func (m *MockAdvMetricsInterface) Init(metricName string)

Init mocks base method.

func (*MockAdvMetricsInterface) ProcessFlow

func (m *MockAdvMetricsInterface) ProcessFlow(f *flow.Flow)

ProcessFlow mocks base method.

type MockAdvMetricsInterfaceMockRecorder

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

MockAdvMetricsInterfaceMockRecorder is the mock recorder for MockAdvMetricsInterface.

func (*MockAdvMetricsInterfaceMockRecorder) Clean

Clean indicates an expected call of Clean.

func (*MockAdvMetricsInterfaceMockRecorder) Init

func (mr *MockAdvMetricsInterfaceMockRecorder) Init(metricName any) *gomock.Call

Init indicates an expected call of Init.

func (*MockAdvMetricsInterfaceMockRecorder) ProcessFlow

func (mr *MockAdvMetricsInterfaceMockRecorder) ProcessFlow(f any) *gomock.Call

ProcessFlow indicates an expected call of ProcessFlow.

type MockContextOptionsInterface

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

MockContextOptionsInterface is a mock of ContextOptionsInterface interface.

func NewMockContextOptionsInterface

func NewMockContextOptionsInterface(ctrl *gomock.Controller) *MockContextOptionsInterface

NewMockContextOptionsInterface creates a new mock instance.

func (*MockContextOptionsInterface) EXPECT

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

type MockContextOptionsInterfaceMockRecorder

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

MockContextOptionsInterfaceMockRecorder is the mock recorder for MockContextOptionsInterface.

type MockIModule

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

MockIModule is a mock of IModule interface.

func NewMockIModule

func NewMockIModule(ctrl *gomock.Controller) *MockIModule

NewMockIModule creates a new mock instance.

func (*MockIModule) EXPECT

func (m *MockIModule) EXPECT() *MockIModuleMockRecorder

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

func (*MockIModule) Reconcile

func (m *MockIModule) Reconcile(spec *v1alpha1.MetricsSpec) error

Reconcile mocks base method.

type MockIModuleMockRecorder

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

MockIModuleMockRecorder is the mock recorder for MockIModule.

func (*MockIModuleMockRecorder) Reconcile

func (mr *MockIModuleMockRecorder) Reconcile(spec any) *gomock.Call

Reconcile indicates an expected call of Reconcile.

type Module

type Module struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

func (*Module) PodCallBackFn

func (m *Module) PodCallBackFn(obj interface{})

func (*Module) Reconcile

func (m *Module) Reconcile(spec *api.MetricsSpec) error

type TCPMetrics

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

func NewTCPMetrics

func NewTCPMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *TCPMetrics

func (*TCPMetrics) Clean

func (t *TCPMetrics) Clean()

func (*TCPMetrics) Init

func (t *TCPMetrics) Init(metricName string)

func (*TCPMetrics) ProcessFlow

func (t *TCPMetrics) ProcessFlow(flow *v1.Flow)

type TCPRetransMetrics

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

func NewTCPRetransMetrics

func NewTCPRetransMetrics(ctxOptions *api.MetricsContextOptions, fl *log.ZapLogger, isLocalContext enrichmentContext) *TCPRetransMetrics

func (*TCPRetransMetrics) Clean

func (t *TCPRetransMetrics) Clean()

func (*TCPRetransMetrics) Init

func (t *TCPRetransMetrics) Init(metricName string)

func (*TCPRetransMetrics) ProcessFlow

func (t *TCPRetransMetrics) ProcessFlow(flow *v1.Flow)

Jump to

Keyboard shortcuts

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