use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast-jet by hazelcast.
the class ExecutionContext method completeExecution.
/**
* Complete local execution. If local execution was started, it should be
* called after execution has completed.
*/
public void completeExecution(Throwable error) {
assert executionFuture == null || executionFuture.isDone() : "If execution was begun, then completeExecution() should not be called before execution is done.";
for (Processor processor : processors) {
try {
processor.close(error);
} catch (Throwable e) {
logger.severe(jobAndExecutionId(jobId, executionId) + " encountered an exception in Processor.close(), ignoring it", e);
}
}
for (ProcessorSupplier s : procSuppliers) {
try {
s.close(error);
} catch (Throwable e) {
logger.severe(jobAndExecutionId(jobId, executionId) + " encountered an exception in ProcessorSupplier.complete(), ignoring it", e);
}
}
MetricsRegistry metricsRegistry = ((NodeEngineImpl) nodeEngine).getMetricsRegistry();
processors.forEach(metricsRegistry::deregister);
}
use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.
the class ClusterServiceImpl method registerMetrics.
private void registerMetrics() {
MetricsRegistry metricsRegistry = node.nodeEngine.getMetricsRegistry();
metricsRegistry.registerStaticMetrics(clusterClock, CLUSTER_PREFIX_CLOCK);
metricsRegistry.registerStaticMetrics(clusterHeartbeatManager, CLUSTER_PREFIX_HEARTBEAT);
metricsRegistry.registerStaticMetrics(this, CLUSTER_PREFIX);
}
use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.
the class EventServiceImpl method getSegment.
/**
* Returns the {@link EventServiceSegment} for the {@code service}. If the segment is {@code null} and
* {@code forceCreate} is {@code true}, the segment is created and registered with the {@link MetricsRegistry}.
*
* @param service the service of the segment
* @param forceCreate whether the segment should be created in case there is no segment
* @return the segment for the service or null if there is no segment and {@code forceCreate} is {@code false}
*/
public EventServiceSegment getSegment(@Nonnull String service, boolean forceCreate) {
EventServiceSegment segment = segments.get(service);
if (segment == null && forceCreate) {
// we can't make use of the ConcurrentUtil; we need to register the segment to the metricsRegistry in case of creation
EventServiceSegment newSegment = new EventServiceSegment(service, nodeEngine.getService(service));
EventServiceSegment existingSegment = segments.putIfAbsent(service, newSegment);
if (existingSegment == null) {
segment = newSegment;
MetricsRegistry metricsRegistry = nodeEngine.getMetricsRegistry();
MetricDescriptor descriptor = metricsRegistry.newMetricDescriptor().withPrefix(EVENT_PREFIX).withDiscriminator(EVENT_DISCRIMINATOR_SERVICE, service);
metricsRegistry.registerStaticMetrics(descriptor, newSegment);
} else {
segment = existingSegment;
}
}
return segment;
}
use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.
the class CachePutAllTest method testPutAll_whenEntryExpiresOnCreate.
@Test
public void testPutAll_whenEntryExpiresOnCreate() {
Factory<? extends ExpiryPolicy> expiryPolicyFactory = FactoryBuilder.factoryOf(new CreatedExpiryPolicy(Duration.ZERO));
CacheConfig<String, String> cacheConfig = new CacheConfig<String, String>();
cacheConfig.setTypes(String.class, String.class);
cacheConfig.setExpiryPolicyFactory(expiryPolicyFactory);
cacheConfig.setStatisticsEnabled(true);
cacheConfig.setBackupCount(1);
Cache<String, String> cache = createCache(cacheConfig);
String key = generateKeyOwnedBy(hazelcastInstance);
// need to count the number of backup failures on backup member
OperationService operationService = getOperationService(hazelcastInstances[1]);
MetricsRegistry metricsRegistry = getMetricsRegistry(hazelcastInstances[1]);
assertEquals(0L, OperationServiceAccessor.getFailedBackupsCount(hazelcastInstances[1]).get());
Map<String, String> entries = new HashMap<String, String>();
entries.put(key, randomString());
cache.putAll(entries);
assertNull(cache.get(key));
// force collect metrics
metricsRegistry.provideMetrics(operationService);
assertEquals(0L, OperationServiceAccessor.getFailedBackupsCount(hazelcastInstances[1]).get());
}
use of com.hazelcast.internal.metrics.MetricsRegistry in project hazelcast by hazelcast.
the class DistributedDatastructuresMetricsTest method assertHasNoStats.
private void assertHasNoStats(final String dsName, final String metricPrefix) {
final MetricsRegistry registry = getNode(hz).nodeEngine.getMetricsRegistry();
final StringMetricsCollector collector = new StringMetricsCollector(dsName, metricPrefix);
registry.collect(collector);
assertTrue(collector.probes.isEmpty());
}
Aggregations