use of io.opentelemetry.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.
the class OtlpHttpRetryTest method configureSpanExporterRetryPolicy.
@Test
@SuppressLogger(OkHttpGrpcExporter.class)
void configureSpanExporterRetryPolicy() {
Map<String, String> props = new HashMap<>();
props.put("otel.exporter.otlp.traces.protocol", "http/protobuf");
props.put("otel.exporter.otlp.traces.endpoint", "https://localhost:" + server.httpsPort() + "/v1/traces");
props.put("otel.exporter.otlp.traces.certificate", server.selfSignedCertificate.certificate().getPath());
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.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanExporters_spiExporter.
@Test
void configureSpanExporters_spiExporter() {
ConfigProperties config = DefaultConfigProperties.createForTest(ImmutableMap.of("test.option", "true", "otel.traces.exporter", "testExporter"));
Map<String, SpanExporter> exportersByName = SpanExporterConfiguration.configureSpanExporters(config, SpanExporterConfiguration.class.getClassLoader(), MeterProvider.noop(), (a, unused) -> a);
assertThat(exportersByName).hasSize(1).containsKey("testExporter").extracting(map -> map.get("testExporter")).isInstanceOf(TestConfigurableSpanExporterProvider.TestSpanExporter.class).extracting("config").isSameAs(config);
}
use of io.opentelemetry.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanProcessors_multipleExportersWithLogging.
@Test
void configureSpanProcessors_multipleExportersWithLogging() {
SpanExporter loggingExporter = LoggingSpanExporter.create();
SpanExporter zipkinExporter = ZipkinSpanExporter.builder().build();
ConfigProperties properties = DefaultConfigProperties.createForTest(Collections.singletonMap("otel.traces.exporter", "logging,zipkin"));
assertThat(TracerProviderConfiguration.configureSpanProcessors(properties, ImmutableMap.of("logging", loggingExporter, "zipkin", zipkinExporter), MeterProvider.noop())).hasSize(2).hasAtLeastOneElementOfType(SimpleSpanProcessor.class).hasAtLeastOneElementOfType(BatchSpanProcessor.class);
}
use of io.opentelemetry.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.
the class ConfigurableSpanExporterTest method configureSpanProcessors_batchSpanProcessor.
@Test
void configureSpanProcessors_batchSpanProcessor() {
String exporterName = "zipkin";
Map<String, String> propMap = Collections.singletonMap("otel.traces.exporter", exporterName);
SpanExporter exporter = ZipkinSpanExporter.builder().build();
ConfigProperties properties = DefaultConfigProperties.createForTest(propMap);
assertThat(TracerProviderConfiguration.configureSpanProcessors(properties, ImmutableMap.of(exporterName, exporter), MeterProvider.noop())).hasSize(1).first().isInstanceOf(BatchSpanProcessor.class);
}
use of io.opentelemetry.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.
the class OtlpExporterIntegrationTest method testOtlpGrpcTraceExport.
@ParameterizedTest
@ValueSource(strings = { "gzip", "none" })
void testOtlpGrpcTraceExport(String compression) {
SpanExporter otlpGrpcTraceExporter = OtlpGrpcSpanExporter.builder().setEndpoint("http://" + collector.getHost() + ":" + collector.getMappedPort(COLLECTOR_OTLP_GRPC_PORT)).setCompression(compression).build();
testTraceExport(otlpGrpcTraceExporter);
}
Aggregations