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();
}
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());
}
Aggregations