Class OtlpGrpcMetricExporter

  • All Implemented Interfaces:
    io.opentelemetry.sdk.metrics.export.MetricExporter

    @ThreadSafe
    public final class OtlpGrpcMetricExporter
    extends Object
    implements io.opentelemetry.sdk.metrics.export.MetricExporter
    Exports metrics using OTLP via gRPC, using OpenTelemetry's protobuf model.
    • Method Detail

      • export

        public io.opentelemetry.sdk.common.CompletableResultCode export​(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metrics)
        Submits all the given metrics in a single batch to the OpenTelemetry collector.
        Specified by:
        export in interface io.opentelemetry.sdk.metrics.export.MetricExporter
        Parameters:
        metrics - the list of Metrics to be exported.
        Returns:
        the result of the operation
      • flush

        public io.opentelemetry.sdk.common.CompletableResultCode flush()
        The OTLP exporter does not batch metrics, so this method will immediately return with success.
        Specified by:
        flush in interface io.opentelemetry.sdk.metrics.export.MetricExporter
        Returns:
        always Success
      • builder

        public static OtlpGrpcMetricExporterBuilder builder()
        Returns a new builder instance for this exporter.
        Returns:
        a new builder instance for this exporter.
      • getDefault

        public static OtlpGrpcMetricExporter getDefault()
        Returns a new OtlpGrpcMetricExporter reading the configuration values from the environment and from system properties. System properties override values defined in the environment. If a configuration value is missing, it uses the default value.
        Returns:
        a new OtlpGrpcMetricExporter instance.
      • shutdown

        public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
        Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled. The channel is forcefully closed after a timeout.
        Specified by:
        shutdown in interface io.opentelemetry.sdk.metrics.export.MetricExporter