use of org.slf4j.event.Level.WARN in project opentelemetry-java by open-telemetry.
the class SdkMeterTest method testLongHistogram_upperCaseConflict.
@Test
void testLongHistogram_upperCaseConflict() {
LongHistogram longHistogram = sdkMeter.histogramBuilder("testLongValueRecorder").ofLongs().setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(longHistogram).isNotNull();
assertThat(logs.getEvents()).isEmpty();
sdkMeter.histogramBuilder("testLongValueRecorder".toUpperCase()).ofLongs().build();
assertThat(logs.assertContains(loggingEvent -> loggingEvent.getLevel().equals(WARN), "Failed to register metric.").getThrowable()).hasMessageContaining("Metric with same name and different descriptor already created.");
}
use of org.slf4j.event.Level.WARN in project opentelemetry-java by open-telemetry.
the class SdkMeterTest method testDoubleUpDownCounter.
@Test
void testDoubleUpDownCounter() {
DoubleUpDownCounter doubleUpDownCounter = sdkMeter.upDownCounterBuilder("testDoubleUpDownCounter").ofDoubles().setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(doubleUpDownCounter).isNotNull();
// Note: We no longer get the same instrument instance as these instances are lightweight
// objects backed by storage now. Here we just make sure it doesn't log an error.
sdkMeter.upDownCounterBuilder("testDoubleUpDownCounter").ofDoubles().setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(logs.getEvents()).isEmpty();
sdkMeter.upDownCounterBuilder("testDoubleUpDownCounter").ofDoubles().build();
assertThat(logs.assertContains(loggingEvent -> loggingEvent.getLevel().equals(WARN), "Failed to register metric.").getThrowable()).hasMessageContaining("Metric with same name and different descriptor already created.");
}
use of org.slf4j.event.Level.WARN in project opentelemetry-java by open-telemetry.
the class SdkMeterTest method testLongUpDownCounter.
@Test
void testLongUpDownCounter() {
LongUpDownCounter longUpDownCounter = sdkMeter.upDownCounterBuilder("testLongUpDownCounter").setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(longUpDownCounter).isNotNull();
// Note: We no longer get the same instrument instance as these instances are lightweight
// objects backed by storage now. Here we just make sure it doesn't throw to grab
// a second instance.
sdkMeter.upDownCounterBuilder("testLongUpDownCounter").setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(logs.getEvents()).isEmpty();
sdkMeter.upDownCounterBuilder("testLongUpDownCounter").build();
assertThat(logs.assertContains(loggingEvent -> loggingEvent.getLevel().equals(WARN), "Failed to register metric.").getThrowable()).hasMessageContaining("Metric with same name and different descriptor already created.");
}
use of org.slf4j.event.Level.WARN in project opentelemetry-java by open-telemetry.
the class SdkMeterTest method testLongCounter_upperCaseConflict.
@Test
void testLongCounter_upperCaseConflict() {
LongCounter longCounter = sdkMeter.counterBuilder("testLongCounter").setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(longCounter).isNotNull();
sdkMeter.counterBuilder("testLongCounter".toUpperCase()).build();
assertThat(logs.assertContains(loggingEvent -> loggingEvent.getLevel().equals(WARN), "Failed to register metric.").getThrowable()).hasMessageContaining("Metric with same name and different descriptor already created.");
}
use of org.slf4j.event.Level.WARN in project opentelemetry-java by open-telemetry.
the class SdkMeterTest method testLongCounter.
@Test
void testLongCounter() {
LongCounter longCounter = sdkMeter.counterBuilder("testLongCounter").setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(longCounter).isNotNull();
// Note: We no longer get the same instrument instance as these instances are lightweight
// objects backed by storage now. Here we just make sure it doesn't log a warning.
sdkMeter.counterBuilder("testLongCounter").setDescription("My very own counter").setUnit("metric tonnes").build();
assertThat(logs.getEvents()).isEmpty();
sdkMeter.counterBuilder("testLongCounter").build();
assertThat(logs.assertContains(loggingEvent -> loggingEvent.getLevel().equals(WARN), "Failed to register metric.").getThrowable()).hasMessageContaining("Metric with same name and different descriptor already created.");
}
Aggregations