metricsmap

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 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.

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 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 [3]uint16 `align:"reserved"`
}

Key must be in sync with struct metrics_key in <bpf/lib/common.h>

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>

func (*Value) CountFloat

func (v *Value) CountFloat() float64

CountFloat converts the request count to float

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

Jump to

Keyboard shortcuts

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