use of com.hazelcast.internal.metrics.MetricDescriptor in project hazelcast by hazelcast.
the class AtomicRefService method provideDynamicMetrics.
@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
MetricDescriptor root = descriptor.withPrefix("cp.atomicref");
for (AtomicRef value : atomicValues.values()) {
CPGroupId groupId = value.groupId();
MetricDescriptor desc = root.copy().withDiscriminator("id", value.name() + "@" + groupId.getName()).withTag(CP_TAG_NAME, value.name()).withTag("group", groupId.getName()).withMetric("dummy");
context.collect(desc, 0);
}
}
use of com.hazelcast.internal.metrics.MetricDescriptor in project hazelcast by hazelcast.
the class SemaphoreService method provideDynamicMetrics.
@Override
public void provideDynamicMetrics(MetricDescriptor descriptor, MetricsCollectionContext context) {
MetricDescriptor root = descriptor.withPrefix("cp.semaphore");
for (CPGroupId groupId : getGroupIdSet()) {
SemaphoreRegistry registry = getRegistryOrNull(groupId);
for (Semaphore sema : registry.getAllSemaphores()) {
MetricDescriptor desc = root.copy().withDiscriminator("id", sema.getName() + "@" + groupId.getName()).withTag(CP_TAG_NAME, sema.getName()).withTag("group", groupId.getName());
context.collect(desc.copy().withMetric("initialized"), sema.isInitialized() ? 1 : 0);
context.collect(desc.copy().withUnit(ProbeUnit.COUNT).withMetric("available"), sema.getAvailable());
}
}
}
use of com.hazelcast.internal.metrics.MetricDescriptor in project hazelcast by hazelcast.
the class FieldProbe method register.
void register(MetricsRegistryImpl metricsRegistry, Object source, String namePrefix) {
MetricDescriptor descriptor = metricsRegistry.newMetricDescriptor().withPrefix(namePrefix).withMetric(getProbeName());
metricsRegistry.registerInternal(source, descriptor, probe.level(), this);
}
use of com.hazelcast.internal.metrics.MetricDescriptor in project hazelcast by hazelcast.
the class JmxPublisher method publishNumber.
private void publishNumber(MetricDescriptor originalDescriptor, Number value, MetricsMBean.Type type) {
if (originalDescriptor.isTargetExcluded(JMX)) {
return;
}
final MetricData metricData;
if (!metricNameToMetricData.containsKey(originalDescriptor)) {
// we need to take a copy of originalDescriptor here to ensure
// we map with an instance that doesn't get recycled or mutated
MetricDescriptor descriptor = copy(originalDescriptor);
metricData = metricNameToMetricData.computeIfAbsent(descriptor, createMetricDataFunction);
} else {
metricData = metricNameToMetricData.get(originalDescriptor);
}
assertDoubleRendering(originalDescriptor, metricData, value);
metricData.wasPresent = true;
MetricsMBean mBean = mBeans.computeIfAbsent(metricData.objectName, createMBeanFunction);
if (isShutdown) {
unregisterMBeanIgnoreError(metricData.objectName);
}
mBean.setMetricValue(metricData.metric, metricData.unit, value, type);
}
use of com.hazelcast.internal.metrics.MetricDescriptor in project hazelcast by hazelcast.
the class FileMetricSet method register.
/**
* Registers all the metrics in this metric pack.
*
* @param metricsRegistry the MetricsRegistry upon which the metrics are registered.
*/
public static void register(MetricsRegistry metricsRegistry) {
checkNotNull(metricsRegistry, "metricsRegistry");
File file = new File(System.getProperty("user.home"));
MetricDescriptor descriptor = metricsRegistry.newMetricDescriptor().withPrefix(FILE_PREFIX).withDiscriminator(FILE_DISCRIMINATOR_DIR, FILE_DISCRIMINATOR_VALUE_DIR);
metricsRegistry.registerStaticProbe(file, descriptor, FILE_METRIC_FREESPACE, MANDATORY, BYTES, File::getFreeSpace);
metricsRegistry.registerStaticProbe(file, descriptor, FILE_METRIC_TOTALSPACE, MANDATORY, BYTES, File::getTotalSpace);
metricsRegistry.registerStaticProbe(file, descriptor, FILE_METRIC_USABLESPACE, MANDATORY, BYTES, File::getUsableSpace);
}
Aggregations