use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SdkDoubleHistogramTest method doubleHistogramRecord_NonNegativeCheck.
@Test
@SuppressLogger(SdkDoubleHistogram.class)
void doubleHistogramRecord_NonNegativeCheck() {
DoubleHistogram histogram = sdkMeter.histogramBuilder("testHistogram").build();
histogram.record(-45);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Histograms can only record non-negative values. Instrument testHistogram has recorded a negative value.");
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SdkLongCounterTest method longCounterAdd_Monotonicity.
@Test
@SuppressLogger(SdkLongCounter.class)
void longCounterAdd_Monotonicity() {
LongCounter longCounter = sdkMeter.counterBuilder("testCounter").build();
longCounter.add(-45);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Counters can only increase. Instrument testCounter has recorded a negative value.");
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SdkLongCounterTest method boundLongCounterAdd_Monotonicity.
@Test
@SuppressLogger(SdkLongCounter.class)
void boundLongCounterAdd_Monotonicity() {
LongCounter longCounter = sdkMeter.counterBuilder("testCounter").build();
BoundLongCounter bound = ((SdkLongCounter) longCounter).bind(Attributes.empty());
try {
bound.add(-9);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Counters can only increase. Instrument testCounter has recorded a negative value.");
} finally {
bound.unbind();
}
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SdkLongHistogramTest method longHistogramRecord_NonNegativeCheck.
@Test
@SuppressLogger(SdkLongHistogram.class)
void longHistogramRecord_NonNegativeCheck() {
LongHistogram histogram = sdkMeter.histogramBuilder("testHistogram").ofLongs().build();
histogram.record(-45);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Histograms can only record non-negative values. Instrument testHistogram has recorded a negative value.");
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class AbstractGrpcTelemetryExporterTest method tls_untrusted.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
@SuppressLogger(DefaultGrpcExporter.class)
void tls_untrusted() {
TelemetryExporter<T> exporter = exporterBuilder().setEndpoint(server.httpsUri().toString()).build();
try {
CompletableResultCode result = exporter.export(Collections.singletonList(generateFakeTelemetry()));
assertThat(result.join(10, TimeUnit.SECONDS).isSuccess()).isFalse();
} finally {
exporter.shutdown();
}
}
Aggregations