Skip to content
Open
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public class Elasticsearch8AsyncWriter<InputT> extends AsyncSinkWriter<InputT, O
/** A counter to track the number of bulk requests that are sent to Elasticsearch. */
private final Counter numRequestSubmittedCounter;

private final OperationSerializer operationSerializer;

private static final FatalExceptionClassifier ELASTICSEARCH_FATAL_EXCEPTION_CLASSIFIER =
FatalExceptionClassifier.createChain(
new FatalExceptionClassifier(
Expand Down Expand Up @@ -112,6 +114,7 @@ public Elasticsearch8AsyncWriter(
this.numRecordsSendPartialFailureCounter =
metricGroup.counter("numRecordsSendPartialFailure");
this.numRequestSubmittedCounter = metricGroup.counter("numRequestSubmitted");
this.operationSerializer = new OperationSerializer();
}

@Override
Expand Down Expand Up @@ -192,7 +195,7 @@ private boolean isRetryable(Throwable error) {

@Override
protected long getSizeInBytes(Operation requestEntry) {
return new OperationSerializer().size(requestEntry);
return operationSerializer.size(requestEntry);
}

@Override
Expand Down