Package zipkin2.reporter
Enum Encoding
- java.lang.Object
-
- java.lang.Enum<Encoding>
-
- zipkin2.reporter.Encoding
-
- All Implemented Interfaces:
Serializable,Comparable<Encoding>
public enum Encoding extends Enum<Encoding>
This includes the formats Zipkin server accepts.- Since:
- 3.0
-
-
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.abstract intlistSizeInBytes(int encodedSizeInBytes)LikelistSizeInBytes(List), except for a single element.abstract intlistSizeInBytes(List<byte[]> values)abstract StringmediaType()static EncodingvalueOf(String name)Returns the enum constant of this type with the specified name.static Encoding[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JSON
public static final Encoding JSON
-
THRIFT
@Deprecated public static final Encoding 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 collectors to support reading old data.The message's binary data includes a list header followed by N spans serialized in TBinaryProtocol
-
PROTO3
public static final Encoding PROTO3
Repeated (type 2) fields are length-prefixed. A list is a concatenation of fields with no additional overhead.See https://developers.google.com/protocol-buffers/docs/encoding#optional
-
-
Method Detail
-
values
public static Encoding[] 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 (Encoding c : Encoding.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Encoding 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
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.- Since:
- 3.3
-
listSizeInBytes
public abstract int listSizeInBytes(int encodedSizeInBytes)
LikelistSizeInBytes(List), except for a single element.
-
listSizeInBytes
public abstract int listSizeInBytes(List<byte[]> values)
-
mediaType
public abstract String mediaType()
- Since:
- 3.3
-
-