ratelimitmap

package
v1.17.0-pre.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package ratelimitmap represents the BPF ratelimit maps in the BPF programs. It contains stats about BPF ratelimiter.

Index

Constants

View Source
const (
	// MetricsMapName for ratelimit metrics map.
	MetricsMapName = "cilium_ratelimit_metrics"
	// MapName for ratelimit map.
	MapName = "cilium_ratelimit"
	// MetricsMaxEntries is the maximum number of keys that can be present in
	// the Ratelimit Metrics Map.
	MaxMetricsEntries = 64
	// MaxEntries is the maximum number of keys that can be present in the
	// Ratelimit Map.
	MaxEntries = 1024
)
View Source
const (
	// keep in sync with defines in <bpf/lib/ratelimit.h>
	ICMPV6 usageType = iota + 1
	EVENTS_MAP
)

Variables

View Source
var Cell = cell.Module(
	"ratelimitmap",
	"eBPF Ratelimit Map",
	cell.Invoke(RegisterCollector),
)

Functions

func InitMaps

func InitMaps() error

func RegisterCollector

func RegisterCollector()

Types

type DumpCallback

type DumpCallback func(*MetricsKey, *MetricsValue)

DumpCallback represents the signature of the callback function expected by the DumpWithCallback method, which in turn is used to iterate all the keys/values of a ratelimit metrics map.

type Key

type Key struct {
	Usage usageType `align:"usage"`
	Key   uint32    `align:"key"`
}

Key must be in sync with struct ratelimit_key in <bpf/lib/ratelimit.h>

func (*Key) New

func (k *Key) New() bpf.MapKey

func (*Key) String

func (k *Key) String() string

type MetricsKey

type MetricsKey struct {
	Usage usageType `align:"usage"`
}

MetricsKey must be in sync with struct ratelimit_metrics_key in <bpf/lib/ratelimit.h>

func (*MetricsKey) New

func (k *MetricsKey) New() bpf.MapKey

func (*MetricsKey) String

func (k *MetricsKey) String() string

type MetricsValue

type MetricsValue struct {
	Dropped uint64 `align:"dropped"`
}

MetricsValue must be in sync with struct ratelimit_metrics_value in <bpf/lib/ratelimit.h>

func (*MetricsValue) New

func (v *MetricsValue) New() bpf.MapValue

func (*MetricsValue) String

func (v *MetricsValue) String() string

type RatelimitMetricsMap

type RatelimitMetricsMap interface {
	DumpWithCallback(DumpCallback) error
}

RatelimitMetricsMap interface represents a ratelimit metrics map, and can be reused to implement mock maps for unit tests.

type Value

type Value struct {
	LastTopup uint64 `align:"last_topup"`
	Tokens    uint64 `align:"tokens"`
}

Value must be in sync with struct ratelimit_value in <bpf/lib/ratelimit.h>

func (*Value) New

func (v *Value) New() bpf.MapValue

func (*Value) String

func (v *Value) String() string

Jump to

Keyboard shortcuts

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