jonnenauha / prometheus_varnish_exporter

Varnish exporter for Prometheus
MIT License
177 stars 101 forks source link

Normalize counter names #42

Closed gquintard closed 1 year ago

gquintard commented 5 years ago

New varnish versions allows vmods to create custom counters and it's mandatory to normalize their names to avoid scaring the scraper.

This commit doesn't prevent collisions but there's only so much we can do.

jonnenauha commented 5 years ago

Could you give some details why you needed this change. It looks fine and I get it from the test cases, but I would just like to see real world scrape that outputs something we trip on, thanks.

gquintard commented 5 years ago

we got hit by this in the enterprise version because one of the vmods create counters containing a #. We have since then changed the vmod to avoid the issue, but since counter can be created by any vmod (e.g. https://github.com/xcir/libvmod-xcounter), it seems smarter to protect the exporter rather than to ask the vmod writer to watch their steps

mykhailoky1 commented 1 year ago

The example is Jun 28 08:17:32 name.84.example.net prometheus_varnish_exporter[29701]: panic: "varnish_main_accg_detailed_http_host_docker-repo_example_com_backend_304_count" is not a valid metric name

gquintard commented 1 year ago

timing this one out