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:
- In advanced aggregation I selected the Aligner as mean and i got this value for the free category of memory 114.526 KiB
- In advanced aggregation I selected the Aligner as sum and i got this value for the free category of memory 63.750 Mib
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.


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