-
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
Handle bulk request results in monitoring #14354
Handle bulk request results in monitoring #14354
Conversation
libbeat/outputs/elasticsearch/api.go
Outdated
return nil | ||
} | ||
|
||
type BulkResultItemInner struct { |
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.
exported type BulkResultItemInner should have comment or be unexported
libbeat/outputs/elasticsearch/api.go
Outdated
var ErrInvalidBulkOpType = errors.New("invalid bulk optype in bulk result item") | ||
var bulkOpTypes = map[string]bool{"create": true, "index": true, "update": true, "delete": true} | ||
|
||
func (b *BulkOpType) UnmarshalJSON(j []byte) 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.
exported method BulkOpType.UnmarshalJSON should have comment or be unexported
libbeat/outputs/elasticsearch/api.go
Outdated
// BulkOpType represents a valid bulk request op type | ||
type BulkOpType string | ||
|
||
var ErrInvalidBulkOpType = errors.New("invalid bulk optype in bulk result item") |
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.
exported var ErrInvalidBulkOpType should have comment or be unexported
|
||
var ErrInvalidBulkResultItem = errors.New("invalid bulk result item") | ||
|
||
func (b *BulkResultItem) UnmarshalJSON(j []byte) 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.
exported method BulkResultItem.UnmarshalJSON should have comment or be unexported
libbeat/outputs/elasticsearch/api.go
Outdated
Item BulkResultItemInner | ||
} | ||
|
||
var ErrInvalidBulkResultItem = errors.New("invalid bulk result item") |
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.
exported var ErrInvalidBulkResultItem should have comment or be unexported
e3909ac
to
a7cf5e4
Compare
|
||
type BulkItemErrorMsg string | ||
|
||
func (b *BulkItemErrorMsg) UnmarshalJSON(j []byte) 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.
exported method BulkItemErrorMsg.UnmarshalJSON should have comment or be unexported
Error BulkItemErrorMsg `json:"error"` | ||
} | ||
|
||
type BulkItemErrorMsg string |
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.
exported type BulkItemErrorMsg should have comment or be unexported
return nil | ||
} | ||
|
||
type BulkResultItemInner struct { |
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.
exported type BulkResultItemInner should have comment or be unexported
@@ -27,6 +27,11 @@ import ( | |||
"github.com/elastic/beats/libbeat/common" | |||
) | |||
|
|||
var ( | |||
ErrInvalidBulkResultItem = errors.New("invalid bulk result item") |
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.
exported var ErrInvalidBulkResultItem should have comment or be unexported
Replaced by #14356. |
This PR builds on top of #14353 so it has commits from there as well. Once #14353 is merged, I will rebase this PR on
master
so it only contains its own commits.Resolves #14340
As reported in #14303, when the Elasticsearch monitoring reporter in libbeat sends a bulk API request to Elasticsearch, and that request fails, the errors are currently swallowed. This is because the actual response code for the bulk API request is
200 OK
; the actual errors are embedded in the request's response body.This PR teaches the Elasticsearch monitoring reporter to parse the bulk API response and log any errors.