Class OtlpHttpMetricExporter

java.lang.Object
io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter
All Implemented Interfaces:
io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector, io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector, io.opentelemetry.sdk.metrics.export.MetricExporter, Closeable, AutoCloseable

@ThreadSafe public final class OtlpHttpMetricExporter extends Object implements io.opentelemetry.sdk.metrics.export.MetricExporter
Exports metrics using OTLP via HTTP, using OpenTelemetry's protobuf model.
Since:
1.14.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a new builder instance for this exporter.
    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.
    io.opentelemetry.sdk.common.CompletableResultCode
    The OTLP exporter does not batch metrics, so this method will immediately return with success.
    io.opentelemetry.sdk.metrics.data.AggregationTemporality
    getAggregationTemporality(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)
     
    Returns a new OtlpHttpMetricExporter using the default values.
    io.opentelemetry.sdk.metrics.Aggregation
    getDefaultAggregation(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)
     
    io.opentelemetry.sdk.common.export.MemoryMode
     
    io.opentelemetry.sdk.common.CompletableResultCode
    Shutdown the exporter.
    Returns a builder with configuration values equal to those for this exporter.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector

    with

    Methods inherited from interface io.opentelemetry.sdk.metrics.export.MetricExporter

    close
  • Method Details

    • getDefault

      public static OtlpHttpMetricExporter getDefault()
      Returns a new OtlpHttpMetricExporter using the default values.

      To load configuration values from environment variables and system properties, use opentelemetry-sdk-extension-autoconfigure.

      Returns:
      a new OtlpHttpMetricExporter instance.
    • builder

      public static OtlpHttpMetricExporterBuilder builder()
      Returns a new builder instance for this exporter.
      Returns:
      a new builder instance for this exporter.
    • toBuilder

      public OtlpHttpMetricExporterBuilder toBuilder()
      Returns a builder with configuration values equal to those for this exporter.

      IMPORTANT: Be sure to shutdown() this instance if it will no longer be used.

      Since:
      1.29.0
    • getAggregationTemporality

      public io.opentelemetry.sdk.metrics.data.AggregationTemporality getAggregationTemporality(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)
      Specified by:
      getAggregationTemporality in interface io.opentelemetry.sdk.metrics.export.AggregationTemporalitySelector
    • getDefaultAggregation

      public io.opentelemetry.sdk.metrics.Aggregation getDefaultAggregation(io.opentelemetry.sdk.metrics.InstrumentType instrumentType)
      Specified by:
      getDefaultAggregation in interface io.opentelemetry.sdk.metrics.export.DefaultAggregationSelector
      Specified by:
      getDefaultAggregation in interface io.opentelemetry.sdk.metrics.export.MetricExporter
    • getMemoryMode

      public io.opentelemetry.sdk.common.export.MemoryMode getMemoryMode()
      Specified by:
      getMemoryMode in interface io.opentelemetry.sdk.metrics.export.MetricExporter
    • 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 sampled 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
    • shutdown

      public io.opentelemetry.sdk.common.CompletableResultCode shutdown()
      Shutdown the exporter.
      Specified by:
      shutdown in interface io.opentelemetry.sdk.metrics.export.MetricExporter
    • toString

      public String toString()
      Overrides:
      toString in class Object