Repository navigation
Conversation
Interface stats from pfSense are cumulative counters (from FreeBSD kernel), not point-in-time gauges. Switch from GaugeVec to prometheus.Desc + MustNewConstMetric with CounterValue to correctly expose the metric type. This also fixes a race condition when multiple targets are scraped concurrently. Update the Grafana dashboard to use rate() queries and add units (Bps, pps) to panels.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Interface byte, packet, error, and collision metrics are cumulative counters from the FreeBSD kernel (via
get_interface_info()), but were exposed as gauges. This changes the Prometheus metric type annotation from gauge to counter usingprometheus.Desc+MustNewConstMetricwithCounterValue. Metric names are unchanged so as to not cause breaking changes, but the names probably should be changed.This also fixes a race condition in the existing
GaugeVec+Reset()+Set()pattern when multiple targets are scraped concurrently, one goroutine'sReset()could wipe metrics while another ismid-Collect().MustNewConstMetriccreates ephemeral values per scrape, so there's no shared state to race on. See https://prometheus.io/docs/instrumenting/writing_exporters/#collectorsUpdates the Grafana dashboard to use
rate()queries, adds units to panels (Bps for bytes, pps for packets), and setstooltips to show all series.
interface_upremains a gauge.