[Bug 263262] prometheus_sysctl_exporter doesn't distinguish between metric types

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 13 Apr 2022 17:25:23 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263262

            Bug ID: 263262
           Summary: prometheus_sysctl_exporter doesn't distinguish between
                    metric types
           Product: Base System
           Version: 13.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

Prometheus recognizes four fundamental metric types: Counter, Gauge, Histogram,
and Summary.  There are sysctls that correspond to at least three of those:

kstat.zfs.<POOL>.misc.dmu_tx_assign: histogram
kstat.zfs.dmu_tx.dmu_tx_dirty_over_max: counter
vfs.zfs.arc.max: gauge

By default Prometheus assumes that all metrics are of type Gauge unless the
exporter says otherwise.  So sysctls that are really counters (like
dmu_tx_dirty_over_max) can't properly be queried in Grafana.  Presumably the
histogram type can't either, but I haven't tried with any of those.

The exporter ought to publish the metric type, like this:

# HELP sysctl_foo_bar description of foo.bar
# TYPE sysctl_foo_bar counter
sysctl_foo_bar 12345

I'm not sure how to fix this.  It might require adding additional information
to sysctl(3) itself.

-- 
You are receiving this mail because:
You are the assignee for the bug.