public class MetricManager extends Object
Provides methods to allow agents to go through the registered metrics and gather/report the statistics.
This uses a service locator to initialise a underlying PluginMetricManager instance. A default implementation of PluginMetricManager is provided by avaje-metric-core.
Constructor and Description |
---|
MetricManager() |
Modifier and Type | Method and Description |
---|---|
static Collection<Metric> |
collectNonEmptyMetrics()
Return all the non-jvm registered metrics that are not empty.
|
static CounterMetric |
getCounterMetric(Class<?> cls,
String eventName)
Return a CounterMetric using the Class and name to derive the MetricName.
|
static CounterMetric |
getCounterMetric(MetricName name)
Return a CounterMetric given the name.
|
static CounterMetric |
getCounterMetric(String name)
Return a CounterMetric given the name.
|
static Collection<Metric> |
getJvmMetrics()
Return the core JVM metrics.
|
static MetricNameCache |
getMetricNameCache(Class<?> cls)
Return a MetricNameCache for the given class.
|
static MetricNameCache |
getMetricNameCache(MetricName baseName)
Return a MetricNameCache for a given base metric name.
|
static Collection<Metric> |
getMetrics()
Return all the non-jvm registered metrics.
|
static TimedMetric |
getTimedMetric(Class<?> cls,
String eventName)
Return a TimedMetric using the Class, name to derive the MetricName.
|
static BucketTimedMetric |
getTimedMetric(Class<?> cls,
String name,
int... bucketRanges)
Return a BucketTimedMetric given the name and bucket ranges.
|
static TimedMetric |
getTimedMetric(MetricName name)
Return a TimedMetric given the name.
|
static BucketTimedMetric |
getTimedMetric(MetricName name,
int... bucketRanges)
Return a BucketTimedMetric given the name and bucket ranges.
|
static TimedMetric |
getTimedMetric(String name)
Return a TimedMetric given the name.
|
static BucketTimedMetric |
getTimedMetric(String name,
int... bucketRanges)
Return a BucketTimedMetric given the name and bucket ranges.
|
static TimedMetricGroup |
getTimedMetricGroup(Class<?> cls)
Return the TimedMetricGroup with a class providing the base metric name.
|
static TimedMetricGroup |
getTimedMetricGroup(MetricName baseName)
Return the TimedMetricGroup with a based metric name.
|
static TimedMetricGroup |
getTimedMetricGroup(String group,
String type)
Return a TimedMetricGroup with a common group and type name.
|
static ValueMetric |
getValueMetric(Class<?> cls,
String eventName)
Return a ValueMetric using the Class and name to derive the MetricName.
|
static ValueMetric |
getValueMetric(MetricName name)
Return a ValueMetric given the name.
|
static ValueMetric |
getValueMetric(String name)
Return a ValueMetric given the name.
|
static MetricName |
name(Class<?> cls,
String name)
Create a MetricName based on a class and name.
|
static MetricName |
name(String name)
Create a Metric name by parsing a name that is expected to include periods (dot notation
similar to package.Class.method).
|
static MetricName |
name(String group,
String type,
String name)
Create a Metric name based on group, type and name.
|
static GaugeDoubleMetric |
register(MetricName name,
GaugeDouble gauge)
Create and register a GaugeMetric using the gauge supplied.
|
static GaugeLongMetric |
register(MetricName name,
GaugeLong gauge)
Create and register a GaugeCounterMetric using the gauge supplied.
|
static GaugeDoubleMetric |
register(String name,
GaugeDouble gauge)
Create and register a GaugeMetric using the gauge supplied.
|
static GaugeLongMetric |
register(String name,
GaugeLong gauge)
Create and register a GaugeCounterMetric using the gauge supplied.
|
public static MetricName name(Class<?> cls, String name)
Often the name maps to a method name.
public static MetricName name(String group, String type, String name)
group
- The group which often maps to a package name.type
- The type which often maps to a simple class name.name
- The name which often maps to a method name.public static MetricName name(String name)
public static MetricNameCache getMetricNameCache(Class<?> cls)
The MetricNameCache can be used to derive MetricName objects dynamically with relatively less overhead.
public static MetricNameCache getMetricNameCache(MetricName baseName)
The MetricNameCache can be used to derive MetricName objects dynamically with relatively less overhead.
public static BucketTimedMetric getTimedMetric(MetricName name, int... bucketRanges)
public static BucketTimedMetric getTimedMetric(Class<?> cls, String name, int... bucketRanges)
public static BucketTimedMetric getTimedMetric(String name, int... bucketRanges)
public static TimedMetric getTimedMetric(MetricName name)
public static TimedMetric getTimedMetric(Class<?> cls, String eventName)
public static TimedMetric getTimedMetric(String name)
public static CounterMetric getCounterMetric(MetricName name)
public static CounterMetric getCounterMetric(String name)
public static CounterMetric getCounterMetric(Class<?> cls, String eventName)
public static ValueMetric getValueMetric(MetricName name)
public static ValueMetric getValueMetric(Class<?> cls, String eventName)
public static ValueMetric getValueMetric(String name)
public static TimedMetricGroup getTimedMetricGroup(MetricName baseName)
public static TimedMetricGroup getTimedMetricGroup(Class<?> cls)
The package name is the 'group' and the simple class name the 'type'.
public static TimedMetricGroup getTimedMetricGroup(String group, String type)
group
- the common group nametype
- the common type namepublic static GaugeDoubleMetric register(MetricName name, GaugeDouble gauge)
public static GaugeDoubleMetric register(String name, GaugeDouble gauge)
public static GaugeLongMetric register(MetricName name, GaugeLong gauge)
public static GaugeLongMetric register(String name, GaugeLong gauge)
public static Collection<Metric> getMetrics()
public static Collection<Metric> collectNonEmptyMetrics()
public static Collection<Metric> getJvmMetrics()
Copyright © 2014. All Rights Reserved.