Class ExtendedDefaultMeter.NoopDoubleGaugeBuilder
- java.lang.Object
-
- io.opentelemetry.api.incubator.metrics.ExtendedDefaultMeter.NoopDoubleGaugeBuilder
-
- All Implemented Interfaces:
ExtendedDoubleGaugeBuilder
,DoubleGaugeBuilder
- Enclosing class:
- ExtendedDefaultMeter
private static class ExtendedDefaultMeter.NoopDoubleGaugeBuilder extends java.lang.Object implements ExtendedDoubleGaugeBuilder
-
-
Field Summary
Fields Modifier and Type Field Description private static ExtendedDefaultMeter.NoopDoubleGauge
NOOP_GAUGE
private static LongGaugeBuilder
NOOP_LONG_GAUGE_BUILDER
private static ObservableDoubleGauge
NOOP_OBSERVABLE_GAUGE
-
Constructor Summary
Constructors Modifier Constructor Description private
NoopDoubleGaugeBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DoubleGauge
build()
Builds and returns a DoubleGauge instrument with the configuration.ObservableDoubleMeasurement
buildObserver()
Build an observer for this instrument to observe values from aBatchCallback
.ObservableDoubleGauge
buildWithCallback(java.util.function.Consumer<ObservableDoubleMeasurement> callback)
Builds an Asynchronous Gauge instrument with the given callback.LongGaugeBuilder
ofLongs()
Sets the Gauge for recordinglong
values.DoubleGaugeBuilder
setDescription(java.lang.String description)
Sets the description for this instrument.DoubleGaugeBuilder
setUnit(java.lang.String unit)
Sets the unit of measure for this instrument.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.opentelemetry.api.incubator.metrics.ExtendedDoubleGaugeBuilder
setAttributesAdvice
-
-
-
-
Field Detail
-
NOOP_OBSERVABLE_GAUGE
private static final ObservableDoubleGauge NOOP_OBSERVABLE_GAUGE
-
NOOP_LONG_GAUGE_BUILDER
private static final LongGaugeBuilder NOOP_LONG_GAUGE_BUILDER
-
NOOP_GAUGE
private static final ExtendedDefaultMeter.NoopDoubleGauge NOOP_GAUGE
-
-
Method Detail
-
setDescription
public DoubleGaugeBuilder setDescription(java.lang.String description)
Description copied from interface:DoubleGaugeBuilder
Sets the description for this instrument.- Specified by:
setDescription
in interfaceDoubleGaugeBuilder
- Parameters:
description
- The description.- See Also:
- Instrument Description
-
setUnit
public DoubleGaugeBuilder setUnit(java.lang.String unit)
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:
- Instrument Unit
-
ofLongs
public LongGaugeBuilder ofLongs()
Description copied from interface:DoubleGaugeBuilder
Sets the Gauge for recordinglong
values.- Specified by:
ofLongs
in interfaceDoubleGaugeBuilder
-
buildWithCallback
public ObservableDoubleGauge buildWithCallback(java.util.function.Consumer<ObservableDoubleMeasurement> callback)
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
public ObservableDoubleMeasurement 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
public DoubleGauge 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.
-
-