Class OtlpHttpMetricExporter
- java.lang.Object
-
- io.opentelemetry.exporter.otlp.http.metrics.OtlpHttpMetricExporter
-
- All Implemented Interfaces:
AggregationTemporalitySelector
,DefaultAggregationSelector
,MetricExporter
,java.io.Closeable
,java.lang.AutoCloseable
@ThreadSafe public final class OtlpHttpMetricExporter extends java.lang.Object implements MetricExporter
Exports metrics using OTLP via HTTP, using OpenTelemetry's protobuf model.- Since:
- 1.14.0
-
-
Field Summary
Fields Modifier and Type Field Description private AggregationTemporalitySelector
aggregationTemporalitySelector
private HttpExporterBuilder<Marshaler>
builder
private DefaultAggregationSelector
defaultAggregationSelector
private HttpExporter<Marshaler>
delegate
private MetricReusableDataMarshaler
marshaler
-
Constructor Summary
Constructors Constructor Description OtlpHttpMetricExporter(HttpExporterBuilder<Marshaler> builder, HttpExporter<Marshaler> delegate, AggregationTemporalitySelector aggregationTemporalitySelector, DefaultAggregationSelector defaultAggregationSelector, MemoryMode memoryMode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OtlpHttpMetricExporterBuilder
builder()
Returns a new builder instance for this exporter.CompletableResultCode
export(java.util.Collection<MetricData> metrics)
Submits all the given metrics in a single batch to the OpenTelemetry collector.CompletableResultCode
flush()
The OTLP exporter does not batch metrics, so this method will immediately return with success.AggregationTemporality
getAggregationTemporality(InstrumentType instrumentType)
Return the aggregation temporality for theInstrumentType
.static OtlpHttpMetricExporter
getDefault()
Returns a newOtlpHttpMetricExporter
using the default values.Aggregation
getDefaultAggregation(InstrumentType instrumentType)
Return the default aggregation for theInstrumentType
.MemoryMode
getMemoryMode()
Returns the memory mode used by this exporter's associated reader.CompletableResultCode
shutdown()
Shutdown the exporter.OtlpHttpMetricExporterBuilder
toBuilder()
Returns a builder with configuration values equal to those for this exporter.java.lang.String
toString()
-
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
-
-
-
-
Field Detail
-
builder
private final HttpExporterBuilder<Marshaler> builder
-
delegate
private final HttpExporter<Marshaler> delegate
-
aggregationTemporalitySelector
private final AggregationTemporalitySelector aggregationTemporalitySelector
-
defaultAggregationSelector
private final DefaultAggregationSelector defaultAggregationSelector
-
marshaler
private final MetricReusableDataMarshaler marshaler
-
-
Constructor Detail
-
OtlpHttpMetricExporter
OtlpHttpMetricExporter(HttpExporterBuilder<Marshaler> builder, HttpExporter<Marshaler> delegate, AggregationTemporalitySelector aggregationTemporalitySelector, DefaultAggregationSelector defaultAggregationSelector, MemoryMode memoryMode)
-
-
Method Detail
-
getDefault
public static OtlpHttpMetricExporter getDefault()
Returns a newOtlpHttpMetricExporter
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 AggregationTemporality getAggregationTemporality(InstrumentType instrumentType)
Description copied from interface:AggregationTemporalitySelector
Return the aggregation temporality for theInstrumentType
.- Specified by:
getAggregationTemporality
in interfaceAggregationTemporalitySelector
-
getDefaultAggregation
public Aggregation getDefaultAggregation(InstrumentType instrumentType)
Description copied from interface:MetricExporter
Return the default aggregation for theInstrumentType
.- Specified by:
getDefaultAggregation
in interfaceDefaultAggregationSelector
- Specified by:
getDefaultAggregation
in interfaceMetricExporter
- See Also:
DefaultAggregationSelector.getDefaultAggregation(InstrumentType)
-
getMemoryMode
public MemoryMode getMemoryMode()
Description copied from interface:MetricExporter
Returns the memory mode used by this exporter's associated reader.- Specified by:
getMemoryMode
in interfaceMetricExporter
- Returns:
- The
MemoryMode
used by this exporter's associated reader
-
export
public CompletableResultCode export(java.util.Collection<MetricData> metrics)
Submits all the given metrics in a single batch to the OpenTelemetry collector.- Specified by:
export
in interfaceMetricExporter
- Parameters:
metrics
- the list of sampled Metrics to be exported.- Returns:
- the result of the operation
-
flush
public CompletableResultCode flush()
The OTLP exporter does not batch metrics, so this method will immediately return with success.- Specified by:
flush
in interfaceMetricExporter
- Returns:
- always Success
-
shutdown
public CompletableResultCode shutdown()
Shutdown the exporter.- Specified by:
shutdown
in interfaceMetricExporter
- Returns:
- a
CompletableResultCode
which is completed when shutdown completes.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-