use of com.hazelcast.internal.metrics.MetricsCollectionContext in project hazelcast by hazelcast.
the class NearCacheMetricsProvider method provideDynamicMetrics.
@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
descriptor.withPrefix(NEARCACHE_PREFIX);
ClientContext clientContext = proxyManager.getContext();
if (clientContext == null) {
return;
}
clientContext.getNearCacheManagers().values().stream().flatMap(nearCacheManager -> nearCacheManager.listAllNearCaches().stream()).forEach(nearCache -> {
String nearCacheName = nearCache.getName();
NearCacheStatsImpl nearCacheStats = (NearCacheStatsImpl) nearCache.getNearCacheStats();
context.collect(descriptor.copy().withDiscriminator(NEARCACHE_DISCRIMINATOR_NAME, nearCacheName), nearCacheStats);
});
}
Aggregations