Package zipkin2.reporter
Enum BytesMessageEncoder
- All Implemented Interfaces:
Serializable,Comparable<BytesMessageEncoder>,java.lang.constant.Constable
public enum BytesMessageEncoder extends Enum<BytesMessageEncoder>
Senders like Kafka use byte[] message encoding. This provides helpers to concatenate spans into a
list.
-
Nested Class Summary
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description abstract byte[]encode(List<byte[]> encodedSpans)Combines a list of encoded spans into an encoded list.static BytesMessageEncoderforEncoding(zipkin2.codec.Encoding encoding)static BytesMessageEncodervalueOf(String name)Returns the enum constant of this type with the specified name.static BytesMessageEncoder[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
JSON
-
THRIFT
Deprecated.this format is deprecated in favor of json or proto3The first format of Zipkin was TBinaryProtocol, big-endian thrift. It is no longer used, but defined here to allow legacy code to migrate to the current reporter library.This writes the list header followed by a concatenation of the input.
- See Also:
Encoding.THRIFT
-
PROTO3
This function simply concatenates the byte arrays.The list of byte arrays represents a repeated (type 2) field. As such, each byte array is expected to have a prefix of the field number, followed by the encoded length of the span, finally, the actual span bytes.
- See Also:
Encoding.PROTO3
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
encode
Combines a list of encoded spans into an encoded list. For example, in thrift, this would be length-prefixed, whereas in json, this would be comma-separated and enclosed by brackets.The primary use of this is batch reporting spans. For example, spans are
encodedone-by-one into a queue. This queue is drained up to a byte threshold. Then, the list is encoded with this function and reported out-of-process. -
forEncoding
-