Class LowAllocationMetricsRequestMarshaler
java.lang.Object
io.opentelemetry.exporter.internal.marshal.Marshaler
io.opentelemetry.exporter.internal.otlp.metrics.LowAllocationMetricsRequestMarshaler
Marshaler to convert SDK MetricData to OTLP ExportMetricsServiceRequest. See
MetricsRequestMarshaler.
Example usage:
void marshal(LowAllocationMetricsRequestMarshaler requestMarshaler, OutputStream output,
Collection<MetricData> metricDataList) throws IOException {
requestMarshaler.initialize(metricDataList);
try {
requestMarshaler.writeBinaryTo(output);
} finally {
requestMarshaler.reset();
}
}
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MarshalerContextprivate static final MarshalerContext.Keyprivate static final MarshalerContext.Keyprivate Map<Resource, Map<InstrumentationScopeInfo, List<MetricData>>> private int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static intcalculateSize(MarshalerContext context, Map<Resource, Map<InstrumentationScopeInfo, List<MetricData>>> resourceAndScopeMap) intReturns the number of bytes this Marshaler will write in proto binary format.private static Map<Resource, Map<InstrumentationScopeInfo, List<MetricData>>> groupByResourceAndScope(MarshalerContext context, Collection<MetricData> metricDataList) voidinitialize(Collection<MetricData> metricDataList) voidreset()voidwriteTo(Serializer output) Methods inherited from class io.opentelemetry.exporter.internal.marshal.Marshaler
writeBinaryTo, writeJsonTo, writeJsonTo, writeJsonWithNewline
-
Field Details
-
RESOURCE_METRIC_SIZE_CALCULATOR_KEY
-
RESOURCE_METRIC_WRITER_KEY
-
context
-
resourceAndScopeMap
-
size
private int size
-
-
Constructor Details
-
LowAllocationMetricsRequestMarshaler
public LowAllocationMetricsRequestMarshaler()
-
-
Method Details
-
initialize
-
reset
public void reset() -
getBinarySerializedSize
public int getBinarySerializedSize()Description copied from class:MarshalerReturns the number of bytes this Marshaler will write in proto binary format.- Specified by:
getBinarySerializedSizein classMarshaler
-
writeTo
- Specified by:
writeToin classMarshaler- Throws:
IOException
-
calculateSize
private static int calculateSize(MarshalerContext context, Map<Resource, Map<InstrumentationScopeInfo, List<MetricData>>> resourceAndScopeMap) -
groupByResourceAndScope
private static Map<Resource,Map<InstrumentationScopeInfo, groupByResourceAndScopeList<MetricData>>> (MarshalerContext context, Collection<MetricData> metricDataList)
-