Search in sources :

Example 1 with MetricsCollectionContext

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);
    });
}
Also used : MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor) ClientContext(com.hazelcast.client.impl.spi.ClientContext) NearCacheStatsImpl(com.hazelcast.internal.monitor.impl.NearCacheStatsImpl) DynamicMetricsProvider(com.hazelcast.internal.metrics.DynamicMetricsProvider) MetricsCollectionContext(com.hazelcast.internal.metrics.MetricsCollectionContext) ProxyManager(com.hazelcast.client.impl.spi.ProxyManager) NEARCACHE_DISCRIMINATOR_NAME(com.hazelcast.internal.metrics.MetricDescriptorConstants.NEARCACHE_DISCRIMINATOR_NAME) NEARCACHE_PREFIX(com.hazelcast.internal.metrics.MetricDescriptorConstants.NEARCACHE_PREFIX) NearCacheStatsImpl(com.hazelcast.internal.monitor.impl.NearCacheStatsImpl) ClientContext(com.hazelcast.client.impl.spi.ClientContext)

Aggregations

ClientContext (com.hazelcast.client.impl.spi.ClientContext)1 ProxyManager (com.hazelcast.client.impl.spi.ProxyManager)1 DynamicMetricsProvider (com.hazelcast.internal.metrics.DynamicMetricsProvider)1 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)1 NEARCACHE_DISCRIMINATOR_NAME (com.hazelcast.internal.metrics.MetricDescriptorConstants.NEARCACHE_DISCRIMINATOR_NAME)1 NEARCACHE_PREFIX (com.hazelcast.internal.metrics.MetricDescriptorConstants.NEARCACHE_PREFIX)1 MetricsCollectionContext (com.hazelcast.internal.metrics.MetricsCollectionContext)1 NearCacheStatsImpl (com.hazelcast.internal.monitor.impl.NearCacheStatsImpl)1