-
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
x-pack/filebeat/input/httpjson: improve error logging #36529
Conversation
2b3532d
to
6a58256
Compare
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
This comment was marked as outdated.
This comment was marked as outdated.
* make errors relate to behaviour rather than implementation * remove duplicated wrapping * make use of textContextError for JSON decoding failures * improve consistency of error formatting and typography
6a58256
to
7ecfe2d
Compare
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 👍🏼
@@ -660,21 +663,21 @@ func (r *requester) processChainPaginationEvents(ctx context.Context, trCtx *tra | |||
// reformat urls of requestFactory using ids | |||
rf.url, err = generateNewUrl(rf.replace, urlString, id) | |||
if err != nil { | |||
return -1, fmt.Errorf("failed to generate new URL: %w", err) | |||
return -1, fmt.Errorf("failed to generate new url: %w", err) |
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.
The error message seems to be same as https://github.com/elastic/beats/pull/36529/files#diff-ffe24395246b343e8006e4eaef52c2d3bf68c20497ac96ef1e626d4351258047R155. Since this is specific for chain requests, should we change it to failed to generate new url for chain pagination request
? Ofcourse, we also have the line number inside the error trace. Just checking..
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.
I'll differentiate this. Thanks, I was trying to make them all searchably unique. Line numbers are OK, but error message strings are far more robust, and in this case the error is generated at a different site to where the log call will be made.
* make errors relate to behaviour rather than implementation * remove duplicated wrapping * make use of textContextError for JSON decoding failures * improve consistency of error formatting and typography
Proposed commit message
Improves the friendliness and utility of error logging in the HTTPJSON input by
textContextError
for JSON decoding failuresChecklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs