Search in sources :

Example 1 with OtlpGrpcMetricExporter

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);
}
Also used : OtlpGrpcMetricExporter(io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter) IntervalMetricReaderBuilder(io.opentelemetry.sdk.metrics.export.IntervalMetricReaderBuilder)

Example 2 with OtlpGrpcMetricExporter

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);
}
Also used : OtlpHttpMetricExporter(io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter) OtlpGrpcMetricExporter(io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter) MetricExporter(io.opentelemetry.sdk.metrics.export.MetricExporter) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with 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);
}
Also used : OtlpHttpMetricExporter(io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter) OtlpGrpcMetricExporter(io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter) MetricExporter(io.opentelemetry.sdk.metrics.export.MetricExporter) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

OtlpGrpcMetricExporter (io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter)3 OtlpHttpMetricExporter (io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter)2 MetricExporter (io.opentelemetry.sdk.metrics.export.MetricExporter)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 ValueSource (org.junit.jupiter.params.provider.ValueSource)2 IntervalMetricReaderBuilder (io.opentelemetry.sdk.metrics.export.IntervalMetricReaderBuilder)1