collector

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TCP protocol.
	IP_PROTO_TCP = 6
	// UDP protocol.
	IP_PROTO_UDP = 17
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct{}

Clock is like time.Now(), except it can be mocked.

func (Clock) Now

func (c Clock) Now() time.Time

type ClockInterface

type ClockInterface interface {
	Now() time.Time
}

ClockInterface is a dummy interface used to generate a mock "clock" implementation used in unit tests. This lets us dynamically test timestamped Prometheus metrics.

type Collector

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

Collector is an implementation of the Prometheus collector that reports flow data.

func NewCollector

func NewCollector(conntrack ConntrackInterface, flowHandler pb.FlowHandlerClient, clock ClockInterface, collectionInterval time.Duration, localNode string, skipConntrackSanityCheck bool, uptimeWaitDuration time.Duration) (*Collector, error)

NewCollector creates a new Collector and validates that it can retrieve conntrack packet and byte counts.

func (*Collector) Run

func (collector *Collector) Run()

Run starts Collector's collection loop.

type ConntrackInterface

type ConntrackInterface interface {
	Dump(opts *conntrack.DumpOptions) ([]conntrack.Flow, error)
}

ConntrackInterface is a dummy interface used to generate a mock "conntrack" implementation used in unit tests.

Directories

Path Synopsis
Package mock_collector is a generated GoMock package.
Package mock_collector is a generated GoMock package.

Jump to

Keyboard shortcuts

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