use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class AbstractGrpcTelemetryExporterTest method errorWithEscapedMessage.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
@SuppressLogger(DefaultGrpcExporter.class)
void errorWithEscapedMessage() {
addGrpcError(5, "クマ🐻");
assertThat(exporter.export(Collections.singletonList(generateFakeTelemetry())).join(10, TimeUnit.SECONDS).isSuccess()).isFalse();
LoggingEvent log = logs.assertContains("Failed to export " + type + "s. Server responded with gRPC status code 5. Error message: クマ🐻");
assertThat(log.getLevel()).isEqualTo(Level.WARN);
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class AbstractGrpcTelemetryExporterTest method testExport_Unavailable.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
@SuppressLogger(DefaultGrpcExporter.class)
void testExport_Unavailable() {
addGrpcError(14, null);
assertThat(exporter.export(Collections.singletonList(generateFakeTelemetry())).join(10, TimeUnit.SECONDS).isSuccess()).isFalse();
LoggingEvent log = logs.assertContains("Failed to export " + type + "s. Server is UNAVAILABLE. " + "Make sure your collector is running and reachable from this network.");
assertThat(log.getLevel()).isEqualTo(Level.ERROR);
}
use of org.slf4j.event.LoggingEvent in project opentelemetry-java by open-telemetry.
the class OtlpHttpLogExporterTest method testServerErrorParseError.
@Test
@SuppressLogger(OkHttpExporter.class)
void testServerErrorParseError() {
server.enqueue(HttpResponse.of(HttpStatus.INTERNAL_SERVER_ERROR, APPLICATION_PROTOBUF, "Server error!"));
OtlpHttpLogExporter exporter = builder.build();
exportAndAssertResult(exporter, /* expectedResult= */
false);
LoggingEvent log = logs.assertContains("Failed to export logs. Server responded with HTTP status code 500. Error message: Unable to parse response body, HTTP status message:");
assertThat(log.getLevel()).isEqualTo(Level.WARN);
}
Aggregations