Skip to content
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

Closed

Conversation

ycombinator
Copy link
Contributor

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.

return nil
}

type BulkResultItemInner struct {

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

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 {

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

// BulkOpType represents a valid bulk request op type
type BulkOpType string

var ErrInvalidBulkOpType = errors.New("invalid bulk optype in bulk result item")

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 {

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

Item BulkResultItemInner
}

var ErrInvalidBulkResultItem = errors.New("invalid bulk result item")

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

@ycombinator ycombinator force-pushed the lb-mon-bulk-handle-results branch from e3909ac to a7cf5e4 Compare October 31, 2019 15:45

type BulkItemErrorMsg string

func (b *BulkItemErrorMsg) UnmarshalJSON(j []byte) error {

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

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 {

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")

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

@ycombinator
Copy link
Contributor Author

Replaced by #14356.

@ycombinator ycombinator deleted the lb-mon-bulk-handle-results branch October 31, 2019 18:35
@ycombinator ycombinator restored the lb-mon-bulk-handle-results branch October 31, 2019 18:35
@ycombinator ycombinator deleted the lb-mon-bulk-handle-results branch December 25, 2019 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants