metricsmap

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package metricsmap represents the BPF metrics map in the BPF programs. It is implemented as a hash table containing an entry of different drop and forward counts for different drop/forward reasons and directions. +groupName=maps

Index

Constants

View Source
const (
	// MapName for metrics map.
	MapName = "cilium_metrics"
	// MaxEntries is the maximum number of keys that can be present in the
	// Metrics Map.
	MaxEntries = 65536
)

Variables

View Source
var (
	// Metrics is the bpf metrics map
	Metrics *bpf.Map
)

Functions

func MetricDirection added in v1.6.0

func MetricDirection(dir uint8) string

MetricDirection gets the direction in human readable string format

func SyncMetricsMap

func SyncMetricsMap(ctx context.Context) error

SyncMetricsMap is called periodically to sync off the metrics map by aggregating it into drops (by drop reason and direction) and forwards (by direction) with the prometheus server.

Types

type Key

type Key struct {
	Reason   uint8      `align:"reason"`
	Dir      uint8      `align:"dir"`
	Reserved pad3uint16 `align:"reserved"`
}

Key must be in sync with struct metrics_key in <bpf/lib/common.h> +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapKey

func (*Key) DeepCopy added in v1.5.1

func (in *Key) DeepCopy() *Key

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Key.

func (*Key) DeepCopyInto added in v1.5.1

func (in *Key) DeepCopyInto(out *Key)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Key) DeepCopyMapKey added in v1.5.1

func (in *Key) DeepCopyMapKey() bpf.MapKey

DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.

func (*Key) Direction

func (k *Key) Direction() string

Direction gets the direction in human readable string format

func (*Key) DropForwardReason

func (k *Key) DropForwardReason() string

DropForwardReason gets the forwarded/dropped reason in human readable string format

func (*Key) GetKeyPtr

func (k *Key) GetKeyPtr() unsafe.Pointer

GetKeyPtr returns the unsafe pointer to the BPF key

func (*Key) IsDrop

func (k *Key) IsDrop() bool

IsDrop checks if the reason is drop or not.

func (*Key) NewValue

func (k *Key) NewValue() bpf.MapValue

NewValue returns a new empty instance of the structure representing the BPF map value

func (*Key) String

func (k *Key) String() string

String converts the key into a human readable string format

type Value

type Value struct {
	Count uint64 `align:"count"`
	Bytes uint64 `align:"bytes"`
}

Value must be in sync with struct metrics_value in <bpf/lib/common.h> +k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue

func (*Value) CountFloat

func (v *Value) CountFloat() float64

CountFloat converts the request count to float

func (*Value) DeepCopy added in v1.5.1

func (in *Value) DeepCopy() *Value

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Value.

func (*Value) DeepCopyInto added in v1.5.1

func (in *Value) DeepCopyInto(out *Value)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Value) DeepCopyMapValue added in v1.5.1

func (in *Value) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Value) GetValuePtr

func (v *Value) GetValuePtr() unsafe.Pointer

GetValuePtr returns the unsafe pointer to the BPF value.

func (*Value) RequestBytes

func (v *Value) RequestBytes() string

RequestBytes returns drop/forward bytes in a human readable string format

func (*Value) RequestCount

func (v *Value) RequestCount() string

RequestCount returns the drop/forward count in a human readable string format

func (*Value) String

func (v *Value) String() string

String converts the value into a human readable string format

type Values added in v1.6.0

type Values []Value

+k8s:deepcopy-gen=true +k8s:deepcopy-gen:interfaces=github.com/cilium/cilium/pkg/bpf.MapValue Values is a slice of Values

func (Values) DeepCopy added in v1.6.0

func (in Values) DeepCopy() Values

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Values.

func (Values) DeepCopyInto added in v1.6.0

func (in Values) DeepCopyInto(out *Values)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Values) DeepCopyMapValue added in v1.6.0

func (vs *Values) DeepCopyMapValue() bpf.MapValue

DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.

func (*Values) GetValuePtr added in v1.6.0

func (vs *Values) GetValuePtr() unsafe.Pointer

GetValuePtr returns the unsafe pointer to the BPF value.

func (Values) String added in v1.6.0

func (vs Values) String() string

String converts the value into a human readable string format

Jump to

Keyboard shortcuts

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