Interface | Description |
---|---|
ConcurrentGauge |
A concurrent gauge is a gauge that measures parallel invocations of a method.
|
Counter |
An incrementing counter metric.
|
Counting |
An interface for metric types which have counts.
|
Gauge<T> |
A gauge metric is an instantaneous reading of a particular value.
|
Histogram |
A metric which calculates the distribution of a value.
|
Metadata |
Bean holding the metadata of one single metric.
|
Meter |
A meter metric which measures mean throughput and one-, five-, and fifteen-minute
exponentially-weighted moving average throughputs.
|
Metered |
An object which maintains mean and exponentially-weighted rate.
|
Metric |
A tag interface to indicate that a class is a metric.
|
MetricFilter |
A filter used to determine whether or not a metric should be reported, among other things.
|
MetricRegistry |
The registry that stores metrics and their metadata.
|
Sampling |
An object which samples values.
|
SimpleTimer |
A simple timer metric which tracks elapsed time durations and count.
|
SimpleTimer.Context |
A timing context.
|
Timer |
A timer metric which aggregates timing durations and provides duration statistics, plus
throughput statistics via
Meter . |
Timer.Context |
A timing context.
|
Class | Description |
---|---|
DefaultMetadata |
The default implementation of
Metadata |
MetadataBuilder |
The
Metadata builder. |
MetricID |
A unique identifier for
Metric and Metadata that are registered
in the MetricRegistry
The MetricID contains:
Name : (Required) The name of the metric. |
MetricUnits |
Standard units constants for metric's
Metadata . |
Snapshot |
A statistical snapshot of a
Snapshot . |
Tag |
Tag represents a singular metric tag key and value pair.
|
Enum | Description |
---|---|
MetricRegistry.Type |
An enumeration representing the scopes of the MetricRegistry
|
MetricType |
An enumeration representing the different types of metrics.
|
To ensure reliable operation of software it is necessary to monitor essential system parameters. There is already JMX as standard to expose metrics, but remote-JMX is not easy to deal with and especially does not fit well in a polyglot environment where other services are not running on the JVM. To enable monitoring in an easy fashion, the MicroProfile Metrics specification provides a standard to instrument an application with metrics and provides a simple REST endpoint for integration with monitoring services.
MicroProfile Metrics provides 6 different metric types that can be used to
instrument an application. Developers can create an accompanying
Metadata
object to supply
the metric's name, description, display name, and units. Once the
metric and the metadata are registered against the application
MetricRegistry
, the
metrics will be available in the REST endpoints.
Counter
is used to measure
an increasing value.
Example usage:
Counter count = metricRegistry.counter(metadata);
count.inc();
ConcurrentGauge
is used
to monitor the number of concurrent invocations of a component.
Example usage:
ConcurrentGauge cgauge = metricRegistry.concurrentGauge(metadata);
cgauge.inc();
// .. a block of code that can be executed by multiple threads at the same time
cgauge.dec();
Gauge
is used to provide the
immediate measurement of a value.
Example usage:
Gauge<Double> temperature = new Gauge<Double>() {
public Double getValue() {
return getTemperature();
}
};
metricRegistry.register(metadata, temperature);
Meter
is used to measure the
frequency of an event.
Example usage:
Meter meter = metricRegistry.meter(metadata);
meter.mark();
Histogram
is used to
sample and compute the distribution of values
Example usage:
Histogram histogram = metricRegistry.histogram(metadata);
histogram.update(score);
Timer
is used to measure the
duration of an event as well as the frequency of occurrence.
Example usage:
Timer timer = metricRegistry.timer(metadata);
Timer.Context context = timer.time();
... // code that will be timed
context.close();
SimpleTimer
is used to measure the
duration of an event.
Example usage:
SimpleTimer simpleTimer = metricRegistry.simpleTimer(metadata);
SimpleTimer.Context context = simpleTimer.time();
... // code that will be timed
context.close();