Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Varnish 3 #51

Merged
merged 4 commits into from
Oct 27, 2019
Merged

Varnish 3 #51

merged 4 commits into from
Oct 27, 2019

Conversation

glennslaven
Copy link
Contributor

Fixes an error when scraping metrics from Varnish 3:

varnish_main_bans label:<name:\"action\" value:\"gone\" > gauge:<value:1 > should be a Counter

Also adds a Prometheus gather test which replicates that error.

Resolves #50

The "gauge should be a Counter" error doesn't present until the Prometheus module attempts to gather the metrics for display (see https://github.com/prometheus/client_golang/blob/4efc3ccc7a660996803fff4721a2643b33dc3f77/prometheus/registry.go#L610).

This test runs through the test varnishstat files and collects them into a Prometheus registry and then calls `Gather()` to ensure there are no errors.
This is no longer used in Varnish 4+ as the metric was renamed to `n_bans` rather than `n_ban`. And in Varnish 3 it breaks as the `n_ban` and `n_ban_gone` are `i` (Integer) flags while all the other `n_ban*` metrics are `a` (Accumulator) flags. (See https://github.com/varnishcache/varnish-cache/blob/3.0/include/vsc_fields.h#L142-L148)
@jonnenauha
Copy link
Owner

Your PR is included in the 1.5.2 release, thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants