Package zipkin2.reporter
Enum BytesMessageEncoder
- java.lang.Object
-
- java.lang.Enum<BytesMessageEncoder>
-
- zipkin2.reporter.BytesMessageEncoder
-
- All Implemented Interfaces:
Serializable
,Comparable<BytesMessageEncoder>
public enum BytesMessageEncoder extends Enum<BytesMessageEncoder>
Senders like Kafka use byte[] message encoding. This provides helpers to concatenate spans into a list.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract byte[]
encode(List<byte[]> encodedSpans)
Combines a list of encoded spans into an encoded list.static BytesMessageEncoder
forEncoding(zipkin2.codec.Encoding encoding)
static BytesMessageEncoder
valueOf(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 Detail
-
JSON
public static final BytesMessageEncoder JSON
-
THRIFT
@Deprecated public static final BytesMessageEncoder 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
public static final BytesMessageEncoder 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 Detail
-
values
public static BytesMessageEncoder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BytesMessageEncoder c : BytesMessageEncoder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BytesMessageEncoder valueOf(String name)
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
public abstract byte[] encode(List<byte[]> encodedSpans)
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
encoded
one-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
public static BytesMessageEncoder forEncoding(zipkin2.codec.Encoding encoding)
-
-