Search in sources :

Example 21 with SpanExporter

use of io.opentelemetry.sdk.trace.export.SpanExporter in project opentelemetry-java by open-telemetry.

the class JaegerThriftIntegrationTest method initOpenTelemetry.

private static OpenTelemetry initOpenTelemetry() {
    Integer mappedPort = jaegerContainer.getMappedPort(THRIFT_HTTP_PORT);
    SpanExporter jaegerExporter = JaegerThriftSpanExporter.builder().setEndpoint(JAEGER_URL + ":" + mappedPort + "/api/traces").build();
    return OpenTelemetrySdk.builder().setTracerProvider(SdkTracerProvider.builder().addSpanProcessor(SimpleSpanProcessor.create(jaegerExporter)).setResource(Resource.getDefault().toBuilder().put(ResourceAttributes.SERVICE_NAME, SERVICE_NAME).build()).build()).build();
}
Also used : SpanExporter(io.opentelemetry.sdk.trace.export.SpanExporter)

Example 22 with SpanExporter

use of io.opentelemetry.sdk.trace.export.SpanExporter in project splunk-otel-java by signalfx.

the class JaegerThriftSpanExporterFactoryTest method shouldCreateExporterWithSplunkAccessToken.

@Test
void shouldCreateExporterWithSplunkAccessToken() {
    // given
    given(config.getString(SplunkConfiguration.SPLUNK_ACCESS_TOKEN)).willReturn("token");
    given(config.getString(SplunkConfiguration.OTEL_EXPORTER_JAEGER_ENDPOINT)).willReturn("http://localhost:" + port + "/v1/trace");
    // when
    SpanExporter exporter = new JaegerThriftSpanExporterFactory().createExporter(config);
    exporter.export(List.of(prepareMockSpanData())).join(10, TimeUnit.SECONDS);
    // then
    assertEquals("token", TokenCapturingServlet.CAPTURED_SPLUNK_ACCESS_TOKEN.get());
}
Also used : SpanExporter(io.opentelemetry.sdk.trace.export.SpanExporter) Test(org.junit.jupiter.api.Test)

Aggregations

SpanExporter (io.opentelemetry.sdk.trace.export.SpanExporter)22 Test (org.junit.jupiter.api.Test)16 OtlpGrpcSpanExporter (io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter)9 ConfigProperties (io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties)9 HashMap (java.util.HashMap)9 LoggingSpanExporter (io.opentelemetry.exporter.logging.LoggingSpanExporter)7 ZipkinSpanExporter (io.opentelemetry.exporter.zipkin.ZipkinSpanExporter)7 SimpleSpanProcessor (io.opentelemetry.sdk.trace.export.SimpleSpanProcessor)6 Collections (java.util.Collections)6 Map (java.util.Map)6 MeterProvider (io.opentelemetry.api.metrics.MeterProvider)4 OtlpHttpSpanExporter (io.opentelemetry.exporter.otlp.http.trace.OtlpHttpSpanExporter)4 ConfigurationException (io.opentelemetry.sdk.autoconfigure.spi.ConfigurationException)4 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 GlobalOpenTelemetry (io.opentelemetry.api.GlobalOpenTelemetry)2 OpenTelemetry (io.opentelemetry.api.OpenTelemetry)2 AttributeKey.stringKey (io.opentelemetry.api.common.AttributeKey.stringKey)2 Span (io.opentelemetry.api.trace.Span)2 SpanId (io.opentelemetry.api.trace.SpanId)2