Class MetricRegistryImpl
- java.lang.Object
-
- org.apache.ignite.internal.processors.metric.MetricRegistryImpl
-
- All Implemented Interfaces:
Iterable<Metric>,MetricRegistry,ReadOnlyMetricRegistry
public class MetricRegistryImpl extends Object implements MetricRegistry
Metric registry.
-
-
Constructor Summary
Constructors Constructor Description MetricRegistryImpl(String regName, Function<String,Long> hitRateCfgProvider, Function<String,long[]> histogramCfgProvider, IgniteLogger log)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BooleanMetricImplbooleanMetric(String name, @Nullable String desc)Creates and register named gauge.DoubleMetricImpldoubleMetric(String name, @Nullable String desc)Creates and register named metric.<M extends Metric>
MfindMetric(String name)HistogramMetricImplhistogram(String name, long[] bounds, @Nullable String desc)Creates and registre named histogram gauge.HitRateMetrichitRateMetric(String name, @Nullable String desc, long rateTimeInterval, int size)Creates and register hit rate metric.IntMetricImplintMetric(String name, @Nullable String desc)Creates and register named metric.@NotNull Iterator<Metric>iterator()LongAdderMetriclongAdderMetric(String name, @Nullable String desc)Creates and register named metric.LongAdderWithDelegateMetriclongAdderMetric(String name, LongAdderWithDelegateMetric.Delegate delegate, @Nullable String desc)Creates and register named metric.AtomicLongMetriclongMetric(String name, @Nullable String desc)Creates and register named metric.Stringname()<T> ObjectMetricImpl<T>objectMetric(String name, Class<T> type, @Nullable String desc)Creates and register named gauge.voidregister(String name, BooleanSupplier supplier, @Nullable String desc)Registers a boolean metric which value will be queried from the specified supplier.voidregister(String name, DoubleSupplier supplier, @Nullable String desc)Registers a double metric which value will be queried from the specified supplier.voidregister(String name, IntSupplier supplier, @Nullable String desc)Registers an int metric which value will be queried from the specified supplier.voidregister(String name, LongSupplier supplier, @Nullable String desc)Registers a long metric which value will be queried from the specified supplier.<T> voidregister(String name, Supplier<T> supplier, Class<T> type, @Nullable String desc)Registers an object metric which value will be queried from the specified supplier.voidregister(Metric metric)Register existing metrics in this group with the specified name.voidremove(String name)Removes metrics with thename.voidreset()Resets state of this metric registry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
MetricRegistryImpl
public MetricRegistryImpl(String regName, Function<String,Long> hitRateCfgProvider, Function<String,long[]> histogramCfgProvider, IgniteLogger log)
- Parameters:
regName- Registry name.hitRateCfgProvider- HitRate config provider.histogramCfgProvider- Histogram config provider.log- Logger.
-
-
Method Detail
-
findMetric
@Nullable public <M extends Metric> M findMetric(String name)
- Specified by:
findMetricin interfaceReadOnlyMetricRegistry- Type Parameters:
M- Type of the metric.- Parameters:
name- Name of the metric.- Returns:
- Metric with specified name if exists. Null otherwise.
-
reset
public void reset()
Resets state of this metric registry.
-
objectMetric
public <T> ObjectMetricImpl<T> objectMetric(String name, Class<T> type, @Nullable @Nullable String desc)
Creates and register named gauge. Returned instance are thread safe.- Parameters:
name- Name.type- Type.desc- Description.- Returns:
ObjectMetricImpl
-
register
public void register(Metric metric)
Register existing metrics in this group with the specified name. Note that the name of the metric must start with the name of the current registry it is registered into.- Parameters:
metric- Metric.
-
remove
public void remove(String name)
Removes metrics with thename.- Specified by:
removein interfaceMetricRegistry- Parameters:
name- Metric short name. Doesn't include registry name.
-
register
public void register(String name, BooleanSupplier supplier, @Nullable @Nullable String desc)
Registers a boolean metric which value will be queried from the specified supplier.- Specified by:
registerin interfaceMetricRegistry- Parameters:
name- Metric short name. Doesn't include registry name.supplier- Metric value supplier.desc- Metric description.
-
register
public void register(String name, DoubleSupplier supplier, @Nullable @Nullable String desc)
Registers a double metric which value will be queried from the specified supplier.- Specified by:
registerin interfaceMetricRegistry- Parameters:
name- Metric short name. Doesn't include the registry name.supplier- Metric value supplier.desc- Metric description.
-
register
public void register(String name, IntSupplier supplier, @Nullable @Nullable String desc)
Registers an int metric which value will be queried from the specified supplier.- Specified by:
registerin interfaceMetricRegistry- Parameters:
name- Metric short name. Doesn't include registry name.supplier- Metric value supplier.desc- Metric description.
-
register
public void register(String name, LongSupplier supplier, @Nullable @Nullable String desc)
Registers a long metric which value will be queried from the specified supplier.- Specified by:
registerin interfaceMetricRegistry- Parameters:
name- Metric short name. Doesn't include registry name.supplier- Metric value supplier.desc- Metric description.
-
register
public <T> void register(String name, Supplier<T> supplier, Class<T> type, @Nullable @Nullable String desc)
Registers an object metric which value will be queried from the specified supplier.- Specified by:
registerin interfaceMetricRegistry- Type Parameters:
T- Metric value type.- Parameters:
name- Metric short name. Doesn't include registry name.supplier- Metric value supplier.type- Metric value type.desc- Metric description.
-
doubleMetric
public DoubleMetricImpl doubleMetric(String name, @Nullable @Nullable String desc)
Creates and register named metric. Returned instance are thread safe.- Parameters:
name- Name.desc- Description.- Returns:
DoubleMetricImpl.
-
intMetric
public IntMetricImpl intMetric(String name, @Nullable @Nullable String desc)
Creates and register named metric. Returned instance are thread safe.- Parameters:
name- Name.desc- Description.- Returns:
IntMetricImpl.
-
longMetric
public AtomicLongMetric longMetric(String name, @Nullable @Nullable String desc)
Creates and register named metric. Returned instance are thread safe.- Parameters:
name- Name.desc- Description.- Returns:
AtomicLongMetric.
-
longAdderMetric
public LongAdderMetric longAdderMetric(String name, @Nullable @Nullable String desc)
Creates and register named metric. Returned instance are thread safe.- Parameters:
name- Name.desc- Description.- Returns:
LongAdderMetric.
-
longAdderMetric
public LongAdderWithDelegateMetric longAdderMetric(String name, LongAdderWithDelegateMetric.Delegate delegate, @Nullable @Nullable String desc)
Creates and register named metric. Returned instance are thread safe.- Parameters:
name- Name.delegate- Delegate to which all updates from new metric will be delegated to.desc- Description.- Returns:
LongAdderWithDelegateMetric.
-
hitRateMetric
public HitRateMetric hitRateMetric(String name, @Nullable @Nullable String desc, long rateTimeInterval, int size)
Creates and register hit rate metric. It will accumulates approximate hit rate statistics. Calculates number of hits in last rateTimeInterval milliseconds.- Parameters:
rateTimeInterval- Rate time interval.size- Array size for underlying calculations.- Returns:
HitRateMetric- See Also:
HitRateMetric
-
booleanMetric
public BooleanMetricImpl booleanMetric(String name, @Nullable @Nullable String desc)
Creates and register named gauge. Returned instance are thread safe.- Parameters:
name- Name.desc- Description.- Returns:
BooleanMetricImpl
-
histogram
public HistogramMetricImpl histogram(String name, long[] bounds, @Nullable @Nullable String desc)
Creates and registre named histogram gauge.- Parameters:
name- Namebounds- Bounds of measurements.desc- Description.- Returns:
HistogramMetricImpl
-
name
public String name()
- Specified by:
namein interfaceReadOnlyMetricRegistry- Returns:
- Registry name.
-
-