use of io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogExporter in project splunk-otel-java by signalfx.
the class LogExporterBuilderTest method testCustomEndpoint.
@Test
void testCustomEndpoint() {
String endpoint = "http://example.com:9122/";
Config config = mock(Config.class);
OtlpGrpcLogExporterBuilder builder = mock(OtlpGrpcLogExporterBuilder.class);
OtlpGrpcLogExporter expected = mock(OtlpGrpcLogExporter.class);
when(builder.addHeader(EXTRA_CONTENT_TYPE, STACKTRACES_HEADER_VALUE)).thenReturn(builder);
when(builder.build()).thenReturn(expected);
when(config.getString(Configuration.CONFIG_KEY_OTEL_OTLP_URL, null)).thenReturn("http://shadowed.example.com:9122/");
when(config.getString(Configuration.CONFIG_KEY_INGEST_URL, "http://shadowed.example.com:9122/")).thenReturn(endpoint);
LogExporter exporter = LogExporterBuilder.fromConfig(config, () -> builder);
assertNotNull(exporter);
verify(builder).setEndpoint(endpoint);
}
use of io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogExporter in project opentelemetry-java by open-telemetry.
the class OtlpExporterIntegrationTest method testOtlpGrpcLogExport.
@ParameterizedTest
@ValueSource(strings = { "gzip", "none" })
void testOtlpGrpcLogExport(String compression) {
LogExporter otlpGrpcLogExporter = OtlpGrpcLogExporter.builder().setEndpoint("http://" + collector.getHost() + ":" + collector.getMappedPort(COLLECTOR_OTLP_GRPC_PORT)).setCompression(compression).build();
testLogExporter(otlpGrpcLogExporter);
}
use of io.opentelemetry.exporter.otlp.logs.OtlpGrpcLogExporter in project splunk-otel-java by signalfx.
the class LogExporterBuilderTest method testBuildSimple.
@Test
void testBuildSimple() {
Config config = mock(Config.class);
OtlpGrpcLogExporterBuilder builder = mock(OtlpGrpcLogExporterBuilder.class);
OtlpGrpcLogExporter expected = mock(OtlpGrpcLogExporter.class);
when(builder.addHeader(EXTRA_CONTENT_TYPE, STACKTRACES_HEADER_VALUE)).thenReturn(builder);
when(builder.build()).thenReturn(expected);
LogExporter exporter = LogExporterBuilder.fromConfig(config, () -> builder);
assertSame(expected, exporter);
verify(builder, never()).setEndpoint(anyString());
}
Aggregations