Class BinarySerializationUtils

java.lang.Object
io.opencensus.implcore.tags.propagation.BinarySerializationUtils

final class BinarySerializationUtils extends Object
Methods for serializing and deserializing TagContexts.

The format defined in this class is shared across all implementations of OpenCensus. It allows tags to propagate across requests.

OpenCensus tag context encoding:

  • Tags are encoded in single byte sequence. The version 0 format is:
  • <version_id><encoded_tags>
  • <version_id> == a single byte, value 0
  • <encoded_tags> == (<tag_field_id><tag_encoding>)*
    • <tag_field_id> == a single byte, value 0
    • <tag_encoding>:
      • <tag_key_len><tag_key><tag_val_len><tag_val>
        • <tag_key_len> == varint encoded integer
        • <tag_key> == tag_key_len bytes comprising tag key name
        • <tag_val_len> == varint encoded integer
        • <tag_val> == tag_val_len bytes comprising UTF-8 string