sampler

package
v0.0.0-...-b78484e Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: BSD-2-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer

type Closer interface {
	Close() error
}

Closer is the interface that wraps the Close method.

type Config

type Config struct {
	Log bool
}

A Config contains the sampler configuration.

type Data

type Data struct {
	TstampNs         uint64 // monotonic nsec receive timestamp
	Options          uint8  // TCP options (TCPI_OPT_* in linux/tcp.h)
	RTTus            uint32 // TCP RTT in microseconds
	MinRTTus         uint32 // min TCP RTT in microseconds
	RTTVarus         uint32 // TCP RTT variance in microseconds
	SndCwndBytes     uint32 // TCP cwnd in bytes
	PacingRateBps    uint64 // TCP pacing rate in bytes / second
	TotalRetransmits uint32 // total retransmit counter
	// delivery stats only available in 4.18 and later
	//Delivered        uint32 // total delivered packets
	//DeliveredCE      uint32 // total delivered packets acked with ECE
	BytesAcked uint64 // bytes acked
}

A Data contains the sampled values for a flow.

func (*Data) EquivalentTo

func (d *Data) EquivalentTo(d1 *Data) bool

EquivalentTo returns true if all fields excluding the timestamp are the same as the given data.

type ID

type ID struct {
	SrcIP   [4]byte // source (local) IP address
	SrcPort uint16  // source (local) port
	DstIP   [4]byte // dest (remote) IP address
	DstPort uint16  // dest (remote) port
}

An ID uniquely identifies samples within a given sampler run.

type Result

type Result interface {
	Samples() []Sample
}

Result is the interface that wraps the Samples method.

type ResultRecycler

type ResultRecycler interface {
	RecycleResult(Result)
}

ResultRecycler is the interface that wraps the RecycleResult method. It should be implemented by samplers that can reuse previously allocated Results.

type Sample

type Sample struct {
	ID
	Data
}

A Sample contains a sample ID and its data.

type Sampler

type Sampler interface {
	Sample() (Result, error)
}

Sampler is the interface that wraps the Sample method.

Samples returns a nil result if it has no more samples to return. The separate Result interface allows the conversion to a flow.Sample slice to occur concurrently.

type SamplesRecycler

type SamplesRecycler interface {
	RecycleSamples([]Sample)
}

SamplesRecycler is the interface that wraps the RecycleSamples method. It should be implemented by samplers that can reuse previously allocated Samples.

Jump to

Keyboard shortcuts

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