Skip to content

Commit

Permalink
Add metrics for nonContiguousDeletedMessagesRange (apache#10638)
Browse files Browse the repository at this point in the history
### Motivation

Users want a metric for this value from the internal-stats call.

### Modifications

Add metrics for the ManagedCursor:

metrics.put("brk_ml_cursor_nonContiguousDeletedMessagesRange", 
(long) cursor.getTotalNonContiguousDeletedMessagesRange());

Modify test:

Assert.assertEquals(metricsList.get(0).getMetrics().get("brk_ml_cursor_nonContiguousDeletedMessagesRange"), 0L);
  • Loading branch information
Sunny-Island authored May 20, 2021
1 parent b5bd846 commit b7d3ae1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ private List<Metrics> aggregate() {
dimensionMap.put("ledger_name", ledgerName);
dimensionMap.put("cursor_name", cursor.getName());
Metrics metrics = createMetrics(dimensionMap);
metrics.put("brk_ml_cursor_nonContiguousDeletedMessagesRange",
(long) cursor.getTotalNonContiguousDeletedMessagesRange());
metrics.put("brk_ml_cursor_persistLedgerSucceed", cStats.getPersistLedgerSucceed());
metrics.put("brk_ml_cursor_persistLedgerErrors", cStats.getPersistLedgerErrors());
metrics.put("brk_ml_cursor_persistZookeeperSucceed", cStats.getPersistZookeeperSucceed());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public void testManagedCursorMetrics() throws Exception {
Assert.assertNotEquals(metricsList.get(0).getMetrics().get("brk_ml_cursor_persistLedgerErrors"), 0L);
Assert.assertNotEquals(metricsList.get(0).getMetrics().get("brk_ml_cursor_persistZookeeperSucceed"), 0L);
Assert.assertEquals(metricsList.get(0).getMetrics().get("brk_ml_cursor_persistZookeeperErrors"), 0L);
Assert.assertEquals(metricsList.get(0).getMetrics().get("brk_ml_cursor_nonContiguousDeletedMessagesRange"), 0L);
}

}

0 comments on commit b7d3ae1

Please sign in to comment.