Search in sources :

Example 1 with MetricsRule

use of com.hazelcast.test.metrics.MetricsRule in project hazelcast by hazelcast.

the class TestHazelcastInstanceFactory method registerTestMetricsPublisher.

private void registerTestMetricsPublisher(HazelcastInstance hazelcastInstance) {
    if (metricsRule != null && metricsRule.isEnabled()) {
        MetricsService metricService = getNodeEngineImpl(hazelcastInstance).getService(MetricsService.SERVICE_NAME);
        metricService.registerPublisher((FunctionEx<NodeEngine, MetricsPublisher>) nodeEngine -> metricsRule.getMetricsPublisher(hazelcastInstance));
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) IntStream(java.util.stream.IntStream) Address(com.hazelcast.cluster.Address) HazelcastInstanceImpl(com.hazelcast.instance.impl.HazelcastInstanceImpl) Arrays(java.util.Arrays) MetricsRule(com.hazelcast.test.metrics.MetricsRule) HazelcastTestSupport.spawn(com.hazelcast.test.HazelcastTestSupport.spawn) Accessors.getAddress(com.hazelcast.test.Accessors.getAddress) HazelcastInstanceFactory(com.hazelcast.instance.impl.HazelcastInstanceFactory) TestNodeRegistry(com.hazelcast.test.mocknetwork.TestNodeRegistry) Function(java.util.function.Function) HazelcastTestSupport.assertClusterSizeEventually(com.hazelcast.test.HazelcastTestSupport.assertClusterSizeEventually) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashSet(java.util.HashSet) Collections.unmodifiableCollection(java.util.Collections.unmodifiableCollection) MetricsPublisher(com.hazelcast.internal.metrics.MetricsPublisher) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Arrays.asList(java.util.Arrays.asList) YamlConfigBuilder(com.hazelcast.config.YamlConfigBuilder) Accessors.getNode(com.hazelcast.test.Accessors.getNode) Config(com.hazelcast.config.Config) HazelcastInstance(com.hazelcast.core.HazelcastInstance) FunctionEx(com.hazelcast.function.FunctionEx) Accessors.getNodeEngineImpl(com.hazelcast.test.Accessors.getNodeEngineImpl) NodeEngine(com.hazelcast.spi.impl.NodeEngine) TestUtil.terminateInstance(com.hazelcast.instance.impl.TestUtil.terminateInstance) DefaultNodeContext(com.hazelcast.instance.impl.DefaultNodeContext) Collection(java.util.Collection) XmlConfigBuilder(com.hazelcast.config.XmlConfigBuilder) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) HazelcastInstanceProxy(com.hazelcast.instance.impl.HazelcastInstanceProxy) Preconditions.checkNotNull(com.hazelcast.internal.util.Preconditions.checkNotNull) UnknownHostException(java.net.UnknownHostException) ClusterProperty(com.hazelcast.spi.properties.ClusterProperty) NetworkConfig(com.hazelcast.config.NetworkConfig) Collectors.toList(java.util.stream.Collectors.toList) NodeContext(com.hazelcast.instance.impl.NodeContext) MetricsService(com.hazelcast.internal.metrics.impl.MetricsService) Hazelcast(com.hazelcast.core.Hazelcast) SYSPROP_MEMBER_CONFIG(com.hazelcast.internal.config.DeclarativeConfigUtil.SYSPROP_MEMBER_CONFIG) YAML_ACCEPTED_SUFFIXES(com.hazelcast.internal.config.DeclarativeConfigUtil.YAML_ACCEPTED_SUFFIXES) Util.uncheckCall(com.hazelcast.jet.impl.util.Util.uncheckCall) Comparator(java.util.Comparator) DeclarativeConfigUtil.isAcceptedSuffixConfigured(com.hazelcast.internal.config.DeclarativeConfigUtil.isAcceptedSuffixConfigured) Collections(java.util.Collections) MetricsService(com.hazelcast.internal.metrics.impl.MetricsService) MetricsPublisher(com.hazelcast.internal.metrics.MetricsPublisher)

Aggregations

Address (com.hazelcast.cluster.Address)1 Config (com.hazelcast.config.Config)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1 XmlConfigBuilder (com.hazelcast.config.XmlConfigBuilder)1 YamlConfigBuilder (com.hazelcast.config.YamlConfigBuilder)1 Hazelcast (com.hazelcast.core.Hazelcast)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 FunctionEx (com.hazelcast.function.FunctionEx)1 DefaultNodeContext (com.hazelcast.instance.impl.DefaultNodeContext)1 HazelcastInstanceFactory (com.hazelcast.instance.impl.HazelcastInstanceFactory)1 HazelcastInstanceImpl (com.hazelcast.instance.impl.HazelcastInstanceImpl)1 HazelcastInstanceProxy (com.hazelcast.instance.impl.HazelcastInstanceProxy)1 NodeContext (com.hazelcast.instance.impl.NodeContext)1 TestUtil.terminateInstance (com.hazelcast.instance.impl.TestUtil.terminateInstance)1 SYSPROP_MEMBER_CONFIG (com.hazelcast.internal.config.DeclarativeConfigUtil.SYSPROP_MEMBER_CONFIG)1 YAML_ACCEPTED_SUFFIXES (com.hazelcast.internal.config.DeclarativeConfigUtil.YAML_ACCEPTED_SUFFIXES)1 DeclarativeConfigUtil.isAcceptedSuffixConfigured (com.hazelcast.internal.config.DeclarativeConfigUtil.isAcceptedSuffixConfigured)1 MetricsPublisher (com.hazelcast.internal.metrics.MetricsPublisher)1 MetricsService (com.hazelcast.internal.metrics.impl.MetricsService)1 Preconditions.checkNotNull (com.hazelcast.internal.util.Preconditions.checkNotNull)1