Bug 263262 - prometheus_sysctl_exporter doesn't distinguish between metric types
Summary: prometheus_sysctl_exporter doesn't distinguish between metric types
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 13.1-STABLE
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-13 17:25 UTC by Alan Somers
Modified: 2022-04-13 19:35 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2022-04-13 17:25:23 UTC
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.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2022-04-13 19:05:23 UTC
Does this apply to:

 - net-mgmt/prometheus1
 - net-mgmt/prometheus2
 - something else

?
Comment 2 Alan Somers freebsd_committer freebsd_triage 2022-04-13 19:35:34 UTC
(In reply to Mark Linimon from comment #1)
Both of those, I think.  It also applies if, as in my case, the Prometheus server is being run somewhere across the network, on a different OS.  I'm using Prometheus v 2.17.0 on the server, but AFAIK it applies to all versions.