use of com.yahoo.pulsar.common.stats.AllocatorStats in project pulsar by yahoo.
the class AllocatorStatsGenerator method generate.
public static AllocatorStats generate(String allocatorName) {
PooledByteBufAllocator allocator = null;
if ("default".equals(allocatorName)) {
allocator = PooledByteBufAllocator.DEFAULT;
} else if ("ml-cache".equals(allocatorName)) {
allocator = EntryCacheImpl.allocator;
} else {
throw new IllegalArgumentException("Invalid allocator name : " + allocatorName);
}
AllocatorStats stats = new AllocatorStats();
stats.directArenas = allocator.directArenas().stream().map(x -> newPoolArenaStats(x)).collect(Collectors.toList());
stats.heapArenas = allocator.heapArenas().stream().map(x -> newPoolArenaStats(x)).collect(Collectors.toList());
stats.numDirectArenas = allocator.numDirectArenas();
stats.numHeapArenas = allocator.numHeapArenas();
stats.numThreadLocalCaches = allocator.numThreadLocalCaches();
stats.normalCacheSize = allocator.normalCacheSize();
stats.smallCacheSize = allocator.smallCacheSize();
stats.tinyCacheSize = allocator.tinyCacheSize();
return stats;
}
use of com.yahoo.pulsar.common.stats.AllocatorStats in project pulsar by yahoo.
the class AdminTest method brokerStats.
@Test
void brokerStats() throws Exception {
doReturn("client-id").when(brokerStats).clientAppId();
Collection<Metrics> metrics = brokerStats.getMetrics();
assertNotNull(metrics);
LoadReport loadReport = brokerStats.getLoadReport();
assertNotNull(loadReport);
assertEquals(loadReport.isOverLoaded(), false);
Collection<Metrics> mBeans = brokerStats.getMBeans();
assertTrue(!mBeans.isEmpty());
AllocatorStats allocatorStats = brokerStats.getAllocatorStats("default");
assertNotNull(allocatorStats);
Map<String, Map<String, PendingBookieOpsStats>> bookieOpsStats = brokerStats.getPendingBookieOpsStats();
assertTrue(bookieOpsStats.isEmpty());
StreamingOutput destination = brokerStats.getDestinations2();
assertNotNull(destination);
Map<Long, Collection<ResourceUnit>> resource = brokerStats.getBrokerResourceAvailability("prop", "use", "ns2");
// size should be 1 with default resourceUnit
assertTrue(resource.size() == 1);
}
Aggregations