From 139b38b63043658bd8051ba5c9659fac57d9b94e Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Mon, 13 Feb 2023 19:39:54 +0100 Subject: [PATCH] Expose additional BulkIngester metrics (#513) --- .../_helpers/bulk/BulkIngester.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngester.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngester.java index 08790f144..74d843c3e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngester.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_helpers/bulk/BulkIngester.java @@ -130,18 +130,31 @@ private BulkIngester(Builder builder) { //----- Getters + /** + * The configured max operations to buffer in a single bulk request. + */ public int maxOperations() { return this.maxOperations; } + /** + * The configured maximum size in bytes for a bulk request. Operations are added to the request until + * adding an operation leads the request to exceed this siz. + */ public long maxSize() { return this.maxSize; } + /** + * The configured maximum number of concurrent request sent to Elasticsearch. + */ public int maxConcurrentRequests() { return this.maxRequests; } + /** + * The configured flush period. + */ public Duration flushInterval() { if (this.flushIntervalMillis != null) { return Duration.ofMillis(flushIntervalMillis); @@ -150,6 +163,29 @@ public Duration flushInterval() { } } + /** + * The number of operations that have been buffered, waiting to be sent. + */ + public int pendingOperations() { + List operations = this.operations; + return operations == null ? 0 : operations.size(); + } + + /** + * The size in bytes of operations that have been buffered, waiting to be sent. + */ + public long pendingOperationsSize() { + return this.currentSize; + } + + + /** + * The number of in flight bulk requests. + */ + public int pendingRequests() { + return this.requestsInFlightCount; + } + //----- Statistics /**