use of io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter in project besu by hyperledger.
the class MetricsOtelGrpcPushService method start.
@Override
public CompletableFuture<?> start() {
LOG.info("Starting OpenTelemetry push service");
OtlpGrpcMetricExporter exporter = OtlpGrpcMetricExporter.getDefault();
IntervalMetricReaderBuilder builder = IntervalMetricReader.builder().setExportIntervalMillis(configuration.getPushInterval() * 1000L).setMetricProducers(Collections.singleton(metricsSystem.getMeterSdkProvider())).setMetricExporter(exporter);
this.periodicReader = builder.buildAndStart();
this.spanProcessor = BatchSpanProcessor.builder(OtlpGrpcSpanExporter.builder().build()).build();
OpenTelemetrySdk.builder().setTracerProvider(SdkTracerProvider.builder().addSpanProcessor(spanProcessor).build()).buildAndRegisterGlobal();
return CompletableFuture.completedFuture(null);
}
use of io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter in project opentelemetry-java by open-telemetry.
the class OtlpExporterIntegrationTest method testOtlpGrpcMetricExport.
@ParameterizedTest
@ValueSource(strings = { "gzip", "none" })
void testOtlpGrpcMetricExport(String compression) {
MetricExporter otlpGrpcMetricExporter = OtlpGrpcMetricExporter.builder().setEndpoint("http://" + collector.getHost() + ":" + collector.getMappedPort(COLLECTOR_OTLP_GRPC_PORT)).setCompression(compression).build();
testMetricExport(otlpGrpcMetricExporter);
}
use of io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter in project opentelemetry-java by open-telemetry.
the class OtlpExporterIntegrationTest method testOtlpHttpMetricExport.
@ParameterizedTest
@ValueSource(strings = { "gzip", "none" })
void testOtlpHttpMetricExport(String compression) {
MetricExporter otlpGrpcMetricExporter = OtlpHttpMetricExporter.builder().setEndpoint("http://" + collector.getHost() + ":" + collector.getMappedPort(COLLECTOR_OTLP_HTTP_PORT) + "/v1/metrics").setCompression(compression).build();
testMetricExport(otlpGrpcMetricExporter);
}
Aggregations