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