Skip to content

Commit

Permalink
fix(elasticsearch logging): log how long bulk execution took (#10116)
Browse files Browse the repository at this point in the history
  • Loading branch information
darnaut authored Mar 23, 2024
1 parent 93b5907 commit a0d952d
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,28 @@ public void beforeBulk(long executionId, BulkRequest request) {

@Override
public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
String ingestTook = "";
long ingestTookInMillis = response.getIngestTookInMillis();
if (ingestTookInMillis != BulkResponse.NO_INGEST_TOOK) {
ingestTook = " Bulk ingest preprocessing took time ms: " + ingestTookInMillis;
}

if (response.hasFailures()) {
log.error(
"Failed to feed bulk request. Number of events: "
+ response.getItems().length
+ " Took time ms: "
+ response.getIngestTookInMillis()
+ response.getTook().getMillis()
+ ingestTook
+ " Message: "
+ response.buildFailureMessage());
} else {
log.info(
"Successfully fed bulk request. Number of events: "
+ response.getItems().length
+ " Took time ms: "
+ response.getIngestTookInMillis());
+ response.getTook().getMillis()
+ ingestTook);
}
incrementMetrics(response);
}
Expand Down

0 comments on commit a0d952d

Please sign in to comment.