Gets metrics from an eBPF program!
This is a generalized user space implementation to collect custom metrics from an eBPF program.
The module provides the [EbpfMetrics] type, which reads counters created in eBPF and emits them using the [metrics] crate. Any implementation of the [metrics::recorder::Recorder] trait can be used once it is set as the global recorder.
Example:
Define counters:
# use Duration;
# use ;
# use ;
let metrics = vec!;
Emit metrics:
# let mut bpf = aya::Ebpf::load(&[]).unwrap();
// start emitting metrics using the global recorder
EbpfMetrics::new(&mut bpf, metrics, Duration::from_secs(60)).unwrap();
With the following eBPF code:
use aya_metrics_common::metrics::{counter, Counter};
use my_crate::MyCounter;
counter(MyCounter::Packets, 1);