Search in sources :

Example 26 with MetricsRegistry

use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.

the class MetricsPropertiesTest method verifyDataStructureMetricPresent.

private void verifyDataStructureMetricPresent(HazelcastInstance instance, boolean shouldContain) {
    CapturingCollector collector = new CapturingCollector();
    instance.getMap("testMap").put("42", "42");
    MetricsRegistry metricsRegistry = getNodeEngineImpl(instance).getMetricsRegistry();
    metricsRegistry.collect(collector);
    MetricDescriptor descriptor = DEFAULT_DESCRIPTOR_SUPPLIER.get().withPrefix(MAP_PREFIX).withDiscriminator(MAP_DISCRIMINATOR_NAME, "testMap").withMetric("putCount").withUnit(COUNT);
    if (shouldContain) {
        assertContains(collector.captures().keySet(), descriptor);
    } else {
        assertNotContains(collector.captures().keySet(), descriptor);
    }
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) MetricDescriptor(com.hazelcast.internal.metrics.MetricDescriptor)

Example 27 with MetricsRegistry

use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.

the class MetricsPropertiesTest method testDebugMetricsSysPropDisabled.

@Test
public void testDebugMetricsSysPropDisabled() {
    System.setProperty(ClusterProperty.METRICS_DEBUG.getName(), "false");
    HazelcastInstance instance = createHazelcastInstance();
    MetricsRegistry metricsRegistry = getNodeEngineImpl(instance).getMetricsRegistry();
    assertEquals(INFO, metricsRegistry.minimumLevel());
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) HazelcastInstance(com.hazelcast.core.HazelcastInstance) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 28 with MetricsRegistry

use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.

the class AdvancedNetworkStatsIntegrationTest method assertAllNetworkStatsNotRegisteredAsMetrics.

private void assertAllNetworkStatsNotRegisteredAsMetrics(HazelcastInstance instance) {
    MetricsRegistry registry = getNode(instance).nodeEngine.getMetricsRegistry();
    for (ProtocolType protocolType : ProtocolType.values()) {
        assertNotContains(registry.getNames(), "tcp.bytesReceived." + protocolType.name());
        assertNotContains(registry.getNames(), "tcp.bytesSend." + protocolType.name());
    }
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) ProtocolType(com.hazelcast.instance.ProtocolType)

Example 29 with MetricsRegistry

use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast-simulator by hazelcast.

the class NetworkTest method setup.

@Setup
public void setup() throws Exception {
    Node node = HazelcastTestUtils.getNode(targetInstance);
    if (node == null) {
        throw new IllegalStateException("node is null");
    }
    MetricsRegistry metricsRegistry = node.nodeEngine.getMetricsRegistry();
    LoggingService loggingService = node.loggingService;
    HazelcastThreadGroup threadGroup = node.getHazelcastThreadGroup();
    // we don't know the number of worker threads (damn hidden property), so lets assume 1000.. that should be enough
    packetHandler = new RequestPacketHandler(1000);
    Address thisAddress = node.getThisAddress();
    Address newThisAddress = new Address(thisAddress.getHost(), thisAddress.getPort() + PORT_OFFSET);
    logger.info("ThisAddress: " + newThisAddress);
    MockIOService ioService = new MockIOService(newThisAddress, loggingService);
    ioService.inputThreadCount = inputThreadCount;
    ioService.outputThreadCount = outputThreadCount;
    ioService.socketNoDelay = socketNoDelay;
    ioService.packetHandler = packetHandler;
    ioService.socketSendBufferSize = socketSendBufferSize;
    ioService.socketReceiveBufferSize = socketReceiveBufferSize;
    if (trackSequenceId) {
        ioService.writeHandlerFactory = new TaggingWriteHandlerFactory();
    }
    IOThreadingModel threadingModel = null;
    switch(ioThreadingModel) {
        // break;
        default:
            throw new IllegalStateException("Unrecognized threading model: " + ioThreadingModel);
    }
// 
// connectionManager = new TcpIpConnectionManager(
// ioService, ioService.serverSocketChannel, loggingService, metricsRegistry, threadingModel);
// connectionManager.start();
// networkCreateLock = targetInstance.getLock("connectionCreateLock");
}
Also used : MetricsRegistry(com.hazelcast.internal.metrics.MetricsRegistry) Address(com.hazelcast.nio.Address) IOThreadingModel(com.hazelcast.internal.networking.IOThreadingModel) Node(com.hazelcast.instance.Node) LoggingService(com.hazelcast.logging.LoggingService) HazelcastThreadGroup(com.hazelcast.instance.HazelcastThreadGroup) Setup(com.hazelcast.simulator.test.annotations.Setup)

Aggregations

MetricsRegistry (com.hazelcast.internal.metrics.MetricsRegistry)29 QuickTest (com.hazelcast.test.annotation.QuickTest)16 Test (org.junit.Test)16 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)10 HazelcastInstance (com.hazelcast.core.HazelcastInstance)6 MetricDescriptor (com.hazelcast.internal.metrics.MetricDescriptor)6 MetricsCollector (com.hazelcast.internal.metrics.collectors.MetricsCollector)4 Config (com.hazelcast.config.Config)2 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)2 ExecutionService (com.hazelcast.spi.impl.executionservice.ExecutionService)2 CacheConfig (com.hazelcast.config.CacheConfig)1 ConfigAccessor.getActiveMemberNetworkConfig (com.hazelcast.config.ConfigAccessor.getActiveMemberNetworkConfig)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 HazelcastThreadGroup (com.hazelcast.instance.HazelcastThreadGroup)1 Node (com.hazelcast.instance.Node)1 ProtocolType (com.hazelcast.instance.ProtocolType)1 Node (com.hazelcast.instance.impl.Node)1 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)1 IOThreadingModel (com.hazelcast.internal.networking.IOThreadingModel)1 Networking (com.hazelcast.internal.networking.Networking)1