Package io.opentelemetry.api.metrics
Interface AsynchronousInstrument<R extends AsynchronousInstrument.Result>
-
- Type Parameters:
R- the callback Result type.
- All Superinterfaces:
Instrument
- All Known Subinterfaces:
DoubleSumObserver,DoubleUpDownSumObserver,DoubleValueObserver,LongSumObserver,LongUpDownSumObserver,LongValueObserver
@ThreadSafe public interface AsynchronousInstrument<R extends AsynchronousInstrument.Result> extends Instrument
AsynchronousInstrumentis an interface that defines a type of instruments that are used to report measurements asynchronously.They are reported by a callback, once per collection interval, and lack Context. They are permitted to report only one value per distinct label set per period. If the application observes multiple values for the same label set, in a single callback, the last value is the only value kept.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceAsynchronousInstrument.BuilderBuilder class forAsynchronousInstrument.static interfaceAsynchronousInstrument.Callback<R extends AsynchronousInstrument.Result>ACallbackfor aAsynchronousInstrument.static interfaceAsynchronousInstrument.DoubleResultThe result for theAsynchronousInstrument.Callback.static interfaceAsynchronousInstrument.LongResultThe result for theAsynchronousInstrument.Callback.static interfaceAsynchronousInstrument.Result
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidsetCallback(AsynchronousInstrument.Callback<R> callback)Sets a callback that gets executed every collection interval.
-
-
-
Method Detail
-
setCallback
void setCallback(AsynchronousInstrument.Callback<R> callback)
Sets a callback that gets executed every collection interval.Evaluation is deferred until needed, if this
AsynchronousInstrumentmetric is not exported then it will never be called.- Parameters:
callback- the callback to be executed before export.
-
-