0

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 alignement 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 forumula and the explanation.

Thanks a lot for your help.

user1403505
  • 895
  • 2
  • 19
  • 42
  • Does the value "114kib" change if you change the time selector in top of the graph (for example, select "6h") – guillaume blaquiere Aug 06 '20 at 12:16
  • yes it changes according to the week or day or hour – user1403505 Aug 06 '20 at 13:16
  • can anyone please provide me with a numeric example, i am not exactly understanding the documentation of google and the formulae it uses and I need to understand the difference in formulae between ALIGN_MEAN and ALIGN_SUM – user1403505 Aug 06 '20 at 14:47

2 Answers2

1

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 "aligment sum" should grow of 60Mib per day, the "aligment mean" should be flat around 60Mib (at month view)

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
  • How is the sum calculated, i got the value as 63 MB as sum for the day, which is for 24 hours, does it calculate for 24 hours as a whole, or does it sum up for every minute and the final value becomes 63 MB? Also the mean is 114.526 KB, by mean is it the average for that day, does it mean 63MB/24 Hours or something like that? If i try that still I am not getting 114.526 KB or anything close to that – user1403505 Aug 07 '20 at 08:05
  • 1
    It's an alignment period. A value is taken during the last 24h (the closest to the D-date, I don't know which it is. Maybe midnight, but I don't know in which timezone), and this value is "aligned" on 24h, I meen take into account for the value of the day. If you look at your VM, you should have 63Mib free on your server, right? – guillaume blaquiere Aug 07 '20 at 11:03
  • 1
    For the mean, it's not calculated over 24h, or 1440 minutes, it's calculated according with your graph display on the page, the number of relevant datapoint that you can have on your graph to have a smooth curve. Try to resize your window, this mean value should change! – guillaume blaquiere Aug 07 '20 at 11:06
0

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

Carlo C.
  • 79
  • 8
  • I have gone through this documentation before. I did not understand how it is calculated and what is the formulae, if any numeric example is there it would be useful for me to understand. Thanks – user1403505 Aug 06 '20 at 14:35
  • Well, I found on the Python example [1] that you can see some of the Math operation being done. I think that Guillaume’s answer is also quite good. [1] https://cloud.google.com/monitoring/custom-metrics/reading-metrics#monitoring_read_timeseries_simple-python – Carlo C. Aug 07 '20 at 13:39