Package io.opencensus.metrics
Class MetricRegistry
java.lang.Object
io.opencensus.metrics.MetricRegistry
- Direct Known Subclasses:
MetricRegistry.NoopMetricRegistry
,MetricRegistryImpl
Creates and manages your application's set of metrics. The default implementation of this creates
a
MetricProducer
and registers it to the global MetricProducerManager
.- Since:
- 0.17
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract DerivedDoubleCumulative
addDerivedDoubleCumulative
(String name, MetricOptions options) Builds a new derived double cumulative to be added to the registry.abstract DerivedDoubleGauge
addDerivedDoubleGauge
(String name, MetricOptions options) Builds a new derived double gauge to be added to the registry.Deprecated.abstract DerivedLongCumulative
addDerivedLongCumulative
(String name, MetricOptions options) Builds a new derived long cumulative to be added to the registry.abstract DerivedLongGauge
addDerivedLongGauge
(String name, MetricOptions options) Builds a new derived long gauge to be added to the registry.Deprecated.since 0.20, useaddDerivedLongGauge(String, MetricOptions)
.abstract DoubleCumulative
addDoubleCumulative
(String name, MetricOptions options) Builds a new double cumulative to be added to the registry.abstract DoubleGauge
addDoubleGauge
(String name, MetricOptions options) Builds a new double gauge to be added to the registry.Deprecated.since 0.20, useaddDoubleGauge(String, MetricOptions)
.abstract LongCumulative
addLongCumulative
(String name, MetricOptions options) Builds a new long cumulative to be added to the registry.abstract LongGauge
addLongGauge
(String name, MetricOptions options) Builds a new long gauge to be added to the registry.Deprecated.since 0.20, useaddLongGauge(String, MetricOptions)
.(package private) static MetricRegistry
-
Constructor Details
-
MetricRegistry
public MetricRegistry()
-
-
Method Details
-
addLongGauge
@Deprecated public LongGauge addLongGauge(String name, String description, String unit, List<LabelKey> labelKeys) Deprecated.since 0.20, useaddLongGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addLongGauge
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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.20
-
addDoubleGauge
@Deprecated public DoubleGauge addDoubleGauge(String name, String description, String unit, List<LabelKey> labelKeys) Deprecated.since 0.20, useaddDoubleGauge(String, MetricOptions)
.This will be removed in 0.22.- Since:
- 0.17
-
addDoubleGauge
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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.20
-
addDerivedLongGauge
@Deprecated public DerivedLongGauge addDerivedLongGauge(String name, String description, String unit, 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(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.17
-
addDerivedDoubleGauge
@Deprecated public DerivedDoubleGauge addDerivedDoubleGauge(String name, String description, String unit, 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(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.17
-
addLongCumulative
@ExperimentalApi public abstract LongCumulative addLongCumulative(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDoubleCumulative
@ExperimentalApi public abstract DoubleCumulative addDoubleCumulative(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDerivedLongCumulative
@ExperimentalApi public abstract DerivedLongCumulative addDerivedLongCumulative(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
addDerivedDoubleCumulative
@ExperimentalApi public abstract DerivedDoubleCumulative addDerivedDoubleCumulative(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:
NullPointerException
- ifname
is null.IllegalArgumentException
- if different metric with the same name already registered.- Since:
- 0.21
-
newNoopMetricRegistry
-
addDerivedDoubleGauge(String, MetricOptions)
.