use of io.micrometer.core.instrument.Gauge in project micrometer by micrometer-metrics.
the class KairosMeterRegistryTest method writeGaugeShouldDropNanValue.
@Test
void writeGaugeShouldDropNanValue() {
meterRegistry.gauge("my.gauge", Double.NaN);
Gauge gauge = meterRegistry.find("my.gauge").gauge();
assertThat(meterRegistry.writeGauge(gauge)).isEmpty();
}
use of io.micrometer.core.instrument.Gauge in project micrometer by micrometer-metrics.
the class KairosMeterRegistryTest method writeGauge.
@Test
void writeGauge() {
meterRegistry.gauge("my.gauge", 1d);
Gauge gauge = meterRegistry.find("my.gauge").gauge();
assertThat(meterRegistry.writeGauge(gauge)).hasSize(1);
}
use of io.micrometer.core.instrument.Gauge in project micrometer by micrometer-metrics.
the class MetricSchemaCompatibilityTest method semanticMetricTypes.
/**
* Assuring that when the configuration flag useSemanticMetricTypes is set,
* metric types matching their meaning are used.
*/
@Test
void semanticMetricTypes() {
config.put("stackdriver.useSemanticMetricTypes", "true");
assertSchemaCompatibility(Collections.singletonList(new Pair(GAUGE, DOUBLE)), registry.createGauge(batch, Gauge.builder("gauge", () -> 1).register(registry)));
assertSchemaCompatibility(Collections.singletonList(new Pair(CUMULATIVE, DOUBLE)), registry.createCounter(batch, Counter.builder("counter").register(registry)));
assertSchemaCompatibility(Arrays.asList(new Pair(GAUGE, DISTRIBUTION), new Pair(GAUGE, DOUBLE), new Pair(CUMULATIVE, INT64)), registry.createTimer(batch, Timer.builder("timer").register(registry)));
assertSchemaCompatibility(Arrays.asList(new Pair(GAUGE, DISTRIBUTION), new Pair(GAUGE, DOUBLE), new Pair(CUMULATIVE, INT64)), registry.createSummary(batch, DistributionSummary.builder("summary").register(registry)));
assertSchemaCompatibility(Arrays.asList(new Pair(GAUGE, INT64), new Pair(GAUGE, DOUBLE)), registry.createLongTaskTimer(batch, LongTaskTimer.builder("longTaskTimer").register(registry)));
assertSchemaCompatibility(Collections.singletonList(new Pair(GAUGE, DOUBLE)), registry.createTimeGauge(batch, TimeGauge.builder("timeGauge", () -> 1, TimeUnit.SECONDS).register(registry)));
assertSchemaCompatibility(Collections.singletonList(new Pair(CUMULATIVE, DOUBLE)), registry.createFunctionCounter(batch, FunctionCounter.builder("functionCounter", 1, value -> 1).register(registry)));
assertSchemaCompatibility(Collections.singletonList(new Pair(GAUGE, DISTRIBUTION)), registry.createFunctionTimer(batch, FunctionTimer.builder("functionTimer", 1, value -> 1, value -> 1, TimeUnit.SECONDS).register(registry)));
assertSchemaCompatibility(Collections.singletonList(new Pair(GAUGE, DOUBLE)), registry.createMeter(batch, Meter.builder("gauge", Meter.Type.OTHER, Collections.singletonList(new Measurement(() -> 1.0, Statistic.UNKNOWN))).register(registry)));
}
use of io.micrometer.core.instrument.Gauge in project micrometer by micrometer-metrics.
the class HumioMeterRegistryTest method writeGaugeShouldDropPositiveInfiniteValue.
@Test
void writeGaugeShouldDropPositiveInfiniteValue() {
meterRegistry.gauge("my.gauge", Double.POSITIVE_INFINITY);
Gauge gauge = meterRegistry.find("my.gauge").gauge();
assertThat(createBatch().writeGauge(gauge)).isNull();
}
use of io.micrometer.core.instrument.Gauge in project micrometer by micrometer-metrics.
the class HumioMeterRegistryTest method writeGauge.
@Test
void writeGauge() {
meterRegistry.gauge("my.gauge", 1d);
Gauge gauge = meterRegistry.find("my.gauge").gauge();
assertThat(createBatch().writeGauge(gauge)).isNotNull();
}
Aggregations