Skip to content

Commit

Permalink
fix(elasticsearch logging): log how long bulk execution took (datahub…
Browse files Browse the repository at this point in the history
  • Loading branch information
darnaut authored and sleeperdeep committed Jun 25, 2024
1 parent caeb685 commit 608a274
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 608a274

Please sign in to comment.