Search in sources :

Example 1 with PublisherMetricsCollector

use of com.hazelcast.internal.metrics.impl.PublisherMetricsCollector in project hazelcast by hazelcast.

the class ClientStatisticsService method start.

/**
 * Registers all client statistics and schedules periodic collection of stats.
 */
public final void start() {
    if (!enabled) {
        return;
    }
    if (metricsConfig.getJmxConfig().isEnabled()) {
        publisherMetricsCollector = new PublisherMetricsCollector(new JmxPublisher(client.getName(), "com.hazelcast"));
    } else {
        publisherMetricsCollector = new PublisherMetricsCollector();
    }
    metricsRegistry.registerDynamicMetricsProvider(new ClusterConnectionMetricsProvider(client.getConnectionManager()));
    client.getMetricsRegistry().registerDynamicMetricsProvider(new NearCacheMetricsProvider(client.getProxyManager()));
    long periodSeconds = metricsConfig.getCollectionFrequencySeconds();
    // Note that the OperatingSystemMetricSet and RuntimeMetricSet are already registered during client start,
    // hence we do not re-register
    periodicStats = new PeriodicStatistics();
    schedulePeriodicStatisticsSendTask(metricsConfig.getCollectionFrequencySeconds());
    logger.info("Client statistics is enabled with period " + periodSeconds + " seconds.");
}
Also used : JmxPublisher(com.hazelcast.internal.metrics.jmx.JmxPublisher) PublisherMetricsCollector(com.hazelcast.internal.metrics.impl.PublisherMetricsCollector)

Aggregations

PublisherMetricsCollector (com.hazelcast.internal.metrics.impl.PublisherMetricsCollector)1 JmxPublisher (com.hazelcast.internal.metrics.jmx.JmxPublisher)1