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

Clean up / document metrics monitor fields #39413

Merged
merged 18 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions libbeat/esleg/eslegclient/bulkapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"encoding/json"
"errors"
"io"
"io/ioutil"

Check failure on line 26 in libbeat/esleg/eslegclient/bulkapi.go

View workflow job for this annotation

GitHub Actions / lint (windows)

SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
"net/http"
"strings"

Expand Down Expand Up @@ -60,16 +60,16 @@
requ *http.Request
}

// BulkResult contains the result of a bulk API request.
type BulkResult json.RawMessage
// BulkResponse contains the result of a bulk API request.
type BulkResponse json.RawMessage

// Bulk performs many index/delete operations in a single API call.
// Implements: http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
func (conn *Connection) Bulk(
ctx context.Context,
index, docType string,
params map[string]string, body []interface{},
) (int, BulkResult, error) {
) (int, BulkResponse, error) {
if len(body) == 0 {
return 0, nil, nil
}
Expand Down Expand Up @@ -160,9 +160,9 @@
body.AddHeader(&r.requ.Header)
}

func (conn *Connection) sendBulkRequest(requ *bulkRequest) (int, BulkResult, error) {
func (conn *Connection) sendBulkRequest(requ *bulkRequest) (int, BulkResponse, error) {
status, resp, err := conn.execHTTPRequest(requ.requ)
return status, BulkResult(resp), err
return status, BulkResponse(resp), err
}

func bulkEncode(log *logp.Logger, out BulkWriter, body []interface{}) error {
Expand Down
2 changes: 1 addition & 1 deletion libbeat/monitoring/report/elasticsearch/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
meta["_type"] = "doc"
}

//nolint:typecheck // typecheck linter is buggy and thinks opType is unused.

Check failure on line 174 in libbeat/monitoring/report/elasticsearch/client.go

View workflow job for this annotation

GitHub Actions / lint (windows)

directive `//nolint:typecheck // typecheck linter is buggy and thinks opType is unused.` is unused for linter "typecheck" (nolintlint)
opType := events.OpTypeCreate
if esVersion.LessThan(createDocPrivAvailableESVersion) {
opType = events.OpTypeIndex
Expand Down Expand Up @@ -224,7 +224,7 @@
return fmt.Sprintf(".monitoring-beats-%v-%s", version, date)
}

func logBulkFailures(log *logp.Logger, result eslegclient.BulkResult, events []report.Event) {
func logBulkFailures(log *logp.Logger, result eslegclient.BulkResponse, events []report.Event) {
var response struct {
Items []map[string]map[string]interface{} `json:"items"`
}
Expand Down
4 changes: 2 additions & 2 deletions libbeat/outputs/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ func (c *console) Publish(_ context.Context, batch publisher.Batch) error {
c.writer.Flush()
batch.ACK()

st.Dropped(dropped)
st.Acked(len(events) - dropped)
st.PermanentErrors(dropped)
st.AckedEvents(len(events) - dropped)

return nil
}
Expand Down
2 changes: 1 addition & 1 deletion libbeat/outputs/discard/discard.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (out *discardOutput) Publish(_ context.Context, batch publisher.Batch) erro
st := out.observer
events := batch.Events()
st.NewBatch(len(events))
st.Acked(len(events))
st.AckedEvents(len(events))
return nil
}

Expand Down
Loading
Loading