Skip to content

Commit

Permalink
[improve][admin] Improve BrokerStats.allocatorStats (apache#23242)
Browse files Browse the repository at this point in the history
  • Loading branch information
dao-jun authored Sep 2, 2024
1 parent 8da3bf8 commit 019ae9f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public static AllocatorStats generate(String allocatorName) {
stats.numDirectArenas = allocator.metric().numDirectArenas();
stats.numHeapArenas = allocator.metric().numHeapArenas();
stats.numThreadLocalCaches = allocator.metric().numThreadLocalCaches();
stats.usedHeapMemory = allocator.metric().usedHeapMemory();
stats.usedDirectMemory = allocator.metric().usedDirectMemory();
stats.normalCacheSize = allocator.metric().normalCacheSize();
stats.smallCacheSize = allocator.metric().smallCacheSize();
return stats;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public class AllocatorStats {
public int numThreadLocalCaches;
public int normalCacheSize;
public int smallCacheSize;
public long usedDirectMemory;
public long usedHeapMemory;

public List<PoolArenaStats> directArenas;
public List<PoolArenaStats> heapArenas;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public void brokerStats() throws Exception {
doReturn("null").when(mockBrokerStats).getMetrics();
brokerStats.run(split("monitoring-metrics"));
verify(mockBrokerStats).getMetrics();

doReturn(null).when(mockBrokerStats).getAllocatorStats("default");
brokerStats.run(split("allocator-stats default"));
verify(mockBrokerStats).getAllocatorStats("default");
}

@Test
Expand Down

0 comments on commit 019ae9f

Please sign in to comment.