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
- Variables
- func MetricDirection(dir uint8) string
- func SyncMetricsMap(ctx context.Context) error
- type Key
- func (in *Key) DeepCopy() *Key
- func (in *Key) DeepCopyInto(out *Key)
- func (in *Key) DeepCopyMapKey() bpf.MapKey
- func (k *Key) Direction() string
- func (k *Key) DropForwardReason() string
- func (k *Key) GetKeyPtr() unsafe.Pointer
- func (k *Key) IsDrop() bool
- func (k *Key) NewValue() bpf.MapValue
- func (k *Key) String() string
- type Value
- func (v *Value) CountFloat() float64
- func (in *Value) DeepCopy() *Value
- func (in *Value) DeepCopyInto(out *Value)
- func (in *Value) DeepCopyMapValue() bpf.MapValue
- func (v *Value) GetValuePtr() unsafe.Pointer
- func (v *Value) RequestBytes() string
- func (v *Value) RequestCount() string
- func (v *Value) String() string
- type Values
Constants ¶
const ( // MapName for metrics map. MapName = "cilium_metrics" // MaxEntries is the maximum number of keys that can be present in the // Metrics Map. // // Currently max. 2 bits of the Key.Dir member are used (unknown, // ingress or egress). Thus we can reduce from the theoretical max. size // of 2**16 (2 uint8) to 2**10 (1 uint8 + 2 bits). MaxEntries = 1024 )
Variables ¶
var ( // Metrics is the bpf metrics map Metrics *bpf.Map )
Functions ¶
func MetricDirection ¶
MetricDirection gets the direction in human readable string format
func SyncMetricsMap ¶
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
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Key.
func (*Key) DeepCopyInto ¶ added in v1.5.1
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
DeepCopyMapKey is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapKey.
func (*Key) DropForwardReason ¶
DropForwardReason gets the forwarded/dropped reason in human readable string format
type Value ¶
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 ¶ added in v1.5.0
CountFloat converts the request count to float
func (*Value) DeepCopy ¶ added in v1.5.1
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Value.
func (*Value) DeepCopyInto ¶ added in v1.5.1
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
DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.
func (*Value) GetValuePtr ¶ added in v1.5.0
GetValuePtr returns the unsafe pointer to the BPF value.
func (*Value) RequestBytes ¶ added in v1.5.0
RequestBytes returns drop/forward bytes in a human readable string format
func (*Value) RequestCount ¶ added in v1.5.0
RequestCount returns the drop/forward count in a human readable string format
type Values ¶
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
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Values.
func (Values) DeepCopyInto ¶ added in v1.6.0
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
DeepCopyMapValue is an autogenerated deepcopy function, copying the receiver, creating a new bpf.MapValue.
func (*Values) GetValuePtr ¶ added in v1.6.0
GetValuePtr returns the unsafe pointer to the BPF value.