layer4

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Name = "layer4"
View Source
var SocketHistogramBucketsCount = len(SocketHistogramBucketsNs)
View Source
var SocketHistogramBucketsNs = []float64{0, 10000, 50000, 100000, 500000, 1000000, 1200000, 1500000, 1700000, 2000000,
	2500000, 3000000, 5000000, 7000000, 10000000, 13000000, 16000000, 20000000, 25000000, 30000000, 35000000, 40000000,
	45000000, 50000000, 70000000, 100000000, 150000000, 200000000, 300000000, 500000000, 1000000000, 2000000000,
	3000000000, 5000000000}

SocketHistogramBucketsNs means the histogram bucket: 0ms, 0.01ms, 0.05ms, 0.1ms, 0.5ms, 1ms, 1.2ms, 1.5ms, 1.7ms, 2ms, 2.5ms, 3ms, 5ms, 7ms, 10ms, 13ms, 16ms, 20ms, 25ms, 30ms, 35ms, 40ms, 45ms, 50ms, 70ms, 100ms, 150ms, 200ms, 300ms, 500ms, 1s, 2s, 3s, 5s value unit: ns

View Source
var SocketHistogramBucketsUs = []float64{0, 10, 50, 100, 500, 1000, 1200, 1500, 1700, 2000,
	2500, 3000, 5000, 7000, 10000, 13000, 16000, 20000, 25000, 30000, 35000, 40000,
	45000, 50000, 70000, 100000, 150000, 200000, 300000, 500000, 1000000, 2000000,
	3000000, 5000000}

SocketHistogramBucketsUs same with SocketHistogramBucketsNs, but the value unit: us

Functions

This section is empty.

Types

type HistogramDataKey

type HistogramDataKey struct {
	ConnectionID  uint64
	RandomID      uint64
	Bucket        uint64
	DataDirection enums.SocketDataDirection
	DataType      enums.SocketDataStaticsType
	Fix           [6]byte
}

type HistogramDataUnit

type HistogramDataUnit int
const (
	HistogramDataUnitNS HistogramDataUnit = 1
	HistogramDataUnitUS HistogramDataUnit = 2
)

type Listener

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

func NewListener

func NewListener() *Listener

func (*Listener) FlushMetrics

func (l *Listener) FlushMetrics(traffics []*base.ProcessTraffic, builder *base.MetricsBuilder)

func (*Listener) GenerateMetrics

func (l *Listener) GenerateMetrics() base.ConnectionMetrics

func (*Listener) Init

func (l *Listener) Init(config *profiling.TaskConfig, moduleManager *module.Manager) error

func (*Listener) Name

func (l *Listener) Name() string

func (*Listener) PostFlushConnectionMetrics

func (l *Listener) PostFlushConnectionMetrics(ccs []*base.ConnectionContext)

func (*Listener) PreFlushConnectionMetrics

func (l *Listener) PreFlushConnectionMetrics(ccs []*base.ConnectionWithBPF, bpfLoader *bpf.Loader) error

func (*Listener) ReceiveCloseConnection

func (l *Listener) ReceiveCloseConnection(ctx *base.ConnectionContext, event *events.SocketCloseEvent)

func (*Listener) ReceiveNewConnection

func (l *Listener) ReceiveNewConnection(ctx *base.ConnectionContext, event *events.SocketConnectEvent)

func (*Listener) RegisterBPFEvents

func (l *Listener) RegisterBPFEvents(ctx context.Context, bpfLoader *bpf.Loader)

func (*Listener) UpdateExtensionConfig

func (l *Listener) UpdateExtensionConfig(config *profiling.ExtensionConfig)

type Metrics

type Metrics struct {
	// basic statics
	// read/write
	WriteCounter *SocketDataCounterWithHistory
	ReadCounter  *SocketDataCounterWithHistory
	// write RTT
	WriteRTTCounter *SocketDataCounterWithHistory

	// histograms
	// write execute time and RTT
	WriteRTTHistogram     *SocketDataHistogramWithHistory
	WriteExeTimeHistogram *SocketDataHistogramWithHistory
	// read execute time
	ReadExeTimeHistogram *SocketDataHistogramWithHistory

	// the connection connect or close execute time
	ConnectExecuteTime      uint64
	CloseExecuteTime        uint64
	ConnectCounter          *SocketDataCounterWithHistory
	CloseCounter            *SocketDataCounterWithHistory
	ConnectExeTimeHistogram *SocketDataHistogramWithHistory
	CloseExeTimeHistogram   *SocketDataHistogramWithHistory

	// exception counters
	RetransmitCounter *SocketDataCounterWithHistory
	DropCounter       *SocketDataCounterWithHistory
}

func NewLayer4Metrics

func NewLayer4Metrics() *Metrics

func (*Metrics) MergeMetricsFromConnection

func (l *Metrics) MergeMetricsFromConnection(connection *base.ConnectionContext, data base.ConnectionMetrics)

type SocketBasicKey

type SocketBasicKey struct {
	Pid          uint32
	Family       uint32
	RemoteAddrV4 uint32
	RemoteAddrV6 [16]uint8
	RemotePort   uint32
	LocalAddrV4  uint32
	LocalAddrV6  [16]uint8
	LocalPort    uint32
}

type SocketDataCounter

type SocketDataCounter struct {
	Bytes   uint64
	Count   uint64
	ExeTime uint64
}

func NewSocketDataCounter

func NewSocketDataCounter() *SocketDataCounter

func NewSocketDataCounterWithValue

func NewSocketDataCounterWithValue(bytes, count, exeTime uint64) *SocketDataCounter

func (*SocketDataCounter) Increase

func (s *SocketDataCounter) Increase(d *SocketDataCounter)

func (*SocketDataCounter) IncreaseByValue

func (s *SocketDataCounter) IncreaseByValue(bytes, count, exeTime uint64)

func (*SocketDataCounter) NotEmpty

func (s *SocketDataCounter) NotEmpty() bool

type SocketDataCounterWithHistory

type SocketDataCounterWithHistory struct {
	Pre *SocketDataCounter
	Cur *SocketDataCounter
}

SocketDataCounterWithHistory means the socket send/receive data metrics

func NewSocketDataCounterWithHistory

func NewSocketDataCounterWithHistory() *SocketDataCounterWithHistory

func (*SocketDataCounterWithHistory) CalculateIncrease

func (c *SocketDataCounterWithHistory) CalculateIncrease() *SocketDataCounter

func (*SocketDataCounterWithHistory) IncreaseToCurrent

func (c *SocketDataCounterWithHistory) IncreaseToCurrent(other *SocketDataCounter)

func (*SocketDataCounterWithHistory) RefreshCurrent

func (c *SocketDataCounterWithHistory) RefreshCurrent()

func (*SocketDataCounterWithHistory) UpdateToCurrent

func (c *SocketDataCounterWithHistory) UpdateToCurrent(bytes, count, exeTime uint64)

type SocketDataHistogram

type SocketDataHistogram struct {
	Unit    HistogramDataUnit
	Buckets map[uint64]uint32
}

func NewSocketDataHistogram

func NewSocketDataHistogram(unit HistogramDataUnit) *SocketDataHistogram

func (*SocketDataHistogram) Increase

func (h *SocketDataHistogram) Increase(other *SocketDataHistogram)

func (*SocketDataHistogram) IncreaseByValue

func (h *SocketDataHistogram) IncreaseByValue(val uint64)

func (*SocketDataHistogram) NotEmpty

func (h *SocketDataHistogram) NotEmpty() bool

func (*SocketDataHistogram) Overwrite

func (h *SocketDataHistogram) Overwrite(other *SocketDataHistogram)

func (*SocketDataHistogram) Update

func (h *SocketDataHistogram) Update(bucket uint64, value uint32)

type SocketDataHistogramWithHistory

type SocketDataHistogramWithHistory struct {
	Pre *SocketDataHistogram
	Cur *SocketDataHistogram
}

func NewSocketDataHistogramWithHistory

func NewSocketDataHistogramWithHistory(unit HistogramDataUnit) *SocketDataHistogramWithHistory

func (*SocketDataHistogramWithHistory) CalculateIncrease

func (h *SocketDataHistogramWithHistory) CalculateIncrease() *SocketDataHistogram

func (*SocketDataHistogramWithHistory) IncreaseToCurrent

func (h *SocketDataHistogramWithHistory) IncreaseToCurrent(other *SocketDataHistogram)

func (*SocketDataHistogramWithHistory) RefreshCurrent

func (h *SocketDataHistogramWithHistory) RefreshCurrent()

func (*SocketDataHistogramWithHistory) UpdateToCurrent

func (h *SocketDataHistogramWithHistory) UpdateToCurrent(bucket uint64, val uint32)

type SocketExceptionOperationEvent

type SocketExceptionOperationEvent struct {
	Pid            uint32
	SocketFamily   uint32
	RemoteAddrV4   uint32
	RemoteAddrV6   [16]uint8
	RemoteAddrPort uint32
	LocalAddrV4    uint32
	LocalAddrV6    [16]uint8
	LocalAddrPort  uint32
	Type           enums.SocketExceptionOperationType
}

SocketExceptionOperationEvent Socket have been retransmitted/drop the package event

type SocketExceptionValue

type SocketExceptionValue struct {
	DropCount       int
	RetransmitCount int
}

Jump to

Keyboard shortcuts

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