clarification regarding difference between ALIGN_MEAN and ALIGN_SUM in google cloud metric explorer

1.7k views Asked by At

I am collecting metrics related to memory using api compute.googleapis.com/guest/memory/bytes_used from google cloud metric explorer. I selected a particular instanceid and I set the alignment period to 1 day. so that I will get the metrics for 1 day. For the same alignment period:

  1. In advanced aggregation I selected the Aligner as mean and i got this value for the free category of memory 114.526 KiB

First Time

  1. In advanced aggregation I selected the Aligner as sum and i got this value for the free category of memory 63.750 Mib

enter image description here

I am not understanding the formulae, on how this align_mean and align sum is calculated. I have set the alignment period to 1 day. Can anyone give me the formula and the explanation.

2

There are 2 answers

2
Carlo C. On

We can read about difference ALIGN_MEAN and ALIGN_SUM in this GCP documentation [1]:

ALIGN_MEAN: Align the time series by returning the mean value in each alignment period. This aligner is valid for GAUGE and DELTA metrics with numeric values. The valueType of the aligned result is DOUBLE.

ALIGN_SUM: Align the time series by returning the sum of the values in each alignment period. This aligner is valid for GAUGE and DELTA metrics with numeric and distribution values. The valueType of the aligned result is the same as the valueType of the input.

I would also like to share this other document [2].

Best Wishes!

[1] https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.alertPolicies#aligner

[2] https://cloud.google.com/monitoring/charts/metrics-selector#alignment

3
guillaume blaquiere On

It's only a graphical representation. You choose an alignment period of 1 day. So you have 1 value per day.

If you look the graph on 1 day, for the sum, you have 1 value, equal to 63Mib. I think that the line slightly go down because the day before the value is slightly higher.

Now, if you take the same value, but you say: I want to see the mean value during the day. You have 1 value per day, 63Mib, so the graph show you an interpolation of the mean per hours/minutes. If you change the timeframe, the line change. Even if you change the size of your screen it could change!!

Go to the Week or the Month timeframe view. The "alignment sum" should grow of 60Mib per day, the "alignment mean" should be flat around 60Mib (at month view)