Package io.opentelemetry.api.metrics
Class DefaultMeter.NoopDoubleGaugeBuilder
java.lang.Object
io.opentelemetry.api.metrics.DefaultMeter.NoopDoubleGaugeBuilder
- All Implemented Interfaces:
DoubleGaugeBuilder
- Enclosing class:
DefaultMeter
private static class DefaultMeter.NoopDoubleGaugeBuilder
extends Object
implements DoubleGaugeBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final DefaultMeter.NoopDoubleGauge
private static final LongGaugeBuilder
private static final ObservableDoubleGauge
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds and returns a DoubleGauge instrument with the configuration.Build an observer for this instrument to observe values from aBatchCallback
.buildWithCallback
(Consumer<ObservableDoubleMeasurement> callback) Builds an Asynchronous Gauge instrument with the given callback.ofLongs()
Sets the Gauge for recordinglong
values.setDescription
(String description) Sets the description for this instrument.Sets the unit of measure for this instrument.
-
Field Details
-
NOOP_OBSERVABLE_GAUGE
-
NOOP_LONG_GAUGE_BUILDER
-
NOOP_GAUGE
-
-
Constructor Details
-
NoopDoubleGaugeBuilder
private NoopDoubleGaugeBuilder()
-
-
Method Details
-
setDescription
Description copied from interface:DoubleGaugeBuilder
Sets the description for this instrument.- Specified by:
setDescription
in interfaceDoubleGaugeBuilder
- Parameters:
description
- The description.- See Also:
-
setUnit
Description copied from interface:DoubleGaugeBuilder
Sets the unit of measure for this instrument.- Specified by:
setUnit
in interfaceDoubleGaugeBuilder
- Parameters:
unit
- The unit. Instrument units must be 63 or fewer ASCII characters.- See Also:
-
ofLongs
Description copied from interface:DoubleGaugeBuilder
Sets the Gauge for recordinglong
values.- Specified by:
ofLongs
in interfaceDoubleGaugeBuilder
-
buildWithCallback
Description copied from interface:DoubleGaugeBuilder
Builds an Asynchronous Gauge instrument with the given callback.The callback will be called when the instrument is being observed.
Callbacks are expected to abide by the following restrictions:
- Run in a finite amount of time.
- Safe to call repeatedly, across multiple threads.
- Specified by:
buildWithCallback
in interfaceDoubleGaugeBuilder
- Parameters:
callback
- A callback which observes measurements when invoked.
-
buildObserver
Description copied from interface:DoubleGaugeBuilder
Build an observer for this instrument to observe values from aBatchCallback
.This observer MUST be registered when creating a
batchCallback
, which records to it. Values observed outside registered callbacks are ignored.- Specified by:
buildObserver
in interfaceDoubleGaugeBuilder
- Returns:
- an observable measurement that batch callbacks use to observe values.
-
build
Description copied from interface:DoubleGaugeBuilder
Builds and returns a DoubleGauge instrument with the configuration.NOTE: This produces a synchronous gauge which records gauge values as they occur. Most users will want to instead register an
DoubleGaugeBuilder.buildWithCallback(Consumer)
to asynchronously observe the value of the gauge when metrics are collected.If using the OpenTelemetry SDK, by default gauges use last value aggregation, such that only the value of the last recorded measurement is exported.
- Specified by:
build
in interfaceDoubleGaugeBuilder
- Returns:
- The DoubleGauge instrument.
-