You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "ng-galien (via GitHub)" <gi...@apache.org> on 2026/04/17 11:53:45 UTC

[PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

ng-galien opened a new pull request, #25548:
URL: https://github.com/apache/pulsar/pull/25548

   Fixes #25540
   
   ### Motivation
   
   When the number of individually deleted message ranges in a cursor exceeds `managedLedgerMaxUnackedRangesToPersist` (default 10 000), or the number of batch deleted indexes exceeds `managedLedgerMaxBatchDeletedIndexToPersist` (default 10 000), the excess ack state is silently truncated during cursor persistence. On broker restart, those acks are lost and already-acknowledged messages are redelivered.
   
   Today there is no signal when this crossing happens. The only way to detect it is to actively monitor `totalNonContiguousDeletedMessagesRange` via the Admin API or Prometheus and compare it manually to the configured limit. Issue #25540 and the maintainer's follow-up comments describe the concrete impact (consumer saturation after restart, compounding redeliveries) and ask for both a log and a broker-level metric.
   
   ### Modifications
   
   **Feature (commit 1) — warn and emit metric on overflow:**
   
   - `ManagedCursorImpl.buildIndividualDeletedMessageRanges()` and `buildBatchEntryDeletionIndexInfoList()` emit a `WARN` log exactly once per crossing (edge-detected via an `AtomicBoolean`), including tuning advice: `managedLedgerMaxUnackedRangesToPersist`, `managedLedgerMaxBatchDeletedIndexToPersist`, `managedLedgerPersistIndividualAckAsLongArray`, `managedCursorInfoCompressionType`.
   - Two broker-level OpenTelemetry counters are incremented on every truncated persist (no topic-level attributes, so no cardinality growth):
     - `pulsar.broker.managed_ledger.cursor.persist.overflow.range.count`
     - `pulsar.broker.managed_ledger.cursor.persist.overflow.batch.index.count`
   - `conf/broker.conf` documents both signals next to the corresponding settings, so operators discover them while tuning the limits.
   - The overflow signal is derived from iteration state already computed, avoiding an `O(N)` `size()` call on the hot path. The exact range count is only read on the first crossing (guarded by the edge detector), so precise log context costs nothing on subsequent persists.
   
   **Incidental fix (commit 2) — off-by-one in the ranges cap:**
   
   While writing a reload-based regression test for the new warning, `buildIndividualDeletedMessageRanges` turned out to persist `maxRanges + 1` entries rather than `maxRanges`. The `forEach` callback used to append each range and then return `rangeList.size() <= maxRanges`, keeping iteration alive until one extra entry had been added. The regression dates back to #3819 (2019), when the original `stream().limit(N)` was translated to the `forEach` callback without preserving the strict cap; #18357 later migrated to `forEachRawRange` and carried the bug forward. The sibling `buildBatchEntryDeletionIndexInfoList` has always used the correct check-before-add pattern.
   
   Beyond the obvious "config says 10 000, runtime persists 10 001" contract violation, the off-by-one would cause the new WARN log and counter to fire spuriously when `totalRanges == maxRanges + 1`: the list actually contained every range (no truncation), but the old `rangeList.size() > maxRanges` check reported "overflow". Shipping the new signal without this fix would undermine the operator trust we are trying to build.
   
   The fix restructures the callback into a check-before-add shape symmetric with `buildBatchEntryDeletionIndexInfoList`, using a `MutableBoolean` as the overflow flag. `MutableBoolean` is preferred over `AtomicBoolean` because the method runs under the cursor write lock — no concurrent readers — and the codebase already uses `MutableBoolean` in this file (e.g. `readEntries` around line 2219) for the same purpose. The change preserves the zero-`Range<T>`-allocation benefit introduced in #18357.
   
   ### Verifying this change
   
   This change added tests and can be verified as follows:
   
   - `ManagedCursorTest.testPersistOverflowRangesCounter` (parameterized over overflow / no-overflow / exact-limit cases): asserts that the OTel counter direction matches the scenario, and in the overflow case reopens the ledger after close and verifies exactly `maxRanges` entries are recovered — this second assertion is the regression guard for the off-by-one fix. It fails on the unpatched cursor (`expected 5 but found 6`) and passes with the fix.
   - `ManagedCursorTest.testPersistOverflowBatchIndexesCounter` (parameterized similarly): asserts the batch-index counter direction under overflow, no-overflow and exact-limit scenarios. No cap assertion needed here because the batch variant always used the correct pattern.
   - Counter assertions are bounded to a boolean direction (not exact counts) because the number of persist cycles triggered during `ledger.close()` is an internal cadence that we should not bind the test to.
   
   ### Does this pull request potentially affect one of the following parts:
   
   - [x] The metrics — adds two broker-level OTel counters (documented in `broker.conf` and described above).
   
   Other items: not affected. No API/schema/protocol changes, no default config changes, no threading model change (write-lock semantics preserved).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "ng-galien (via GitHub)" <gi...@apache.org>.
ng-galien commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3109892493


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }
+
+    public void incrementPersistBatchDeletedIndexesTruncated(String managedLedger, String cursor) {
+        persistBatchDeletedIndexesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }

Review Comment:
   done



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3388,11 +3398,33 @@ private List<MessageRange> buildIndividualDeletedMessageRanges() {
                 acksSerializedSize.addAndGet(messageRange.getSerializedSize());
                 rangeList.add(messageRange);
 
-                return rangeList.size() <= getConfig().getMaxUnackedRangesToPersist();
+                return true;
             });
 
             this.individualDeletedMessagesSerializedSize = acksSerializedSize.get();
             individualDeletedMessages.resetDirtyKeys();
+
+            if (truncated.booleanValue()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats()
+                        .incrementPersistUnackedRangesTruncated(ledger.getName(), name);

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3101426081


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -55,6 +56,16 @@ public class OpenTelemetryManagedCursorStats implements AutoCloseable {
     public static final String INCOMING_BYTE_COUNTER = "pulsar.broker.managed_ledger.cursor.incoming.size";
     private final ObservableLongMeasurement incomingByteCounter;
 
+    // Broker-level counters incremented when cursor persistence silently truncates ack state.
+    // See managedLedgerMaxUnackedRangesToPersist and managedLedgerMaxBatchDeletedIndexToPersist.
+    public static final String PERSIST_OVERFLOW_RANGES_COUNTER =
+            "pulsar.broker.managed_ledger.cursor.persist.overflow.range.count";

Review Comment:
   ```suggestion
       public static final String PERSIST_UNACKED_RANGES_TRUNCATED =
               "pulsar.broker.managed_ledger.cursor.persist.unacked_ranges.truncated";
   ```
   Changing the concept from "overflow" to persisting unacked ranges being truncated would improve the clarity of the counter.



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -55,6 +56,16 @@ public class OpenTelemetryManagedCursorStats implements AutoCloseable {
     public static final String INCOMING_BYTE_COUNTER = "pulsar.broker.managed_ledger.cursor.incoming.size";
     private final ObservableLongMeasurement incomingByteCounter;
 
+    // Broker-level counters incremented when cursor persistence silently truncates ack state.
+    // See managedLedgerMaxUnackedRangesToPersist and managedLedgerMaxBatchDeletedIndexToPersist.
+    public static final String PERSIST_OVERFLOW_RANGES_COUNTER =
+            "pulsar.broker.managed_ledger.cursor.persist.overflow.range.count";
+    private final LongCounter persistOverflowRangesCounter;

Review Comment:
   make the field name match the "truncated" concept.



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3388,11 +3398,32 @@ private List<MessageRange> buildIndividualDeletedMessageRanges() {
                 acksSerializedSize.addAndGet(messageRange.getSerializedSize());
                 rangeList.add(messageRange);
 
-                return rangeList.size() <= getConfig().getMaxUnackedRangesToPersist();
+                return true;
             });
 
             this.individualDeletedMessagesSerializedSize = acksSerializedSize.get();
             individualDeletedMessages.resetDirtyKeys();
+
+            if (overflowed.booleanValue()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats().incrementPersistOverflowRanges();
+                if (lastCursorDataFullyPersistable.compareAndSet(true, false)) {
+                    int totalRanges = individualDeletedMessages.size();
+                    log.warn()

Review Comment:
   add attributes for the managed ledger name and cursor name. "managedLedger" and "cursor" as attribute names.



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -55,6 +56,16 @@ public class OpenTelemetryManagedCursorStats implements AutoCloseable {
     public static final String INCOMING_BYTE_COUNTER = "pulsar.broker.managed_ledger.cursor.incoming.size";
     private final ObservableLongMeasurement incomingByteCounter;
 
+    // Broker-level counters incremented when cursor persistence silently truncates ack state.
+    // See managedLedgerMaxUnackedRangesToPersist and managedLedgerMaxBatchDeletedIndexToPersist.
+    public static final String PERSIST_OVERFLOW_RANGES_COUNTER =
+            "pulsar.broker.managed_ledger.cursor.persist.overflow.range.count";
+    private final LongCounter persistOverflowRangesCounter;
+
+    public static final String PERSIST_OVERFLOW_BATCH_INDEXES_COUNTER =
+            "pulsar.broker.managed_ledger.cursor.persist.overflow.batch.index.count";

Review Comment:
   ```suggestion
       public static final String PERSIST_BATCH_DELETED_INDEXES_TRUNCATED =
               "pulsar.broker.managed_ledger.cursor.persist.batch_deleted_indexes.truncated";
   ```
   Similar motivation for the change here, improving the clarity.



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -96,6 +107,22 @@ public OpenTelemetryManagedCursorStats(OpenTelemetry openTelemetry, ManagedLedge
                 .setDescription("The total amount of data read from the ledger.")
                 .buildObserver();
 
+        persistOverflowRangesCounter = meter
+                .counterBuilder(PERSIST_OVERFLOW_RANGES_COUNTER)
+                .setUnit("{overflow}")

Review Comment:
   ```suggestion
                   .setUnit("{truncation}")
   ```



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -96,6 +107,22 @@ public OpenTelemetryManagedCursorStats(OpenTelemetry openTelemetry, ManagedLedge
                 .setDescription("The total amount of data read from the ledger.")
                 .buildObserver();
 
+        persistOverflowRangesCounter = meter
+                .counterBuilder(PERSIST_OVERFLOW_RANGES_COUNTER)
+                .setUnit("{overflow}")
+                .setDescription("The number of times a cursor exceeded"
+                        + " managedLedgerMaxUnackedRangesToPersist, causing ack state to be truncated"
+                        + " at persistence. Ack state beyond the limit is lost on broker restart.")
+                .build();
+
+        persistOverflowBatchIndexesCounter = meter
+                .counterBuilder(PERSIST_OVERFLOW_BATCH_INDEXES_COUNTER)
+                .setUnit("{overflow}")

Review Comment:
   ```suggestion
                   .setUnit("{truncation}")
   ```



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3419,6 +3451,26 @@ private List<BatchedEntryDeletionIndexInfo> buildBatchEntryDeletionIndexInfoList
                 }
                 result.add(batchDeletedIndexInfo);
             }
+
+            if (iterator.hasNext()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats().incrementPersistOverflowBatchIndexes();
+                if (lastBatchDeletedIndexFullyPersistable.compareAndSet(true, false)) {
+                    int totalIndexes = batchDeletedIndexes.size();
+                    log.warn()
+                        .attr("totalIndexes", totalIndexes)

Review Comment:
   add attributes for the managed ledger name and cursor name. "managedLedger" and "cursor" as attribute names.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3109181155


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }
+
+    public void incrementPersistBatchDeletedIndexesTruncated(String managedLedger, String cursor) {
+        persistBatchDeletedIndexesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));

Review Comment:
   for attributes, pass `managedCursorAttributes.getAttributes()` from ManagedCursorImpl



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }

Review Comment:
   The attributes are already available:
   
   ```suggestion
       public void incrementPersistUnackedRangesTruncated(ManagedCursor cursor) {
           persistUnackedRangesTruncated.add(1, cursor.getManagedCursorAttributes().getAttributes());
       }
   ```



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }
+
+    public void incrementPersistBatchDeletedIndexesTruncated(String managedLedger, String cursor) {
+        persistBatchDeletedIndexesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }

Review Comment:
   The attributes are already available:
   
   ```suggestion
       public void incrementPersistBatchDeletedIndexesTruncated(ManagedCursor cursor) {
           persistBatchDeletedIndexesTruncated.add(1, cursor.getManagedCursorAttributes().getAttributes());
       }
   ```



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3388,11 +3398,33 @@ private List<MessageRange> buildIndividualDeletedMessageRanges() {
                 acksSerializedSize.addAndGet(messageRange.getSerializedSize());
                 rangeList.add(messageRange);
 
-                return rangeList.size() <= getConfig().getMaxUnackedRangesToPersist();
+                return true;
             });
 
             this.individualDeletedMessagesSerializedSize = acksSerializedSize.get();
             individualDeletedMessages.resetDirtyKeys();
+
+            if (truncated.booleanValue()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats()
+                        .incrementPersistUnackedRangesTruncated(ledger.getName(), name);

Review Comment:
   ```suggestion
                           .incrementPersistUnackedRangesTruncated(this);
   ```



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3419,6 +3452,27 @@ private List<BatchedEntryDeletionIndexInfo> buildBatchEntryDeletionIndexInfoList
                 }
                 result.add(batchDeletedIndexInfo);
             }
+
+            if (iterator.hasNext()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats()
+                        .incrementPersistBatchDeletedIndexesTruncated(ledger.getName(), name);

Review Comment:
   ```suggestion
                           .incrementPersistBatchDeletedIndexesTruncated(this);
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari merged PR #25548:
URL: https://github.com/apache/pulsar/pull/25548


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "ng-galien (via GitHub)" <gi...@apache.org>.
ng-galien commented on PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#issuecomment-4273183396

   Hi @lhotari, thanks for your review. Semantic is aligned with truncate and telemetry is more precise as you suggest.
   I've just noticed the logger already have ledger and cursor name at constructor level.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3104830564


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3388,11 +3398,32 @@ private List<MessageRange> buildIndividualDeletedMessageRanges() {
                 acksSerializedSize.addAndGet(messageRange.getSerializedSize());
                 rangeList.add(messageRange);
 
-                return rangeList.size() <= getConfig().getMaxUnackedRangesToPersist();
+                return true;
             });
 
             this.individualDeletedMessagesSerializedSize = acksSerializedSize.get();
             individualDeletedMessages.resetDirtyKeys();
+
+            if (overflowed.booleanValue()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats().incrementPersistOverflowRanges();
+                if (lastCursorDataFullyPersistable.compareAndSet(true, false)) {
+                    int totalRanges = individualDeletedMessages.size();
+                    log.warn()

Review Comment:
   yes, I missed that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "ng-galien (via GitHub)" <gi...@apache.org>.
ng-galien commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3104824791


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java:
##########
@@ -3388,11 +3398,32 @@ private List<MessageRange> buildIndividualDeletedMessageRanges() {
                 acksSerializedSize.addAndGet(messageRange.getSerializedSize());
                 rangeList.add(messageRange);
 
-                return rangeList.size() <= getConfig().getMaxUnackedRangesToPersist();
+                return true;
             });
 
             this.individualDeletedMessagesSerializedSize = acksSerializedSize.get();
             individualDeletedMessages.resetDirtyKeys();
+
+            if (overflowed.booleanValue()) {
+                ledger.getFactory().getOpenTelemetryManagedCursorStats().incrementPersistOverflowRanges();
+                if (lastCursorDataFullyPersistable.compareAndSet(true, false)) {
+                    int totalRanges = individualDeletedMessages.size();
+                    log.warn()

Review Comment:
   Ledger and cursor name are un the log constructor, is it sufficient?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "ng-galien (via GitHub)" <gi...@apache.org>.
ng-galien commented on PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#issuecomment-4273224947

   @lhotari `managed-ledger:checkstyleTest` and and `managed-ledger:test` are now green on side, my bad. 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [improve][ml] Warn and emit metric when cursor ack state exceeds persist limits [pulsar]

Posted by "ng-galien (via GitHub)" <gi...@apache.org>.
ng-galien commented on code in PR #25548:
URL: https://github.com/apache/pulsar/pull/25548#discussion_r3109890974


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }
+
+    public void incrementPersistBatchDeletedIndexesTruncated(String managedLedger, String cursor) {
+        persistBatchDeletedIndexesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));

Review Comment:
   done



##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpenTelemetryManagedCursorStats.java:
##########
@@ -115,6 +144,18 @@ public void close() {
         batchCallback.close();
     }
 
+    public void incrementPersistUnackedRangesTruncated(String managedLedger, String cursor) {
+        persistUnackedRangesTruncated.add(1, Attributes.of(
+                AttributeKey.stringKey("managedLedger"), managedLedger,
+                AttributeKey.stringKey("cursor"), cursor));
+    }

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org