aws-node-termination-handler icon indicating copy to clipboard operation
aws-node-termination-handler copied to clipboard

Metric counters don't report 0 to Prometheus

Open risinger opened this issue 3 years ago • 5 comments

NTH does not report 0 when a metric has not been observed during runtime. Prometheus expects counters to report 0 when they are 0. If they are simply not reported, rate will report 0 when the metric is first reported, no matter the value. Because the first value is an observation, any alerting or visualization in Prometheus will either miss all errors/actions in the first scrape that has that metric or the alert/graphing needs to use the raw total number of observations during an NTH pod's lifetime.

I realize this may well be a bug in OpenTelemetry, but it also seems possible the counters are not properly initialized in NTH.

Here's a grafana graph to visualize the problem (increase is syntactic sugar for rate times the range selector):

image

risinger avatar Feb 25 '21 16:02 risinger

From reading around, it looks like ideally we would initialize these metrics at the beginning when we set up the metrics server. We can do that for the error metrics, but the node metrics are trickier because they use labels with the node name which we don't know ahead of time.

Perhaps we can init the error metrics early, and for the node metrics do a lookup to see if they're initialized before the first increment?

haugenj avatar Mar 02 '21 15:03 haugenj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want this issue to never become stale, please ask a maintainer to apply the "stalebot-ignore" label.

github-actions[bot] avatar Oct 15 '21 17:10 github-actions[bot]

Bump here per @bwagner5's suggestion in slack

drstevens avatar Dec 01 '21 20:12 drstevens

@bwagner5 we're using the (rate(actions_node{job="aws-node-termination-handler",node_status!="success"}[5m])) query to trigger alerts and are getting our alerts replayed every 12 hours.

stevehipwell avatar Dec 15 '21 12:12 stevehipwell

@bwagner5 have you been able to look into this?

stevehipwell avatar Jan 05 '22 10:01 stevehipwell

This has been released in v1.20.0, chart version 0.22.0

cjerad avatar Jun 22 '23 15:06 cjerad