andreasgerstmayr / bpftrace_exporter

Export variables from bpftrace scripts as metrics.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bpftrace-exporter

Exports variables from bpftrace scripts as metrics.

Requirements

  • bpftrace v0.15.0+

Usage

./bpftrace_exporter -script bpftrace_script.bt -vars var1:type1,var2:type2,...

Example:

./bpftrace_exporter -script /usr/share/bpftrace/tools/runqlat.bt -vars usecs:hist

vars is a comma-separated list of bpftrace variable names (without @) and their type.

Supported bpftrace variable types

Type Description bpftrace example
(empty) scalar value @var = 5;
counter counter value @var = count();
map key/value map @var[pid] = 1;
countermap map with counter values @var[pid] = count();
hist histogram @var = hist(retval);
histmap keyed histogram @var[comm] = hist(retval);

Internals

On every scrape the bpftrace exporter sends a SIGUSR1 signal to the bpftrace process, which prints all bpftrace variables in JSON format to stdout. The exporter parses the output and emits metrics in the OpenMetrics format.

Related Projects

License

Apache License 2.0, see LICENSE.

About

Export variables from bpftrace scripts as metrics.

License:Apache License 2.0


Languages

Language:Go 98.4%Language:Makefile 1.6%