Class OtlpGrpcMetricExporter
- java.lang.Object
-
- io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter
-
- All Implemented Interfaces:
AggregationTemporalitySelector,DefaultAggregationSelector,MetricExporter,java.io.Closeable,java.lang.AutoCloseable
@ThreadSafe public final class OtlpGrpcMetricExporter extends java.lang.Object implements MetricExporter
Exports metrics using OTLP via gRPC, using OpenTelemetry's protobuf model.- Since:
- 1.14.0
-
-
Field Summary
Fields Modifier and Type Field Description private AggregationTemporalitySelectoraggregationTemporalitySelectorprivate GrpcExporterBuilder<Marshaler>builderprivate DefaultAggregationSelectordefaultAggregationSelectorprivate GrpcExporter<Marshaler>delegateprivate MetricReusableDataMarshalermarshaler
-
Constructor Summary
Constructors Constructor Description OtlpGrpcMetricExporter(GrpcExporterBuilder<Marshaler> builder, GrpcExporter<Marshaler> delegate, AggregationTemporalitySelector aggregationTemporalitySelector, DefaultAggregationSelector defaultAggregationSelector, MemoryMode memoryMode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OtlpGrpcMetricExporterBuilderbuilder()Returns a new builder instance for this exporter.CompletableResultCodeexport(java.util.Collection<MetricData> metrics)Submits all the given metrics in a single batch to the OpenTelemetry collector.CompletableResultCodeflush()The OTLP exporter does not batch metrics, so this method will immediately return with success.AggregationTemporalitygetAggregationTemporality(InstrumentType instrumentType)Return the aggregation temporality for theInstrumentType.static OtlpGrpcMetricExportergetDefault()Returns a newOtlpGrpcMetricExporterusing the default values.AggregationgetDefaultAggregation(InstrumentType instrumentType)Return the default aggregation for theInstrumentType.MemoryModegetMemoryMode()Returns the memory mode used by this exporter's associated reader.CompletableResultCodeshutdown()Initiates an orderly shutdown in which preexisting calls continue but new calls are immediately cancelled.OtlpGrpcMetricExporterBuildertoBuilder()Returns a builder with configuration values equal to those for this exporter.java.lang.StringtoString()-
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 GrpcExporterBuilder<Marshaler> builder
-
delegate
private final GrpcExporter<Marshaler> delegate
-
aggregationTemporalitySelector
private final AggregationTemporalitySelector aggregationTemporalitySelector
-
defaultAggregationSelector
private final DefaultAggregationSelector defaultAggregationSelector
-
marshaler
private final MetricReusableDataMarshaler marshaler
-
-
Constructor Detail
-
OtlpGrpcMetricExporter
OtlpGrpcMetricExporter(GrpcExporterBuilder<Marshaler> builder, GrpcExporter<Marshaler> delegate, AggregationTemporalitySelector aggregationTemporalitySelector, DefaultAggregationSelector defaultAggregationSelector, MemoryMode memoryMode)
-
-
Method Detail
-
getDefault
public static OtlpGrpcMetricExporter getDefault()
Returns a newOtlpGrpcMetricExporterusing the default values.To load configuration values from environment variables and system properties, use opentelemetry-sdk-extension-autoconfigure.
- Returns:
- a new
OtlpGrpcMetricExporterinstance.
-
builder
public static OtlpGrpcMetricExporterBuilder builder()
Returns a new builder instance for this exporter.- Returns:
- a new builder instance for this exporter.
-
toBuilder
public OtlpGrpcMetricExporterBuilder 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:AggregationTemporalitySelectorReturn the aggregation temporality for theInstrumentType.- Specified by:
getAggregationTemporalityin interfaceAggregationTemporalitySelector
-
getDefaultAggregation
public Aggregation getDefaultAggregation(InstrumentType instrumentType)
Description copied from interface:MetricExporterReturn the default aggregation for theInstrumentType.- Specified by:
getDefaultAggregationin interfaceDefaultAggregationSelector- Specified by:
getDefaultAggregationin interfaceMetricExporter- See Also:
DefaultAggregationSelector.getDefaultAggregation(InstrumentType)
-
getMemoryMode
public MemoryMode getMemoryMode()
Description copied from interface:MetricExporterReturns the memory mode used by this exporter's associated reader.- Specified by:
getMemoryModein interfaceMetricExporter- Returns:
- The
MemoryModeused 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:
exportin interfaceMetricExporter- Parameters:
metrics- the list of 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:
flushin interfaceMetricExporter- Returns:
- always Success
-
shutdown
public 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:
shutdownin interfaceMetricExporter- Returns:
- a
CompletableResultCodewhich is completed when shutdown completes.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-