-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[receiver/httpcheck] refactor client length checking #31036
[receiver/httpcheck] refactor client length checking #31036
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.
thanks for the fixing the typo, please review & sign the CLA
@@ -46,12 +46,13 @@ func (h *httpcheckScraper) start(_ context.Context, host component.Host) (err er | |||
|
|||
// scrape connects to the endpoint and produces metrics based on the response | |||
func (h *httpcheckScraper) scrape(ctx context.Context) (pmetric.Metrics, error) { | |||
if h.clients == nil || len(h.clients) == 0 { |
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.
Is there a case where this change catches something that didn't used to be caught? If clients
is nil, it returns the error, if the length is 0, it returns the error.
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.
No, it's the same logic. The new change is to remove redundant checking. If a slice is nil then its length is also zero
9adf6ed
to
aaf8e9e
Compare
@codeboten can you review the PR again? Thanks |
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Description:
clentErr
) in receiver/httpcheckreceiver.Link to tracking Issue:
Testing:
Documentation: