Collect Cloudwatch metrics from the same timestamp#11142
Collect Cloudwatch metrics from the same timestamp#11142kaiyan-sheng merged 10 commits intoelastic:masterfrom kaiyan-sheng:ec2_reload
Conversation
ruflin
left a comment
There was a problem hiding this comment.
@kaiyan-sheng Left a few minor comments but thanks to your explanation today the code makes now much more sense. I kind of hope we could make it more readable moving forward but at the same time it's not too great what we get from Cloudwatch :-(
|
After #11151 get merged, I will push a commit up to adopt FindTimestamp method in SQS and S3 metricsets. When backporting to 7.0, only the changes related to ec2 will be cherrypicked. |
|
jenkins, test this please |
|
jenkins, test this please |
ruflin
left a comment
There was a problem hiding this comment.
LGTM
Comments can be addressed later.
| if len(output.Values) == 0 { | ||
| continue | ||
| } | ||
| exists, timestampIdx := aws.CheckTimestampInArray(timestamp, output.Timestamps) |
There was a problem hiding this comment.
Looks like this code is identical to the code in the s3 daily storage file? Perhaps later we can take it out.
| if len(output.Values) == 0 { | ||
| continue | ||
| } | ||
| exists, timestampIdx := aws.CheckTimestampInArray(timestamp, output.Timestamps) |
There was a problem hiding this comment.
One more time the same code? :-)
#11142) (#11236) * Collect Cloudwatch metrics from the same timestamp (#11142) * Update aws documentation * Add checks for instance fields in TestFetch * Add tests for CheckTimestampInArray and FindTimestamp * Update comment for CheckTimestampInArray * Change test to table driven * Adopt CheckTimestampInArray and FindTimestamp in S3 and SQS (cherry picked from commit 822b95a) * Backport changes for CheckEventField and compareType from e03f966
We are collecting data from
2019-03-08 19:57:00 +0000 UTCfor example forCPUUtilization, then we need to collect the rest of the metrics from the same timestamp fromValuesarray.FindTimestampfunction finds this timestamp andCheckTimestampInArrayfunction checks if input timestamp exists in array and if it exists, return the position. In this example,2019-03-08 19:57:00 +0000 UTCexists in[2019-03-08 20:02:00 +0000 UTC,2019-03-08 19:57:00 +0000 UTC]and position is1.