Search in sources :

Example 1 with OtlpGrpcSpanExporter

use of io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter in project opentelemetry-java by open-telemetry.

the class OtlpPipelineStressTest method setupSdk.

private void setupSdk() {
    Resource resource = Resource.create(Attributes.builder().put(ResourceAttributes.SERVICE_NAME, "PerfTester").put(ResourceAttributes.SERVICE_VERSION, "1.0.1-RC-1").build());
    // set up the metric exporter and wire it into the SDK and a timed reader.
    meterProvider = SdkMeterProvider.builder().setResource(resource).registerMetricReader(PeriodicMetricReader.builder(metricExporter).setInterval(Duration.ofSeconds(1)).newMetricReaderFactory()).build();
    // set up the span exporter and wire it into the SDK
    OtlpGrpcSpanExporter spanExporter = OtlpGrpcSpanExporter.builder().setMeterProvider(meterProvider).setEndpoint("http://" + toxiproxyContainer.getHost() + ":" + toxiproxyContainer.getMappedPort(COLLECTOR_PROXY_PORT)).build();
    BatchSpanProcessor spanProcessor = BatchSpanProcessor.builder(spanExporter).setMeterProvider(meterProvider).build();
    SdkTracerProvider tracerProvider = SdkTracerProvider.builder().addSpanProcessor(spanProcessor).build();
    openTelemetry = OpenTelemetrySdk.builder().setTracerProvider(tracerProvider).buildAndRegisterGlobal();
    sdkTracerProvider = tracerProvider;
}
Also used : Resource(io.opentelemetry.sdk.resources.Resource) SdkTracerProvider(io.opentelemetry.sdk.trace.SdkTracerProvider) OtlpGrpcSpanExporter(io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter) BatchSpanProcessor(io.opentelemetry.sdk.trace.export.BatchSpanProcessor)

Aggregations

OtlpGrpcSpanExporter (io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter)1 Resource (io.opentelemetry.sdk.resources.Resource)1 SdkTracerProvider (io.opentelemetry.sdk.trace.SdkTracerProvider)1 BatchSpanProcessor (io.opentelemetry.sdk.trace.export.BatchSpanProcessor)1