Finishing up the validation for CreateTimeSeries (continuing from this PR). Specifically, this PR implements the validations that rely on comparison with previous points (see here and here for the specific documentation).
To do this, this PR uses a map that maps {TimeSeries: last point received for that time series}. Time series are unique based on a unique combination of metric type, metric labels, monitored resource type and monitored resource labels. Since Go doesn't allow structs as keys of maps, we will have to serialize these fields into one long string to use as the map's key. The validations this PR adds are the following:
A rate limit of at most one point every 10 seconds for a given TimeSeries
If the metric type is CUMULATIVE, following points must have the same start time and increasing end times
If the metric type is GAUGE, the point must have the same start and end times
Time series must be unique based on a unique combination of metric type and labels, and monitored resource and labels
Finishing up the validation for
CreateTimeSeries
(continuing from this PR). Specifically, this PR implements the validations that rely on comparison with previous points (see here and here for the specific documentation).To do this, this PR uses a map that maps
{TimeSeries: last point received for that time series}
. Time series are unique based on a unique combination of metric type, metric labels, monitored resource type and monitored resource labels. Since Go doesn't allow structs as keys of maps, we will have to serialize these fields into one long string to use as the map's key. The validations this PR adds are the following:CUMULATIVE
, following points must have the same start time and increasing end timesGAUGE
, the point must have the same start and end times