Class LowAllocationLogsRequestMarshaler
java.lang.Object
io.opentelemetry.exporter.internal.marshal.Marshaler
io.opentelemetry.exporter.internal.otlp.logs.LowAllocationLogsRequestMarshaler
Marshaler
to convert SDK LogRecordData
to OTLP ExportLogsServiceRequest. See
LogsRequestMarshaler
.
Example usage:
void marshal(LowAllocationLogRequestMarshaler requestMarshaler, OutputStream output,
List<LogRecordData> logDataList) throws IOException {
requestMarshaler.initialize(logDataList);
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 Map
<Resource, Map<InstrumentationScopeInfo, List<LogRecordData>>> private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static int
calculateSize
(MarshalerContext context, Map<Resource, Map<InstrumentationScopeInfo, List<LogRecordData>>> resourceAndScopeMap) int
Returns the number of bytes this Marshaler will write in proto binary format.private static Map
<Resource, Map<InstrumentationScopeInfo, List<LogRecordData>>> groupByResourceAndScope
(MarshalerContext context, Collection<LogRecordData> logDataList) void
initialize
(Collection<LogRecordData> logDataList) void
reset()
void
writeTo
(Serializer output) Methods inherited from class io.opentelemetry.exporter.internal.marshal.Marshaler
writeBinaryTo, writeJsonTo, writeJsonTo, writeJsonWithNewline
-
Field Details
-
RESOURCE_LOG_SIZE_CALCULATOR_KEY
-
RESOURCE_LOG_WRITER_KEY
-
context
-
resourceAndScopeMap
-
size
private int size
-
-
Constructor Details
-
LowAllocationLogsRequestMarshaler
public LowAllocationLogsRequestMarshaler()
-
-
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<LogRecordData>>> resourceAndScopeMap) -
groupByResourceAndScope
private static Map<Resource,Map<InstrumentationScopeInfo, groupByResourceAndScopeList<LogRecordData>>> (MarshalerContext context, Collection<LogRecordData> logDataList)
-