@ThreadSafe public interface DoubleMeasure extends Measure<DoubleMeasure.BoundDoubleMeasure>
Example:
class YourClass {
private static final Meter meter = OpenTelemetry.getMeterRegistry().get("my_library_name");
private static final DoubleMeasure measure =
meter.
.measureDoubleBuilder("doWork_latency")
.setDescription("gRPC Latency")
.setUnit("ms")
.build();
private static final BoundDoubleMeasure boundMeasure = measure.bind(labelset);
void doWork() {
long startTime = System.nanoTime();
// Your code here.
boundMeasure.record((System.nanoTime() - startTime) / 1e6);
}
}
| Modifier and Type | Interface and Description |
|---|---|
static interface |
DoubleMeasure.BoundDoubleMeasure
A
Bound Instrument for a LongMeasure. |
static interface |
DoubleMeasure.Builder
Builder class for
DoubleMeasure. |
InstrumentWithBinding.BoundInstrument| Modifier and Type | Method and Description |
|---|---|
DoubleMeasure.BoundDoubleMeasure |
bind(String... labelKeyValuePairs)
Returns a
Bound Instrument associated with the specified labels. |
void |
record(double value,
String... labelKeyValuePairs)
Records the given measurement, associated with the current
Context and provided
LabelSet. |
void record(double value,
String... labelKeyValuePairs)
Context and provided
LabelSet.value - the measurement to record.labelKeyValuePairs - the set of labels to be associated to this recordingIllegalArgumentException - if value is negative.DoubleMeasure.BoundDoubleMeasure bind(String... labelKeyValuePairs)
InstrumentWithBindingBound Instrument associated with the specified labels. Multiples requests
with the same set of labels may return the same Bound Instrument instance.
It is recommended that callers keep a reference to the Bound Instrument instead of always calling this method for every operation.
bind in interface InstrumentWithBinding<DoubleMeasure.BoundDoubleMeasure>labelKeyValuePairs - the set of labels, as key-value pairs.Bound Instrument