use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class SdkDoubleHistogramTest method boundDoubleHistogramRecord_MonotonicityCheck.
@Test
@SuppressLogger(SdkDoubleHistogram.class)
void boundDoubleHistogramRecord_MonotonicityCheck() {
DoubleHistogram histogram = sdkMeter.histogramBuilder("testHistogram").build();
BoundDoubleHistogram bound = ((SdkDoubleHistogram) histogram).bind(Attributes.empty());
try {
bound.record(-9);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Histograms can only record non-negative values. Instrument testHistogram 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 boundLongHistogramRecord_MonotonicityCheck.
@Test
@SuppressLogger(SdkLongHistogram.class)
void boundLongHistogramRecord_MonotonicityCheck() {
LongHistogram histogram = sdkMeter.histogramBuilder("testHistogram").ofLongs().build();
BoundLongHistogram bound = ((SdkLongHistogram) histogram).bind(Attributes.empty());
try {
bound.record(-9);
assertThat(sdkMeterReader.collectAllMetrics()).hasSize(0);
logs.assertContains("Histograms can only record non-negative values. Instrument testHistogram 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 OtlpGrpcRetryTest method configureSpanExporterRetryPolicy.
@Test
@SuppressLogger(DefaultGrpcExporter.class)
void configureSpanExporterRetryPolicy() {
Map<String, String> props = new HashMap<>();
props.put("otel.exporter.otlp.traces.endpoint", "https://localhost:" + server.httpsPort());
props.put("otel.exporter.otlp.traces.certificate", certificate.certificateFile().getAbsolutePath());
props.put("otel.experimental.exporter.otlp.retry.enabled", "true");
try (SpanExporter spanExporter = SpanExporterConfiguration.configureExporter("otlp", DefaultConfigProperties.createForTest(props), NamedSpiManager.createEmpty(), MeterProvider.noop())) {
testRetryableStatusCodes(() -> SPAN_DATA, spanExporter::export, server.traceRequests::size);
testDefaultRetryPolicy(() -> SPAN_DATA, spanExporter::export, server.traceRequests::size);
}
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class OtlpHttpRetryTest method configureLogExporterRetryPolicy.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
void configureLogExporterRetryPolicy() {
Map<String, String> props = new HashMap<>();
props.put("otel.exporter.otlp.logs.protocol", "http/protobuf");
props.put("otel.exporter.otlp.logs.endpoint", "https://localhost:" + server.httpsPort() + "/v1/logs");
props.put("otel.exporter.otlp.logs.certificate", server.selfSignedCertificate.certificate().getPath());
props.put("otel.experimental.exporter.otlp.retry.enabled", "true");
try (LogExporter logExporter = LogExporterConfiguration.configureOtlpLogs(DefaultConfigProperties.createForTest(props), MeterProvider.noop())) {
testRetryableStatusCodes(() -> LOG_DATA, logExporter::export, server.logRequests::size);
testDefaultRetryPolicy(() -> LOG_DATA, logExporter::export, server.logRequests::size);
}
}
use of io.opentelemetry.internal.testing.slf4j.SuppressLogger in project opentelemetry-java by open-telemetry.
the class OtlpHttpRetryTest method configureMetricExporterRetryPolicy.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
void configureMetricExporterRetryPolicy() {
Map<String, String> props = new HashMap<>();
props.put("otel.exporter.otlp.metrics.protocol", "http/protobuf");
props.put("otel.exporter.otlp.metrics.endpoint", "https://localhost:" + server.httpsPort() + "/v1/metrics");
props.put("otel.exporter.otlp.metrics.certificate", server.selfSignedCertificate.certificate().getPath());
props.put("otel.experimental.exporter.otlp.retry.enabled", "true");
try (MetricExporter metricExporter = MetricExporterConfiguration.configureOtlpMetrics(DefaultConfigProperties.createForTest(props))) {
testRetryableStatusCodes(() -> METRIC_DATA, metricExporter::export, server.metricRequests::size);
testDefaultRetryPolicy(() -> METRIC_DATA, metricExporter::export, server.metricRequests::size);
}
}
Aggregations