googleinterns / cloud-operations-api-mock

Apache License 2.0
5 stars 2 forks source link

Add checks for rate limit, compare against previous point #43

Closed the-ericwang35 closed 4 years ago

the-ericwang35 commented 4 years ago

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: