Package io.opentelemetry.api.metrics
Interface Meter
-
@ThreadSafe public interface MeterMeter is a simple, interface that allows users to record measurements (metrics).There are two ways to record measurements:
- Record raw measurements, and defer defining the aggregation and the labels for the exported Instrument. This should be used in libraries like gRPC to record measurements like "server_latency" or "received_bytes".
- Record pre-defined aggregation data (or already aggregated data). This should be used to report cpu/memory usage, or simple metrics like "queue_length".
TODO: Update comment.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description DoubleCounter.BuilderdoubleCounterBuilder(java.lang.String name)Returns a builder for aDoubleCounter.DoubleSumObserver.BuilderdoubleSumObserverBuilder(java.lang.String name)Returns a new builder for aDoubleSumObserver.DoubleUpDownCounter.BuilderdoubleUpDownCounterBuilder(java.lang.String name)Returns a builder for aDoubleUpDownCounter.DoubleUpDownSumObserver.BuilderdoubleUpDownSumObserverBuilder(java.lang.String name)Returns a new builder for aDoubleUpDownSumObserver.DoubleValueObserver.BuilderdoubleValueObserverBuilder(java.lang.String name)Returns a new builder for aDoubleValueObserver.DoubleValueRecorder.BuilderdoubleValueRecorderBuilder(java.lang.String name)Returns a new builder for aDoubleValueRecorder.static MetergetDefault()Returns aMeterthat only creates no-opInstruments that neither record nor are emitted.LongCounter.BuilderlongCounterBuilder(java.lang.String name)Returns a builder for aLongCounter.LongSumObserver.BuilderlongSumObserverBuilder(java.lang.String name)Returns a new builder for aLongSumObserver.LongUpDownCounter.BuilderlongUpDownCounterBuilder(java.lang.String name)Returns a builder for aLongUpDownCounter.LongUpDownSumObserver.BuilderlongUpDownSumObserverBuilder(java.lang.String name)Returns a new builder for aLongUpDownSumObserver.LongValueObserver.BuilderlongValueObserverBuilder(java.lang.String name)Returns a new builder for aLongValueObserver.LongValueRecorder.BuilderlongValueRecorderBuilder(java.lang.String name)Returns a new builder for aLongValueRecorder.BatchRecordernewBatchRecorder(java.lang.String... keyValuePairs)Utility method that allows users to atomically record measurements to a set of Instruments with a common set of labels.
-
-
-
Method Detail
-
getDefault
static Meter getDefault()
Returns aMeterthat only creates no-opInstruments that neither record nor are emitted.
-
doubleCounterBuilder
DoubleCounter.Builder doubleCounterBuilder(java.lang.String name)
Returns a builder for aDoubleCounter.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a
DoubleCounter.Builder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longCounterBuilder
LongCounter.Builder longCounterBuilder(java.lang.String name)
Returns a builder for aLongCounter.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a
LongCounter.Builder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
doubleUpDownCounterBuilder
DoubleUpDownCounter.Builder doubleUpDownCounterBuilder(java.lang.String name)
Returns a builder for aDoubleUpDownCounter.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a
DoubleCounter.Builder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longUpDownCounterBuilder
LongUpDownCounter.Builder longUpDownCounterBuilder(java.lang.String name)
Returns a builder for aLongUpDownCounter.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a
LongCounter.Builder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
doubleValueRecorderBuilder
DoubleValueRecorder.Builder doubleValueRecorderBuilder(java.lang.String name)
Returns a new builder for aDoubleValueRecorder.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
DoubleValueRecorder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longValueRecorderBuilder
LongValueRecorder.Builder longValueRecorderBuilder(java.lang.String name)
Returns a new builder for aLongValueRecorder.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
LongValueRecorder. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
doubleSumObserverBuilder
DoubleSumObserver.Builder doubleSumObserverBuilder(java.lang.String name)
Returns a new builder for aDoubleSumObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
DoubleSumObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longSumObserverBuilder
LongSumObserver.Builder longSumObserverBuilder(java.lang.String name)
Returns a new builder for aLongSumObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
LongSumObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
doubleUpDownSumObserverBuilder
DoubleUpDownSumObserver.Builder doubleUpDownSumObserverBuilder(java.lang.String name)
Returns a new builder for aDoubleUpDownSumObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
DoubleUpDownObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longUpDownSumObserverBuilder
LongUpDownSumObserver.Builder longUpDownSumObserverBuilder(java.lang.String name)
Returns a new builder for aLongUpDownSumObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
LongUpDownSumObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
doubleValueObserverBuilder
DoubleValueObserver.Builder doubleValueObserverBuilder(java.lang.String name)
Returns a new builder for aDoubleValueObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
DoubleValueObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
longValueObserverBuilder
LongValueObserver.Builder longValueObserverBuilder(java.lang.String name)
Returns a new builder for aLongValueObserver.- Parameters:
name- the name of the instrument. Should be a ASCII string with a length no greater than 255 characters.- Returns:
- a new builder for a
LongValueObserver. - Throws:
java.lang.NullPointerException- ifnameis null.java.lang.IllegalArgumentException- if different metric with the same name already registered.java.lang.IllegalArgumentException- if thenamedoes not match the requirements.
-
newBatchRecorder
BatchRecorder newBatchRecorder(java.lang.String... keyValuePairs)
Utility method that allows users to atomically record measurements to a set of Instruments with a common set of labels.- Parameters:
keyValuePairs- The set of labels to associate with this recorder and all it's recordings.- Returns:
- a
MeasureBatchRecorderthat can be use to atomically record a set of measurements associated with different Measures.
-
-