<?php
namespace Jaeger\Thrift\Agent\Zipkin;

/**
 * Autogenerated by Thrift Compiler (0.11.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
use Thrift\Base\TBase;
use Thrift\Type\TType;
use Thrift\Type\TMessageType;
use Thrift\Exception\TException;
use Thrift\Exception\TProtocolException;
use Thrift\Protocol\TProtocol;
use Thrift\Protocol\TBinaryProtocolAccelerated;
use Thrift\Exception\TApplicationException;


/**
 * Binary annotations are tags applied to a Span to give it context. For
 * example, a binary annotation of "http.uri" could the path to a resource in a
 * RPC call.
 * 
 * Binary annotations of type STRING are always queryable, though more a
 * historical implementation detail than a structural concern.
 * 
 * Binary annotations can repeat, and vary on the host. Similar to Annotation,
 * the host indicates who logged the event. This allows you to tell the
 * difference between the client and server side of the same key. For example,
 * the key "http.uri" might be different on the client and server side due to
 * rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field,
 * you can see the different points of view, which often help in debugging.
 */
class BinaryAnnotation extends TBase {
  static $isValidate = false;

  static $_TSPEC = array(
    1 => array(
      'var' => 'key',
      'isRequired' => false,
      'type' => TType::STRING,
      ),
    2 => array(
      'var' => 'value',
      'isRequired' => false,
      'type' => TType::STRING,
      ),
    3 => array(
      'var' => 'annotation_type',
      'isRequired' => false,
      'type' => TType::I32,
      ),
    4 => array(
      'var' => 'host',
      'isRequired' => false,
      'type' => TType::STRUCT,
      'class' => '\Jaeger\Thrift\Agent\Zipkin\Endpoint',
      ),
    );

  /**
   * @var string
   */
  public $key = null;
  /**
   * @var string
   */
  public $value = null;
  /**
   * @var int
   */
  public $annotation_type = null;
  /**
   * The host that recorded tag, which allows you to differentiate between
   * multiple tags with the same key. There are two exceptions to this.
   * 
   * When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or
   * destination of an RPC. This exception allows zipkin to display network
   * context of uninstrumented services, or clients such as web browsers.
   * 
   * @var \Jaeger\Thrift\Agent\Zipkin\Endpoint
   */
  public $host = null;

  public function __construct($vals=null) {
    if (is_array($vals)) {
      parent::__construct(self::$_TSPEC, $vals);
    }
  }

  public function getName() {
    return 'BinaryAnnotation';
  }

  public function read($input)
  {
    return $this->_read('BinaryAnnotation', self::$_TSPEC, $input);
  }

  public function write($output) {
    return $this->_write('BinaryAnnotation', self::$_TSPEC, $output);
  }

}

