ari icon indicating copy to clipboard operation
ari copied to clipboard

Prometheus metrics

Open sheenobu opened this issue 8 years ago • 3 comments

Add prometheus metrics to the various parts of the ARI codebase.

sheenobu avatar Sep 19 '16 03:09 sheenobu

A big thing is tracking when timeouts occur for #29

sheenobu avatar Sep 20 '16 09:09 sheenobu

For the metrics that are simply counters of "how many times we did this", and that have the ability to fail or succeed, let's treat them as CounterVecs using labels for Success vs Fail.

To keep the code clean, I'd like to move as much of the metric decision-making out of the ari work function. A simple Success/Fail would work this way:

At the point we want to record the metric, call a function that'll handle the decision-making for us

metricYesNo( "metricName", err )

The metricsYesNo() function then does any testing to determine the appropriate labeling, and logs the metric event:

if ( err != nil )
    increment "metricName" using label "Fail"
else
    increment "metricName" using label "Success"

SharonAllsup avatar Sep 20 '16 18:09 SharonAllsup

Note to myself - need to look into mapping the destination metric to string.

And, since I'm using a string rather than hard-coded metric name like before, if it's trying to update a metric that doesn't exist, should we report it or simply debug or ?

SharonAllsup avatar Sep 20 '16 20:09 SharonAllsup