-
Notifications
You must be signed in to change notification settings - Fork 14
Switch counter metrics to use cumulative or delta #18
Comments
^ @tam7t |
So I'm understanding correctly, you're wanting to create an alert on rate-of-change of a counter metric and it looks like that is not possible when the counter is actually a GAUGE metric? |
Not only alert on deltas but primarily draw charts with deltas. As far as I can see one can use delta as an Aligner but only delta and cumulative are supported. Imagine I want to count the number of function calls or the number of requests. I can either calculate request rate or function calls rate in code and expose it as a Gauge or I can use a cumulative counter and compute deltas in query time. The latter is a very common scenario. Many open source services expose cumulative values which are later converted to deltas by either metrics agents or monitoring tools by themselves. As far as I see Google Cloud Monitoring tool also gives me ability to calculate deltas but for sure it doesn't allow me doing it for gauges. Both ALIGN_DELTA and ALIGN_RATE mention this in the docs: I mean more or less this: #19 |
@tam7t any thoughts here? |
Hi! I just started using this package for some custom metrics and was very disappointed to find that counters are incorrectly created in stackdriver as gauges. To be clear, there is a |
What this library does for the Running the
Produces a graph like this: If we want to plot (or alert) on the rate of change of the counter we can use the following MQL:
Here we see a stead 1200/minute rate (which is consistent with running 2 instances of I'm honestly not sure why the GUI does not provide the
I can see the desire to switch the type to CUMULATIVE, as it appears that is how opentelemetry and other stackdriver built-in-counter metrics are reported - but I just want to demonstrate how to build alerts on the existing implementation. |
@tam7t Wow. Thank you. I think this solves most of the problems in fact. I ot an impression that one cannot use delta aligner for gauges. It seems I have to invest time to get familiar with MQL and use it instead of clicking through UI. |
Glad to hear that! Be aware that in my tests My strategy to find those queries was to use the UI to build the initial aggregation, then click the MQL button to see what the MQL looks like and edit from there. I think switching to |
@tam7t Thank you for all your support. Do you also have suggestions regarding time metrics sent by calling
|
When my process restarts I end up with huge negative spikes in the delta, as the value goes from some high number to some very low number. Is there anything I can do about that? |
It turns out that a counter metrics use a gauge metric type as here
This doesn't seem to be right. According to documentation of Aligner I am unable to calculate deltas if the metric is not defined as delta or cumulative. This is a big limitation. Should we consider switching to cumulative in case of counters?
The text was updated successfully, but these errors were encountered: