10 releases
0.5.4 | Oct 17, 2024 |
---|---|
0.5.3 | Oct 15, 2024 |
0.5.0 | Jul 12, 2024 |
0.4.2 | Jun 21, 2024 |
0.4.0 | Apr 10, 2024 |
#246 in Unix APIs
342 downloads per month
2MB
8K
SLoC
bpf-metrics-exporter
Exports metrics from the kernel's BPF subsystem to OpenTelmetry. These can later be enriched with other metrics from the system, for example, to correlate process IDs -> containers -> k8s pods.
Usage
./bpf-metrics-exporter --otlp-grpc localhost:4317
Metrics
The following metrics are currently exported, this list will continue to expand:
Gauges
bpf_program_info
: Information on each loaded BPF Program- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable stringtag
: The tag of the BPF programgpl_compatible
: Whether the BPF program is GPL compatibleload_time
: The time the BPF program was loaded
- Labels:
bpf_map_info
: Information of each loaded BPF Map- Labels:
id
: The ID of the BPF mapname
: The name of the BPF maptype
: The type of the BPF map as anu32
which corresponds to the following kernel enumerationkey_size
: The key size in bytes for the BPF mapvalue_size
: The value size for the BPF mapmax_entries
: The maximum number of entries for the BPF map.flags
: Loadtime specific flags for the BPF map
- Labels:
bpf_link_info
: Information on each of the loaded BPF Link- Labels:
id
: The ID of the bpf Linkprog_id
: The Program ID of the BPF program which is using the Link.type
: The BPF Link type as au32
which corresponds to the following kernel enumeration
- Labels:
bpf_program_load_time
: The standard UTC time the program was loaded in seconds- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable string
- Labels:
Counters
Note: All counters will have the suffix _total
appended.
bpf_program_size_jitted_bytes
: The size in bytes of the program's JIT-compiled machine code.- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable string
- Labels:
bpf_program_size_translated_bytes
: The size of the BPF program in bytes.- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable string
- Labels:
bpf_program_mem_bytes
: The amount of memory used by the BPF program in bytes.- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable string
- Labels:
bpf_program_verified_instructions
: The number of instructions in the BPF program.- Labels:
id
: The ID of the BPF programname
: The name of the BPF programtype
: The type of the BPF program as a readable string
- Labels:
bpf_map_key_size
: The size of the BPF map key- Labels:
id
: The ID of the BPF mapname
: The name of the BPF maptype
: The type of the BPF map as anu32
which corresponds to the following kernel enumeration
- Labels:
bpf_map_value_size
: The size of the BPF map value- Labels:
id
: The ID of the BPF mapname
: The name of the BPF maptype
: The type of the BPF map as anu32
which corresponds to the following kernel enumeration
- Labels:
bpf_map_max_entries
: The maximum number of entries allowed for the BPF map- Labels:
id
: The ID of the BPF mapname
: The name of the BPF maptype
: The type of the BPF map as anu32
which corresponds to the following kernel enumeration
- Labels:
Try it out
You'll need a Grafana stack set up. You can quickly deploy one using:
podman play kube metrics-stack.yaml
Then, you can deploy the exporter:
sudo ./target/debug/bpf-metrics-exporter
You can log into grafana at http://localhost:3000/
using the default user:password
admin:admin
.
From there simply select the default dashboard titled eBPF Subsystem Metrics
:
In order to clean everything up simply exit the bpf-metrics-exporter process with
ctrl+c
and run:
podman kube down metrics-stack.yaml
Dependencies
~53–72MB
~1.5M SLoC