use of io.opentelemetry.api.metrics.DoubleCounter in project opentelemetry-java-instrumentation by open-telemetry.
the class MeterTest method doubleCounter.
@Test
void doubleCounter() {
DoubleCounter instrument = meter.counterBuilder("test").ofDoubles().setDescription("d").setUnit("u").build();
instrument.add(5.5, Attributes.of(AttributeKey.stringKey("q"), "r"));
instrument.add(6.6, Attributes.of(AttributeKey.stringKey("q"), "r"));
testing.waitAndAssertMetrics(instrumentationName, "test", metrics -> metrics.anySatisfy(metric -> assertThat(metric).hasDescription("d").hasUnit("u").hasInstrumentationLibrary(InstrumentationLibraryInfo.create(instrumentationName, "1.2.3")).hasDoubleSum().isMonotonic().points().satisfiesExactly(point -> assertThat(point).hasValue(12.1).attributes().containsOnly(attributeEntry("q", "r")))));
}
Aggregations