-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Collect Cloudwatch metrics from the same timestamp #11142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 UTC
for example forCPUUtilization
, then we need to collect the rest of the metrics from the same timestamp fromValues
array.FindTimestamp
function finds this timestamp andCheckTimestampInArray
function checks if input timestamp exists in array and if it exists, return the position. In this example,2019-03-08 19:57:00 +0000 UTC
exists in[2019-03-08 20:02:00 +0000 UTC,2019-03-08 19:57:00 +0000 UTC]
and position is1
.