@ThreadSafe public final class MetricsSystem extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MetricsSystem.InstanceType
An enum of supported instance type.
|
Modifier and Type | Field and Description |
---|---|
static String |
CLUSTER |
static com.codahale.metrics.MetricRegistry |
METRIC_REGISTRY |
static String |
SINK_REGEX |
Modifier and Type | Method and Description |
---|---|
static List<Metric> |
allClientMetrics() |
static List<Metric> |
allMasterMetrics() |
static List<Metric> |
allWorkerMetrics() |
static void |
checkMinimalPollingPeriod(TimeUnit pollUnit,
int pollPeriod)
Checks if the poll period is smaller that the minimal poll period which is 1 second.
|
static void |
clearAllMetrics()
Resets the metric registry and removes all the metrics.
|
static com.codahale.metrics.Counter |
counter(String name) |
static String |
escape(AlluxioURI uri)
Escapes a URI, replacing "/" with "%2F".
|
static String |
getClusterMetricName(String name)
Builds metric registry names for cluster.
|
static String |
getJobWorkerMetricName(String name)
Builds metric registry name for job worker instance.
|
static String |
getMetricName(String name)
Converts a simple string to a qualified metric name based on the process type.
|
static int |
getNumSinks() |
static com.codahale.metrics.Meter |
meter(String name) |
static <T> void |
registerGaugeIfAbsent(String name,
com.codahale.metrics.Gauge<T> metric)
Registers a gauge if it has not been registered.
|
static List<Metric> |
reportClientMetrics() |
static List<Metric> |
reportWorkerMetrics() |
static void |
resetCountersAndGauges()
Resets all counters to 0 and unregisters gauges for testing.
|
static void |
startSinks(String metricsConfFile)
Starts sinks specified in the configuration.
|
static void |
startSinksFromConfig(MetricsConfig config)
Starts sinks from a given metrics configuration.
|
static void |
stopSinks()
Stops all the sinks.
|
static String |
stripInstanceAndHost(String metricsName)
Removes the instance and host from the given metric name, returning the result.
|
static com.codahale.metrics.Timer |
timer(String name) |
static String |
unescape(String uri)
Unescapes a URI, reverts it to before the escape, to display it correctly.
|
public static final String CLUSTER
public static final com.codahale.metrics.MetricRegistry METRIC_REGISTRY
public static final String SINK_REGEX
public static void startSinks(String metricsConfFile)
metricsConfFile
- the location of the metrics configuration filepublic static void startSinksFromConfig(MetricsConfig config)
config
- the metrics configpublic static void stopSinks()
public static int getNumSinks()
public static String getMetricName(String name)
name
- the name of the metricpublic static String getClusterMetricName(String name)
name
- the metric namepublic static String getJobWorkerMetricName(String name)
name
- the metric namepublic static void checkMinimalPollingPeriod(TimeUnit pollUnit, int pollPeriod) throws IllegalArgumentException
pollUnit
- the polling unitpollPeriod
- the polling periodIllegalArgumentException
- if the polling period is invalidpublic static String stripInstanceAndHost(String metricsName)
metricsName
- the long metrics name with instance and host namepublic static String escape(AlluxioURI uri)
uri
- the URI to escapepublic static String unescape(String uri)
uri
- the escaped URI to unescapepublic static com.codahale.metrics.Counter counter(String name)
name
- the name of the metricpublic static com.codahale.metrics.Meter meter(String name)
name
- the name of the metricpublic static com.codahale.metrics.Timer timer(String name)
name
- the name of the metricpublic static <T> void registerGaugeIfAbsent(String name, com.codahale.metrics.Gauge<T> metric)
T
- the typename
- the gauge namemetric
- the gaugepublic static void resetCountersAndGauges()
public static List<Metric> reportWorkerMetrics()
public static List<Metric> reportClientMetrics()
public static List<Metric> allMasterMetrics()
Metric
public static List<Metric> allWorkerMetrics()
Metric
public static List<Metric> allClientMetrics()
Metric
public static void clearAllMetrics()
Copyright © 2023. All Rights Reserved.