Skip to content

Commit a58e933

Browse files
authored
Expose additional BulkIngester metrics (#513)
1 parent b96dca4 commit a58e933

File tree

1 file changed

+36
-0
lines changed
  • java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk

1 file changed

+36
-0
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngester.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,31 @@ private BulkIngester(Builder<Context> builder) {
130130

131131
//----- Getters
132132

133+
/**
134+
* The configured max operations to buffer in a single bulk request.
135+
*/
133136
public int maxOperations() {
134137
return this.maxOperations;
135138
}
136139

140+
/**
141+
* The configured maximum size in bytes for a bulk request. Operations are added to the request until
142+
* adding an operation leads the request to exceed this siz.
143+
*/
137144
public long maxSize() {
138145
return this.maxSize;
139146
}
140147

148+
/**
149+
* The configured maximum number of concurrent request sent to Elasticsearch.
150+
*/
141151
public int maxConcurrentRequests() {
142152
return this.maxRequests;
143153
}
144154

155+
/**
156+
* The configured flush period.
157+
*/
145158
public Duration flushInterval() {
146159
if (this.flushIntervalMillis != null) {
147160
return Duration.ofMillis(flushIntervalMillis);
@@ -150,6 +163,29 @@ public Duration flushInterval() {
150163
}
151164
}
152165

166+
/**
167+
* The number of operations that have been buffered, waiting to be sent.
168+
*/
169+
public int pendingOperations() {
170+
List<BulkOperation> operations = this.operations;
171+
return operations == null ? 0 : operations.size();
172+
}
173+
174+
/**
175+
* The size in bytes of operations that have been buffered, waiting to be sent.
176+
*/
177+
public long pendingOperationsSize() {
178+
return this.currentSize;
179+
}
180+
181+
182+
/**
183+
* The number of in flight bulk requests.
184+
*/
185+
public int pendingRequests() {
186+
return this.requestsInFlightCount;
187+
}
188+
153189
//----- Statistics
154190

155191
/**

0 commit comments

Comments
 (0)