Package io.opencensus.metrics
Class MetricRegistry
- java.lang.Object
-
- io.opencensus.metrics.MetricRegistry
-
- Direct Known Subclasses:
MetricRegistry.NoopMetricRegistry
,MetricRegistryImpl
@ExperimentalApi public abstract class MetricRegistry extends java.lang.Object
Creates and manages your application's set of metrics. The default implementation of this creates aMetricProducer
and registers it to the globalMetricProducerManager
.- Since:
- 0.17
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
MetricRegistry.NoopMetricRegistry
-
Constructor Summary
Constructors Constructor Description MetricRegistry()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract DerivedDoubleCumulative
addDerivedDoubleCumulative(java.lang.String name, MetricOptions options)
Builds a new derived double cumulative to be added to the registry.abstract DerivedDoubleGauge
addDerivedDoubleGauge(java.lang.String name, MetricOptions options)
Builds a new derived double gauge to be added to the registry.DerivedDoubleGauge
addDerivedDoubleGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDerivedDoubleGauge(String, MetricOptions)
.abstract DerivedLongCumulative
addDerivedLongCumulative(java.lang.String name, MetricOptions options)
Builds a new derived long cumulative to be added to the registry.abstract DerivedLongGauge
addDerivedLongGauge(java.lang.String name, MetricOptions options)
Builds a new derived long gauge to be added to the registry.DerivedLongGauge
addDerivedLongGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDerivedLongGauge(String, MetricOptions)
.abstract DoubleCumulative
addDoubleCumulative(java.lang.String name, MetricOptions options)
Builds a new double cumulative to be added to the registry.abstract DoubleGauge
addDoubleGauge(java.lang.String name, MetricOptions options)
Builds a new double gauge to be added to the registry.DoubleGauge
addDoubleGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDoubleGauge(String, MetricOptions)
.abstract LongCumulative
addLongCumulative(java.lang.String name, MetricOptions options)
Builds a new long cumulative to be added to the registry.abstract LongGauge
addLongGauge(java.lang.String name, MetricOptions options)
Builds a new long gauge to be added to the registry.LongGauge
addLongGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddLongGauge(String, MetricOptions)
.(package private) static MetricRegistry
newNoopMetricRegistry()
-
-
-
Method Detail
-
addLongGauge
@Deprecated public LongGauge addLongGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddLongGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addLongGauge
@ExperimentalApi public abstract LongGauge addLongGauge(java.lang.String name, MetricOptions options)
Builds a new long gauge to be added to the registry. This is a more convenient form when you want to manually increase and decrease values as per your service requirements.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
LongGauge
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.20
-
addDoubleGauge
@Deprecated public DoubleGauge addDoubleGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDoubleGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addDoubleGauge
@ExperimentalApi public abstract DoubleGauge addDoubleGauge(java.lang.String name, MetricOptions options)
Builds a new double gauge to be added to the registry. This is a more convenient form when you want to manually increase and decrease values as per your service requirements.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DoubleGauge
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.20
-
addDerivedLongGauge
@Deprecated public DerivedLongGauge addDerivedLongGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDerivedLongGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addDerivedLongGauge
@ExperimentalApi public abstract DerivedLongGauge addDerivedLongGauge(java.lang.String name, MetricOptions options)
Builds a new derived long gauge to be added to the registry. This is a more convenient form when you want to define a gauge by executing aToLongFunction
on an object.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DerivedLongGauge
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.17
-
addDerivedDoubleGauge
@Deprecated public DerivedDoubleGauge addDerivedDoubleGauge(java.lang.String name, java.lang.String description, java.lang.String unit, java.util.List<LabelKey> labelKeys)
Deprecated.since 0.20, useaddDerivedDoubleGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addDerivedDoubleGauge
@ExperimentalApi public abstract DerivedDoubleGauge addDerivedDoubleGauge(java.lang.String name, MetricOptions options)
Builds a new derived double gauge to be added to the registry. This is a more convenient form when you want to define a gauge by executing aToDoubleFunction
on an object.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DerivedDoubleGauge
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.17
-
addLongCumulative
@ExperimentalApi public abstract LongCumulative addLongCumulative(java.lang.String name, MetricOptions options)
Builds a new long cumulative to be added to the registry. This is a more convenient form when you want to manually increase values as per your service requirements.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
LongCumulative
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDoubleCumulative
@ExperimentalApi public abstract DoubleCumulative addDoubleCumulative(java.lang.String name, MetricOptions options)
Builds a new double cumulative to be added to the registry. This is a more convenient form when you want to manually increase values as per your service requirements.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DoubleCumulative
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDerivedLongCumulative
@ExperimentalApi public abstract DerivedLongCumulative addDerivedLongCumulative(java.lang.String name, MetricOptions options)
Builds a new derived long cumulative to be added to the registry. This is a more convenient form when you want to define a cumulative by executing aToLongFunction
on an object.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DerivedLongCumulative
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDerivedDoubleCumulative
@ExperimentalApi public abstract DerivedDoubleCumulative addDerivedDoubleCumulative(java.lang.String name, MetricOptions options)
Builds a new derived double cumulative to be added to the registry. This is a more convenient form when you want to define a cumulative by executing aToDoubleFunction
on an object.- Parameters:
name
- the name of the metric.options
- the options for the metric.- Returns:
- a
DerivedDoubleCumulative
. - Throws:
java.lang.NullPointerException
- ifname
is null.java.lang.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
newNoopMetricRegistry
static MetricRegistry newNoopMetricRegistry()
-
-