Class JsonSerializer
java.lang.Object
io.opentelemetry.exporter.internal.marshal.Serializer
io.opentelemetry.exporter.internal.marshal.JsonSerializer
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.fasterxml.jackson.core.JsonGeneratorprivate static final com.fasterxml.jackson.core.JsonFactory -
Constructor Summary
ConstructorsConstructorDescriptionJsonSerializer(com.fasterxml.jackson.core.JsonGenerator generator) JsonSerializer(OutputStream output) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidserializeRepeatedMessage(ProtoFieldInfo field, Marshaler[] repeatedMessage) Serializesrepeated messagefield.voidserializeRepeatedMessage(ProtoFieldInfo field, List<? extends Marshaler> repeatedMessage) Serializesrepeated messagefield.<T> voidserializeRepeatedMessageWithContext(ProtoFieldInfo field, List<? extends T> messages, StatelessMarshaler<T> marshaler, MarshalerContext context) Serializesrepeated messagefield.voidwriteBool(ProtoFieldInfo field, boolean value) Writes a protobufboolfield, even if it matches the default value.voidwriteByteBuffer(ProtoFieldInfo field, ByteBuffer value) voidwriteBytes(ProtoFieldInfo field, byte[] value) voidwriteDouble(ProtoFieldInfo field, double value) Writes a protobufdoublefield, even if it matches the default value.protected voidwriteDoubleValue(double value) protected voidprotected voidWrites end of repeated messages.protected voidWrites end of a repeated message element.protected voidprotected voidprotected voidwriteEnum(ProtoFieldInfo field, ProtoEnumInfo enumValue) protected voidwriteFixed32(ProtoFieldInfo field, int value) protected voidwriteFixed64(ProtoFieldInfo field, long value) protected voidwriteFixed64Value(long value) protected voidwriteint32(ProtoFieldInfo field, int value) voidwriteInt64(ProtoFieldInfo field, long value) Writes a protobufint64field, even if it matches the default value.(package private) voidwriteMessageValue(Marshaler message) voidwriteSerializedMessage(byte[] protoSerialized, String jsonSerialized) Writes the value for a message field that has been pre-serialized.protected voidwriteSInt32(ProtoFieldInfo field, int value) protected voidwriteSpanId(ProtoFieldInfo field, String spanId) protected voidwriteStartMessage(ProtoFieldInfo field, int protoMessageSize) protected voidwriteStartRepeated(ProtoFieldInfo field) Writes start of repeated messages.protected voidwriteStartRepeatedElement(ProtoFieldInfo field, int protoMessageSize) Writes start of a repeated message element.protected voidwriteStartRepeatedPrimitive(ProtoFieldInfo field, int protoSizePerElement, int numElements) protected voidwriteStartRepeatedVarint(ProtoFieldInfo field, int payloadSize) voidwriteString(ProtoFieldInfo field, byte[] utf8Bytes) Writes a protobufstringfield, even if it matches the default value.voidwriteString(ProtoFieldInfo field, String string, int utf8Length, MarshalerContext context) protected voidwriteTraceId(ProtoFieldInfo field, String traceId) protected voidwriteUint32(ProtoFieldInfo field, int value) voidwriteUInt64(ProtoFieldInfo field, long value) Writes a protobufuint64field, even if it matches the default value.protected voidwriteUInt64Value(long value) Methods inherited from class Serializer
serializeBool, serializeByteAsFixed32, serializeByteBuffer, serializeBytes, serializeDouble, serializeDoubleOptional, serializeEnum, serializeFixed32, serializeFixed64, serializeFixed64Optional, serializeInt32, serializeInt64, serializeMessage, serializeMessageWithContext, serializeMessageWithContext, serializeRepeatedDouble, serializeRepeatedFixed64, serializeRepeatedFixed64, serializeRepeatedInt64, serializeRepeatedMessageWithContext, serializeRepeatedMessageWithContext, serializeRepeatedMessageWithContext, serializeRepeatedUInt64, serializeRepeatedUInt64, serializeRepeatedUInt64, serializeSInt32, serializeSpanId, serializeSpanId, serializeString, serializeStringWithContext, serializeTraceId, serializeTraceId, serializeUInt32, serializeUInt64, writeSpanId, writeTraceId
-
Field Details
-
JSON_FACTORY
private static final com.fasterxml.jackson.core.JsonFactory JSON_FACTORY -
generator
private final com.fasterxml.jackson.core.JsonGenerator generator
-
-
Constructor Details
-
JsonSerializer
JsonSerializer(OutputStream output) throws IOException - Throws:
IOException
-
JsonSerializer
JsonSerializer(com.fasterxml.jackson.core.JsonGenerator generator)
-
-
Method Details
-
writeTraceId
- Specified by:
writeTraceIdin classSerializer- Throws:
IOException
-
writeSpanId
- Specified by:
writeSpanIdin classSerializer- Throws:
IOException
-
writeBool
Description copied from class:SerializerWrites a protobufboolfield, even if it matches the default value.- Specified by:
writeBoolin classSerializer- Throws:
IOException
-
writeEnum
- Specified by:
writeEnumin classSerializer- Throws:
IOException
-
writeUint32
- Specified by:
writeUint32in classSerializer- Throws:
IOException
-
writeSInt32
- Specified by:
writeSInt32in classSerializer- Throws:
IOException
-
writeint32
- Specified by:
writeint32in classSerializer- Throws:
IOException
-
writeInt64
Description copied from class:SerializerWrites a protobufint64field, even if it matches the default value.- Specified by:
writeInt64in classSerializer- Throws:
IOException
-
writeFixed64
- Specified by:
writeFixed64in classSerializer- Throws:
IOException
-
writeFixed64Value
- Specified by:
writeFixed64Valuein classSerializer- Throws:
IOException
-
writeUInt64Value
- Specified by:
writeUInt64Valuein classSerializer- Throws:
IOException
-
writeUInt64
Description copied from class:SerializerWrites a protobufuint64field, even if it matches the default value.- Specified by:
writeUInt64in classSerializer- Throws:
IOException
-
writeFixed32
- Specified by:
writeFixed32in classSerializer- Throws:
IOException
-
writeDouble
Description copied from class:SerializerWrites a protobufdoublefield, even if it matches the default value.- Specified by:
writeDoublein classSerializer- Throws:
IOException
-
writeDoubleValue
- Specified by:
writeDoubleValuein classSerializer- Throws:
IOException
-
writeString
Description copied from class:SerializerWrites a protobufstringfield, even if it matches the default value.- Specified by:
writeStringin classSerializer- Throws:
IOException
-
writeString
public void writeString(ProtoFieldInfo field, String string, int utf8Length, MarshalerContext context) throws IOException - Specified by:
writeStringin classSerializer- Throws:
IOException
-
writeBytes
- Specified by:
writeBytesin classSerializer- Throws:
IOException
-
writeByteBuffer
- Specified by:
writeByteBufferin classSerializer- Throws:
IOException
-
writeStartMessage
- Specified by:
writeStartMessagein classSerializer- Throws:
IOException
-
writeEndMessage
- Specified by:
writeEndMessagein classSerializer- Throws:
IOException
-
writeStartRepeatedPrimitive
protected void writeStartRepeatedPrimitive(ProtoFieldInfo field, int protoSizePerElement, int numElements) throws IOException - Specified by:
writeStartRepeatedPrimitivein classSerializer- Throws:
IOException
-
writeEndRepeatedPrimitive
- Specified by:
writeEndRepeatedPrimitivein classSerializer- Throws:
IOException
-
writeStartRepeatedVarint
- Specified by:
writeStartRepeatedVarintin classSerializer- Throws:
IOException
-
writeEndRepeatedVarint
- Specified by:
writeEndRepeatedVarintin classSerializer- Throws:
IOException
-
serializeRepeatedMessage
public void serializeRepeatedMessage(ProtoFieldInfo field, Marshaler[] repeatedMessage) throws IOException Description copied from class:SerializerSerializesrepeated messagefield.- Specified by:
serializeRepeatedMessagein classSerializer- Throws:
IOException
-
serializeRepeatedMessage
public void serializeRepeatedMessage(ProtoFieldInfo field, List<? extends Marshaler> repeatedMessage) throws IOException Description copied from class:SerializerSerializesrepeated messagefield.- Specified by:
serializeRepeatedMessagein classSerializer- Throws:
IOException
-
serializeRepeatedMessageWithContext
public <T> void serializeRepeatedMessageWithContext(ProtoFieldInfo field, List<? extends T> messages, StatelessMarshaler<T> marshaler, MarshalerContext context) throws IOException Description copied from class:SerializerSerializesrepeated messagefield. This method reads elements from context, use together withStatelessMarshalerUtil.sizeRepeatedMessageWithContext(ProtoFieldInfo, List, StatelessMarshaler, MarshalerContext).- Specified by:
serializeRepeatedMessageWithContextin classSerializer- Throws:
IOException
-
writeStartRepeated
Description copied from class:SerializerWrites start of repeated messages.- Specified by:
writeStartRepeatedin classSerializer- Throws:
IOException
-
writeEndRepeated
Description copied from class:SerializerWrites end of repeated messages.- Specified by:
writeEndRepeatedin classSerializer- Throws:
IOException
-
writeStartRepeatedElement
protected void writeStartRepeatedElement(ProtoFieldInfo field, int protoMessageSize) throws IOException Description copied from class:SerializerWrites start of a repeated message element.- Specified by:
writeStartRepeatedElementin classSerializer- Throws:
IOException
-
writeEndRepeatedElement
Description copied from class:SerializerWrites end of a repeated message element.- Specified by:
writeEndRepeatedElementin classSerializer- Throws:
IOException
-
writeMessageValue
- Throws:
IOException
-
writeSerializedMessage
public void writeSerializedMessage(byte[] protoSerialized, String jsonSerialized) throws IOException Description copied from class:SerializerWrites the value for a message field that has been pre-serialized.- Specified by:
writeSerializedMessagein classSerializer- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein classSerializer- Throws:
IOException
-