Skip to content

core, metrics, p2p: switch some invalid counters to gauges #20047

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

Merged
merged 1 commit into from
Sep 10, 2019

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Sep 10, 2019

I've added a lot of metrics to Influx/Grafana and saw that some charts started going into negative numbers (like peer counts). After digging into them, the issue is that we kind of interchangeably used counters and gauges in our code, mainly because counters had "useful" Inc() and Dec() ops.

Turns out that this is a big no-no, as time series databases and charting libs use and visualize counters completely differently than gauges. Gauges are allowed to go up and down, but counters should only be ever incremented (the go-metrics library API completely misses this point by having a Dec() op on a counter).

Long story short, the reason we didn't see this issue with Prometheus/Grafana was because the Prometheus reporting actually reported counters as gauges (ha-ha, should fix that).

This PR extends go-metrics with Inc and Dec ops on gauges, and replaces all our faulty-counters with actual gagues. Charts look ok with them.

@karalabe karalabe added this to the 1.9.4 milestone Sep 10, 2019
@karalabe karalabe requested a review from holiman September 10, 2019 11:50
Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

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

LGTM

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

Successfully merging this pull request may close these issues.

2 participants