Enum BytesMessageEncoder

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<BytesMessageEncoder>

    public enum BytesMessageEncoder
    extends java.lang.Enum<BytesMessageEncoder>
    Senders like Kafka use byte[] message encoding. This provides helpers to concatenate spans into a list.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      JSON  
      PROTO3
      This function simply concatenates the byte arrays.
      THRIFT
      Deprecated.
      this format is deprecated in favor of json or proto3
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract byte[] encode​(java.util.List<byte[]> encodedSpans)
      Combines a list of encoded spans into an encoded list.
      static BytesMessageEncoder forEncoding​(zipkin2.codec.Encoding encoding)  
      static BytesMessageEncoder valueOf​(java.lang.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.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • THRIFT

        @Deprecated
        public static final BytesMessageEncoder THRIFT
        Deprecated.
        this format is deprecated in favor of json or proto3
        The 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​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • encode

        public abstract byte[] encode​(java.util.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)