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

Fix issue 57 - errors on VCL reload because of duplicated counters #69

Closed
wants to merge 2 commits into from
Closed

Fix issue 57 - errors on VCL reload because of duplicated counters #69

wants to merge 2 commits into from

Conversation

lorenzoperi-tomtom
Copy link

Fixes #57

Issue
The exporter fails when VCL is reloaded.
This happens because Varnish backend counters (VBE) are repeated for each reload with its timestamp:
Example: VBE.boot.default.happy and VBE.reload_20210114_155148_19902.default.happy
... thus generating duplicated metrics.

The -p vcl_cooldown=1 workaround is not good enough, because old counters are still present in varnishstat for some time (granularity is 30s, see https://varnish-cache.org/docs/6.5/reference/varnishd.html#vcl-cooldown).

The result is that on each reload the exporter keeps failing for some time (1m in my tests with -p vcl_cooldown=1, 10m without it).

Solution
I propose to consider only the counters with the most recent timestamp.
I quickly calculate the most recent timestamp by checking the ".happy" counters, then I filter out the outdated counters.
Should work for any Varnish version.
Tests included.

@lorenzoperi-tomtom lorenzoperi-tomtom changed the title Fix issue 57 - errors on VCL reload because of duplicated metrics Fix issue 57 - errors on VCL reload because of duplicated counters Jan 15, 2021
"format": "i",
"value": 0
},
"VBE.reload_20210114_160902_21476.default.happy": {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just duplicated the VBE metrics with 2 different timestamps to simulate 2 VCL reloads.
Tests fail without the fix.

@lorenzoperi-tomtom lorenzoperi-tomtom deleted the fix-issue-57 branch January 19, 2021 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant