Class MarshalerUtil
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 static final byte[]private static final booleanprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,U> Map <Resource, Map<InstrumentationScopeInfo, List<U>>> groupByResourceAndScope(Collection<T> dataList, Function<T, Resource> getResource, Function<T, InstrumentationScopeInfo> getInstrumentationScope, Function<T, U> createMarshaler) Groups SDK items by resource and instrumentation scope.static StringpreserializeJsonFields(Marshaler marshaler) Preserialize into JSON format.static intsizeBool(ProtoFieldInfo field, boolean value) Returns the size of a bool field.static intsizeByteAsFixed32(ProtoFieldInfo field, byte message) Returns the size of a byte field when propagated to a fixed32.static intsizeByteBuffer(ProtoFieldInfo field, ByteBuffer message) Returns the size of a bytes field based on the buffer's capacity.static intsizeBytes(ProtoFieldInfo field, byte[] message) Returns the size of a bytes field.static intsizeDouble(ProtoFieldInfo field, double value) Returns the size of a double field.static intsizeDoubleOptional(ProtoFieldInfo field, double value) Returns the size of a double field.static intsizeEnum(ProtoFieldInfo field, ProtoEnumInfo enumValue) Returns the size of a enum field.static intsizeFixed32(ProtoFieldInfo field, int message) Returns the size of a fixed32 field.static intsizeFixed64(ProtoFieldInfo field, long value) Returns the size of a fixed64 field.static intsizeFixed64Optional(ProtoFieldInfo field, long value) Returns the size of a fixed64 field.static intsizeInt32(ProtoFieldInfo field, int message) Returns the size of a int32 field.static intsizeInt64(ProtoFieldInfo field, long message) Returns the size of a int64 field.static intsizeMessage(ProtoFieldInfo field, Marshaler message) Returns the size of a message field.static intsizeRepeatedDouble(ProtoFieldInfo field, List<Double> values) Returns the size of a repeated double field.private static intsizeRepeatedFixed64(ProtoFieldInfo field, int numValues) static intsizeRepeatedFixed64(ProtoFieldInfo field, List<Long> values) Returns the size of a repeated fixed64 field.static intsizeRepeatedInt64(ProtoFieldInfo field, long[] values) Returns the size of a repeated int64 field.static intsizeRepeatedInt64(ProtoFieldInfo field, List<Long> values) Returns the size of a repeated int64 field.static intsizeRepeatedMessage(ProtoFieldInfo field, List<? extends Marshaler> repeatedMessage) Returns the size of a repeated message field.static <T extends Marshaler>
intsizeRepeatedMessage(ProtoFieldInfo field, T[] repeatedMessage) Returns the size of a repeated message field.static intsizeRepeatedUInt64(ProtoFieldInfo field, long[] values) Returns the size of a repeated uint64 field.static intsizeRepeatedUInt64(ProtoFieldInfo field, DynamicPrimitiveLongList values) Returns the size of a repeated uint64 field.static intsizeRepeatedUInt64(ProtoFieldInfo field, List<Long> values) Returns the size of a repeated uint64 field.static intsizeSInt32(ProtoFieldInfo field, int message) Returns the size of a sint32 field.static intsizeSpanId(ProtoFieldInfo field, String spanId) Returns the size of a span_id field.static intsizeTraceId(ProtoFieldInfo field, String traceId) Returns the size of a trace_id field.static intsizeUInt32(ProtoFieldInfo field, int message) Returns the size of a uint32 field.static intsizeUInt64(ProtoFieldInfo field, long message) Returns the size of a uint64 field.static byte[]Converts the string to utf8 bytes for encoding.
-
Field Details
-
TRACE_ID_VALUE_SIZE
private static final int TRACE_ID_VALUE_SIZE -
SPAN_ID_VALUE_SIZE
private static final int SPAN_ID_VALUE_SIZE -
JSON_AVAILABLE
private static final boolean JSON_AVAILABLE -
EMPTY_BYTES
private static final byte[] EMPTY_BYTES
-
-
Constructor Details
-
MarshalerUtil
private MarshalerUtil()
-
-
Method Details
-
groupByResourceAndScope
public static <T,U> Map<Resource, Map<InstrumentationScopeInfo, List<U>>> groupByResourceAndScope(Collection<T> dataList, Function<T, Resource> getResource, Function<T, InstrumentationScopeInfo> getInstrumentationScope, Function<T, U> createMarshaler) Groups SDK items by resource and instrumentation scope. -
preserializeJsonFields
-
sizeRepeatedFixed64
Returns the size of a repeated fixed64 field. -
sizeRepeatedFixed64
-
sizeRepeatedUInt64
Returns the size of a repeated uint64 field.Packed repeated fields contain the tag, an integer representing the incoming payload size, and an actual payload of repeated varints.
-
sizeRepeatedUInt64
Returns the size of a repeated uint64 field.Packed repeated fields contain the tag, an integer representing the incoming payload size, and an actual payload of repeated varints.
-
sizeRepeatedUInt64
Returns the size of a repeated uint64 field.Packed repeated fields contain the tag, an integer representing the incoming payload size, and an actual payload of repeated varints.
NOTE: This method has the same logic as
sizeRepeatedUInt64(ProtoFieldInfo, long[]))} but instead of using a primitive array it usesDynamicPrimitiveLongListto avoid boxing/unboxing -
sizeRepeatedInt64
Returns the size of a repeated int64 field.Packed repeated fields contain the tag, an integer representing the incoming payload size, and an actual payload of repeated varints.
-
sizeRepeatedInt64
Returns the size of a repeated int64 field.Packed repeated fields contain the tag, an integer representing the incoming payload size, and an actual payload of repeated varints.
-
sizeRepeatedDouble
Returns the size of a repeated double field. -
sizeRepeatedMessage
public static <T extends Marshaler> int sizeRepeatedMessage(ProtoFieldInfo field, T[] repeatedMessage) Returns the size of a repeated message field. -
sizeRepeatedMessage
public static int sizeRepeatedMessage(ProtoFieldInfo field, List<? extends Marshaler> repeatedMessage) Returns the size of a repeated message field. -
sizeMessage
Returns the size of a message field. -
sizeBool
Returns the size of a bool field. -
sizeInt64
Returns the size of a int64 field. -
sizeUInt64
Returns the size of a uint64 field. -
sizeUInt32
Returns the size of a uint32 field. -
sizeSInt32
Returns the size of a sint32 field. -
sizeInt32
Returns the size of a int32 field. -
sizeDouble
Returns the size of a double field. -
sizeDoubleOptional
Returns the size of a double field. -
sizeFixed64
Returns the size of a fixed64 field. -
sizeFixed64Optional
Returns the size of a fixed64 field. -
sizeByteAsFixed32
Returns the size of a byte field when propagated to a fixed32. -
sizeFixed32
Returns the size of a fixed32 field. -
sizeBytes
Returns the size of a bytes field. -
sizeByteBuffer
Returns the size of a bytes field based on the buffer's capacity. -
sizeEnum
Returns the size of a enum field. -
sizeTraceId
Returns the size of a trace_id field. -
sizeSpanId
Returns the size of a span_id field. -
toBytes
-