Class MetricUtils
- java.lang.Object
-
- org.apache.ignite.internal.processors.metric.impl.MetricUtils
-
public class MetricUtils extends Object
Utility class to build or parse metric name in dot notation.- See Also:
GridMetricManager,MetricRegistry
-
-
Field Summary
Fields Modifier and Type Field Description static charHISTOGRAM_NAME_DIVIDERHistogram name divider.static StringINFHistogram metric last interval high bound.static StringSEPARATORMetric name part separator.
-
Constructor Summary
Constructors Constructor Description MetricUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcacheGroupMetricsRegistryName(String cacheOrGroupName)static StringcacheMetricsRegistryName(String cacheName, boolean isNear)static booleancompareAndSet(AtomicLongMetric m, long expect, long update)Atomically sets the value to the given updated value if the current value==the expected value.static booleancustomMetric(String name)static StringcustomName(String name)AddsGridMetricManager.CUSTOM_METRICStoname.static T2<String,String>fromFullName(String name)Splits full metric name to registry name and metric name.static String[]histogramBucketNames(HistogramMetric metric)Generates histogram bucket names.static StringmetricName(String... names)Chechs and builds metric name.static voidsetIfGreater(AtomicLongMetric m, long update)Update metrics value only if current value if greater thenupdate.static voidsetIfLess(AtomicLongMetric m, long update)Update metrics value only if current value if less thenupdate.static Map<String,Class<?>>systemViewAttributes(SystemView<?> sysView)Extract attributes for system view.static StringtoSqlName(String name)Build SQL-like name from Java code style name.
-
-
-
Field Detail
-
SEPARATOR
public static final String SEPARATOR
Metric name part separator.- See Also:
- Constant Field Values
-
INF
public static final String INF
Histogram metric last interval high bound.- See Also:
- Constant Field Values
-
HISTOGRAM_NAME_DIVIDER
public static final char HISTOGRAM_NAME_DIVIDER
Histogram name divider.- See Also:
- Constant Field Values
-
-
Method Detail
-
metricName
public static String metricName(String... names)
Chechs and builds metric name.- Parameters:
names- Metric name parts.- Returns:
- Metric name.
-
customMetric
public static boolean customMetric(String name)
- Returns:
Trueifnameis or start with the custom metric prefix.
-
customName
public static String customName(String name)
AddsGridMetricManager.CUSTOM_METRICStoname.
-
fromFullName
public static T2<String,String> fromFullName(String name)
Splits full metric name to registry name and metric name.- Parameters:
name- Full metric name.- Returns:
- Array consist of registry name and metric name.
-
cacheMetricsRegistryName
public static String cacheMetricsRegistryName(String cacheName, boolean isNear)
- Parameters:
cacheName- Cache name.isNear- Is near flag.- Returns:
- Cache metrics registry name.
-
cacheGroupMetricsRegistryName
public static String cacheGroupMetricsRegistryName(String cacheOrGroupName)
- Parameters:
cacheOrGroupName- Cache or group name, depending whether group is implicit or not.- Returns:
- Cache metrics registry name.
-
compareAndSet
public static boolean compareAndSet(AtomicLongMetric m, long expect, long update)
Atomically sets the value to the given updated value if the current value==the expected value.- Parameters:
m- Metric.expect- The expected value.update- The new value.- Returns:
trueif successful. False return indicates that the actual value was not equal to the expected value.
-
setIfLess
public static void setIfLess(AtomicLongMetric m, long update)
Update metrics value only if current value if less thenupdate.- Parameters:
m- Metric to update.update- New value.
-
setIfGreater
public static void setIfGreater(AtomicLongMetric m, long update)
Update metrics value only if current value if greater thenupdate.- Parameters:
m- Metric to update.update- New value.
-
histogramBucketNames
public static String[] histogramBucketNames(HistogramMetric metric)
Generates histogram bucket names. Example of metric names if bounds are 10,100: histogram_0_10 (less than 10) histogram_10_100 (between 10 and 100) histogram_100_inf (more than 100)- Parameters:
metric- Histogram metric- Returns:
- Histogram intervals names.
-
toSqlName
public static String toSqlName(String name)
Build SQL-like name from Java code style name. Some examples: cacheName -> CACHE_NAME. affinitiKeyName -> AFFINITY_KEY_NAME.- Parameters:
name- Name to convert.- Returns:
- SQL compatible name.
-
systemViewAttributes
public static Map<String,Class<?>> systemViewAttributes(SystemView<?> sysView)
Extract attributes for system view.- Parameters:
sysView- System view.- Returns:
- Attributes map.
-
-