Class LowAllocationTraceRequestMarshaler
java.lang.Object
io.opentelemetry.exporter.internal.marshal.Marshaler
io.opentelemetry.exporter.internal.otlp.traces.LowAllocationTraceRequestMarshaler
Marshaler
to convert SDK SpanData
to OTLP ExportTraceServiceRequest. See TraceRequestMarshaler
.
Example usage:
void marshal(LowAllocationTraceRequestMarshaler requestMarshaler, OutputStream output,
List<SpanData> spanList) throws IOException {
requestMarshaler.initialize(spanList);
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 MarshalerContext
private static final MarshalerContext.Key
private static final MarshalerContext.Key
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
calculateSize
(MarshalerContext context, Map<Resource, Map<InstrumentationScopeInfo, List<SpanData>>> resourceAndScopeMap) int
Returns the number of bytes this Marshaler will write in proto binary format.groupByResourceAndScope
(MarshalerContext context, Collection<SpanData> spanDataList) void
initialize
(Collection<SpanData> spanDataList) void
reset()
void
writeTo
(Serializer output) Methods inherited from class io.opentelemetry.exporter.internal.marshal.Marshaler
writeBinaryTo, writeJsonTo, writeJsonTo, writeJsonWithNewline
-
Field Details
-
RESOURCE_SPAN_SIZE_CALCULATOR_KEY
-
RESOURCE_SPAN_WRITER_KEY
-
context
-
resourceAndScopeMap
-
size
private int size
-
-
Constructor Details
-
LowAllocationTraceRequestMarshaler
public LowAllocationTraceRequestMarshaler()
-
-
Method Details
-
initialize
-
reset
public void reset() -
getBinarySerializedSize
public int getBinarySerializedSize()Description copied from class:Marshaler
Returns the number of bytes this Marshaler will write in proto binary format.- Specified by:
getBinarySerializedSize
in classMarshaler
-
writeTo
- Specified by:
writeTo
in classMarshaler
- Throws:
IOException
-
calculateSize
private static int calculateSize(MarshalerContext context, Map<Resource, Map<InstrumentationScopeInfo, List<SpanData>>> resourceAndScopeMap) -
groupByResourceAndScope
private static Map<Resource,Map<InstrumentationScopeInfo, groupByResourceAndScopeList<SpanData>>> (MarshalerContext context, Collection<SpanData> spanDataList)
-