-
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
Check return from report.Event and migrate to use ReportingMetricSetV2Error #11775
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.
this is looking good but I would want a review from @fearful-symmetry or @ruflin who have been involved in the refactor
This looks good, as the added logging/reporting steps only happen inside a loop with |
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.
If r.Event
returns false doesn't mean that there was an error. This is just an indication that the module is being stopped, so no more processing is needed. We shouldn't generate errors in that case, just stop doing anymore requests if anything.
report.Event(event) | ||
|
||
if reported := report.Event(event); !reported { | ||
return errors.Wrap(err, "Error trying to emit event") |
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.
This is not an error, this is expected to happen. It only means that the module is being stopped. We interrupt the loop to avoid doing more requests or processing that are not going to be used.
Just log something at the debug level (or nothing at all), and return nil.
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.
Thanks @jsoriano for the explanation!
|
||
moduleConfig := aws.Config{} | ||
if err := base.Module().UnpackConfig(&moduleConfig); err != nil { | ||
return nil, err | ||
} | ||
|
||
if moduleConfig.Period == "" { |
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.
How is this change related?
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.
Not related. Sorry forgot to update on the PR . This check is not needed here because it's already done in aws.NewMetricSet(base)
in line 60.
|
||
moduleConfig := aws.Config{} | ||
if err := base.Module().UnpackConfig(&moduleConfig); err != nil { | ||
return nil, err | ||
} | ||
|
||
if moduleConfig.Period == "" { |
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.
See above.
Instead of ignoring the return from report.Error, we should actually check the return to see if report event succeed or not. Please see #11666 for more details on this. Thanks @fearful-symmetry to bring this up.
This PR also removes
moduleConfig.Period
check in s3 metricset code because it's already done inNewMetricSet
in aws.go.