use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class JaegerRemoteSamplerGrpcNettyTest method unimplemented_error_server_response.
@Test
void unimplemented_error_server_response() {
addGrpcError(12, null);
try (JaegerRemoteSampler sampler = JaegerRemoteSampler.builder().setEndpoint(server.httpUri().toString()).setServiceName(SERVICE_NAME).setPollingInterval(50, TimeUnit.MILLISECONDS).build()) {
assertThat(sampler.getDescription()).startsWith("JaegerRemoteSampler{ParentBased{root:TraceIdRatioBased{0.001000}");
await().untilAsserted(() -> {
LoggingEvent log = logs.assertContains("Server responded with UNIMPLEMENTED.");
assertThat(log.getLevel()).isEqualTo(Level.ERROR);
});
}
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class JaegerRemoteSamplerGrpcNettyTest method unavailable_error_server_response.
@Test
void unavailable_error_server_response() {
addGrpcError(14, "クマ🐻 resource exhausted");
try (JaegerRemoteSampler sampler = JaegerRemoteSampler.builder().setEndpoint(server.httpUri().toString()).setServiceName(SERVICE_NAME).setPollingInterval(50, TimeUnit.MILLISECONDS).build()) {
assertThat(sampler.getDescription()).startsWith("JaegerRemoteSampler{ParentBased{root:TraceIdRatioBased{0.001000}");
await().untilAsserted(() -> {
LoggingEvent log = logs.assertContains("Server is UNAVAILABLE");
assertThat(log.getLevel()).isEqualTo(Level.ERROR);
});
}
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class OtlpHttpSpanExporterTest method testServerErrorParseError.
@Test
@SuppressLogger(OkHttpExporter.class)
void testServerErrorParseError() {
server.enqueue(HttpResponse.of(HttpStatus.INTERNAL_SERVER_ERROR, APPLICATION_PROTOBUF, "Server error!"));
OtlpHttpSpanExporter exporter = builder.build();
exportAndAssertResult(exporter, /* expectedResult= */
false);
LoggingEvent log = logs.assertContains("Failed to export spans. Server responded with HTTP status code 500. Error message: Unable to parse response body, HTTP status message:");
assertThat(log.getLevel()).isEqualTo(Level.WARN);
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class OtlpHttpSpanExporterTest method testServerError.
@Test
@SuppressLogger(OkHttpExporter.class)
void testServerError() {
server.enqueue(buildResponse(HttpStatus.INTERNAL_SERVER_ERROR, Status.newBuilder().setMessage("Server error!").build()));
OtlpHttpSpanExporter exporter = builder.build();
exportAndAssertResult(exporter, /* expectedResult= */
false);
LoggingEvent log = logs.assertContains("Failed to export spans. Server responded with HTTP status code 500. Error message: Server error!");
assertThat(log.getLevel()).isEqualTo(Level.WARN);
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class StrictContextStorageTest method garbageCollectedScope.
@Test
void garbageCollectedScope() {
Context.current().with(ANIMAL, "cat").makeCurrent();
await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
System.gc();
LoggingEvent log = logs.assertContains("Scope garbage collected before being closed.");
assertThat(log.getLevel()).isEqualTo(Level.ERROR);
assertThat(log.getThrowable().getMessage()).matches("Thread \\[Test worker\\] opened a scope of .* here:");
});
}
Aggregations