From 8f3646a9c93a06f76f6abb31020fdb74b4b1fc59 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 9 Apr 2023 20:50:33 +0300 Subject: exp: jaeger tracing --- .../src/Jaeger/Thrift/Agent/Zipkin/Annotation.php | 87 ++++++++ .../Jaeger/Thrift/Agent/Zipkin/AnnotationType.php | 38 ++++ .../Thrift/Agent/Zipkin/BinaryAnnotation.php | 106 +++++++++ .../src/Jaeger/Thrift/Agent/Zipkin/Constant.php | 246 +++++++++++++++++++++ .../src/Jaeger/Thrift/Agent/Zipkin/Endpoint.php | 108 +++++++++ .../src/Jaeger/Thrift/Agent/Zipkin/Response.php | 56 +++++ .../src/Jaeger/Thrift/Agent/Zipkin/Span.php | 190 ++++++++++++++++ .../Thrift/Agent/Zipkin/ZipkinCollectorClient.php | 83 +++++++ .../Thrift/Agent/Zipkin/ZipkinCollectorIf.php | 27 +++ .../ZipkinCollector_submitZipkinBatch_args.php | 60 +++++ .../ZipkinCollector_submitZipkinBatch_result.php | 60 +++++ 11 files changed, 1061 insertions(+) create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Annotation.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/AnnotationType.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/BinaryAnnotation.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Constant.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Endpoint.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Response.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Span.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorClient.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorIf.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollector_submitZipkinBatch_args.php create mode 100644 vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollector_submitZipkinBatch_result.php (limited to 'vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin') diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Annotation.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Annotation.php new file mode 100644 index 000000000..e7e48dade --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Annotation.php @@ -0,0 +1,87 @@ + array( + 'var' => 'timestamp', + 'isRequired' => false, + 'type' => TType::I64, + ), + 2 => array( + 'var' => 'value', + 'isRequired' => false, + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'host', + 'isRequired' => false, + 'type' => TType::STRUCT, + 'class' => '\Jaeger\Thrift\Agent\Zipkin\Endpoint', + ), + ); + + /** + * Microseconds from epoch. + * + * This value should use the most precise value possible. For example, + * gettimeofday or syncing nanoTime against a tick of currentTimeMillis. + * + * @var int + */ + public $timestamp = null; + /** + * @var string + */ + public $value = null; + /** + * Always the host that recorded the event. By specifying the host you allow + * rollup of all events (such as client requests to a service) by IP address. + * + * @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 'Annotation'; + } + + public function read($input) + { + return $this->_read('Annotation', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('Annotation', self::$_TSPEC, $output); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/AnnotationType.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/AnnotationType.php new file mode 100644 index 000000000..e21c0b0d8 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/AnnotationType.php @@ -0,0 +1,38 @@ + 'BOOL', + 1 => 'BYTES', + 2 => 'I16', + 3 => 'I32', + 4 => 'I64', + 5 => 'DOUBLE', + 6 => 'STRING', + ); +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/BinaryAnnotation.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/BinaryAnnotation.php new file mode 100644 index 000000000..806a74831 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/BinaryAnnotation.php @@ -0,0 +1,106 @@ + 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); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Constant.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Constant.php new file mode 100644 index 000000000..ebfcebe48 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Constant.php @@ -0,0 +1,246 @@ + array( + 'var' => 'ipv4', + 'isRequired' => false, + 'type' => TType::I32, + ), + 2 => array( + 'var' => 'port', + 'isRequired' => false, + 'type' => TType::I16, + ), + 3 => array( + 'var' => 'service_name', + 'isRequired' => false, + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'ipv6', + 'isRequired' => false, + 'type' => TType::STRING, + ), + ); + + /** + * IPv4 host address packed into 4 bytes. + * + * Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4 + * + * @var int + */ + public $ipv4 = null; + /** + * IPv4 port + * + * Note: this is to be treated as an unsigned integer, so watch for negatives. + * + * Conventionally, when the port isn't known, port = 0. + * + * @var int + */ + public $port = null; + /** + * Service name in lowercase, such as "memcache" or "zipkin-web" + * + * Conventionally, when the service name isn't known, service_name = "unknown". + * + * @var string + */ + public $service_name = null; + /** + * IPv6 host address packed into 16 bytes. Ex Inet6Address.getBytes() + * + * @var string + */ + public $ipv6 = null; + + public function __construct($vals=null) { + if (is_array($vals)) { + parent::__construct(self::$_TSPEC, $vals); + } + } + + public function getName() { + return 'Endpoint'; + } + + public function read($input) + { + return $this->_read('Endpoint', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('Endpoint', self::$_TSPEC, $output); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Response.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Response.php new file mode 100644 index 000000000..88c7f5e5d --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Response.php @@ -0,0 +1,56 @@ + array( + 'var' => 'ok', + 'isRequired' => true, + 'type' => TType::BOOL, + ), + ); + + /** + * @var bool + */ + public $ok = null; + + public function __construct($vals=null) { + if (is_array($vals)) { + parent::__construct(self::$_TSPEC, $vals); + } + } + + public function getName() { + return 'Response'; + } + + public function read($input) + { + return $this->_read('Response', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('Response', self::$_TSPEC, $output); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Span.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Span.php new file mode 100644 index 000000000..32a69b645 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/Span.php @@ -0,0 +1,190 @@ + array( + 'var' => 'trace_id', + 'isRequired' => false, + 'type' => TType::I64, + ), + 3 => array( + 'var' => 'name', + 'isRequired' => false, + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'id', + 'isRequired' => false, + 'type' => TType::I64, + ), + 5 => array( + 'var' => 'parent_id', + 'isRequired' => false, + 'type' => TType::I64, + ), + 6 => array( + 'var' => 'annotations', + 'isRequired' => false, + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Jaeger\Thrift\Agent\Zipkin\Annotation', + ), + ), + 8 => array( + 'var' => 'binary_annotations', + 'isRequired' => false, + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Jaeger\Thrift\Agent\Zipkin\BinaryAnnotation', + ), + ), + 9 => array( + 'var' => 'debug', + 'isRequired' => false, + 'type' => TType::BOOL, + ), + 10 => array( + 'var' => 'timestamp', + 'isRequired' => false, + 'type' => TType::I64, + ), + 11 => array( + 'var' => 'duration', + 'isRequired' => false, + 'type' => TType::I64, + ), + 12 => array( + 'var' => 'trace_id_high', + 'isRequired' => false, + 'type' => TType::I64, + ), + ); + + /** + * @var int + */ + public $trace_id = null; + /** + * Span name in lowercase, rpc method for example + * + * Conventionally, when the span name isn't known, name = "unknown". + * + * @var string + */ + public $name = null; + /** + * @var int + */ + public $id = null; + /** + * @var int + */ + public $parent_id = null; + /** + * @var \Jaeger\Thrift\Agent\Zipkin\Annotation[] + */ + public $annotations = null; + /** + * @var \Jaeger\Thrift\Agent\Zipkin\BinaryAnnotation[] + */ + public $binary_annotations = null; + /** + * @var bool + */ + public $debug = false; + /** + * Microseconds from epoch of the creation of this span. + * + * This value should be set directly by instrumentation, using the most + * precise value possible. For example, gettimeofday or syncing nanoTime + * against a tick of currentTimeMillis. + * + * For compatibilty with instrumentation that precede this field, collectors + * or span stores can derive this via Annotation.timestamp. + * For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp. + * + * This field is optional for compatibility with old data: first-party span + * stores are expected to support this at time of introduction. + * + * @var int + */ + public $timestamp = null; + /** + * Measurement of duration in microseconds, used to support queries. + * + * This value should be set directly, where possible. Doing so encourages + * precise measurement decoupled from problems of clocks, such as skew or NTP + * updates causing time to move backwards. + * + * For compatibilty with instrumentation that precede this field, collectors + * or span stores can derive this by subtracting Annotation.timestamp. + * For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp. + * + * If this field is persisted as unset, zipkin will continue to work, except + * duration query support will be implementation-specific. Similarly, setting + * this field non-atomically is implementation-specific. + * + * This field is i64 vs i32 to support spans longer than 35 minutes. + * + * @var int + */ + public $duration = null; + /** + * Optional unique 8-byte additional identifier for a trace. If non zero, this + * means the trace uses 128 bit traceIds instead of 64 bit. + * + * @var int + */ + public $trace_id_high = null; + + public function __construct($vals=null) { + if (is_array($vals)) { + parent::__construct(self::$_TSPEC, $vals); + } + } + + public function getName() { + return 'Span'; + } + + public function read($input) + { + return $this->_read('Span', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('Span', self::$_TSPEC, $output); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorClient.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorClient.php new file mode 100644 index 000000000..2978675c4 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorClient.php @@ -0,0 +1,83 @@ +input_ = $input; + $this->output_ = $output ? $output : $input; + } + + public function submitZipkinBatch(array $spans) + { + $this->send_submitZipkinBatch($spans); + return $this->recv_submitZipkinBatch(); + } + + public function send_submitZipkinBatch(array $spans) + { + $args = new \Jaeger\Thrift\Agent\Zipkin\ZipkinCollector_submitZipkinBatch_args(); + $args->spans = $spans; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'submitZipkinBatch', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('submitZipkinBatch', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_submitZipkinBatch() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Jaeger\Thrift\Agent\Zipkin\ZipkinCollector_submitZipkinBatch_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new \Jaeger\Thrift\Agent\Zipkin\ZipkinCollector_submitZipkinBatch_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("submitZipkinBatch failed: unknown result"); + } + +} + + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorIf.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorIf.php new file mode 100644 index 000000000..83abf8119 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollectorIf.php @@ -0,0 +1,27 @@ + array( + 'var' => 'spans', + 'isRequired' => false, + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Jaeger\Thrift\Agent\Zipkin\Span', + ), + ), + ); + + /** + * @var \Jaeger\Thrift\Agent\Zipkin\Span[] + */ + public $spans = null; + + public function __construct($vals=null) { + if (is_array($vals)) { + parent::__construct(self::$_TSPEC, $vals); + } + } + + public function getName() { + return 'ZipkinCollector_submitZipkinBatch_args'; + } + + public function read($input) + { + return $this->_read('ZipkinCollector_submitZipkinBatch_args', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('ZipkinCollector_submitZipkinBatch_args', self::$_TSPEC, $output); + } + +} + diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollector_submitZipkinBatch_result.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollector_submitZipkinBatch_result.php new file mode 100644 index 000000000..faf165446 --- /dev/null +++ b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Thrift/Agent/Zipkin/ZipkinCollector_submitZipkinBatch_result.php @@ -0,0 +1,60 @@ + array( + 'var' => 'success', + 'isRequired' => false, + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Jaeger\Thrift\Agent\Zipkin\Response', + ), + ), + ); + + /** + * @var \Jaeger\Thrift\Agent\Zipkin\Response[] + */ + public $success = null; + + public function __construct($vals=null) { + if (is_array($vals)) { + parent::__construct(self::$_TSPEC, $vals); + } + } + + public function getName() { + return 'ZipkinCollector_submitZipkinBatch_result'; + } + + public function read($input) + { + return $this->_read('ZipkinCollector_submitZipkinBatch_result', self::$_TSPEC, $input); + } + + public function write($output) { + return $this->_write('ZipkinCollector_submitZipkinBatch_result', self::$_TSPEC, $output); + } + +} + -- cgit v1.2.3