use of com.hazelcast.internal.metrics.jmx.JmxPublisher 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.");
}
Aggregations