summaryrefslogtreecommitdiff
path: root/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-10-20 17:12:29 +0300
committerAndrew Dolgov <[email protected]>2023-10-20 21:13:39 +0300
commitcdd7ad020e165fe680703b6d3319b908b682fb7a (patch)
treeb51eb09b7b4587e8fbc5624ac8d88d28cfcd0b04 /vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php
parent45a9ff0c88cbd33892ff16ab837e9059937d656e (diff)
jaeger-client -> opentelemetry
Diffstat (limited to 'vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php')
-rw-r--r--vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php41
1 files changed, 0 insertions, 41 deletions
diff --git a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php b/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php
deleted file mode 100644
index eb86a1cde..000000000
--- a/vendor/jonahgeorge/jaeger-client-php/src/Jaeger/Codec/CodecUtility.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-namespace Jaeger\Codec;
-
-class CodecUtility
-{
-
- /**
- * Incoming trace/span IDs are hex representations of 64-bit values. PHP
- * represents ints internally as signed 32- or 64-bit values, but base_convert
- * converts to string representations of arbitrarily large positive numbers.
- * This means at least half the incoming IDs will be larger than PHP_INT_MAX.
- *
- * Thrift, while building a binary representation of the IDs, performs bitwise
- * operations on the string values, implicitly casting to int and capping them
- * at PHP_INT_MAX. So, incoming IDs larger than PHP_INT_MAX will be serialized
- * and sent to the agent as PHP_INT_MAX, breaking trace/span correlation.
- *
- * This method therefore, on 64-bit architectures, splits the hex string into
- * high and low values, converts them separately to ints, and manually combines
- * them into a proper signed int. This int is then handled properly by the
- * Thrift package.
- *
- * On 32-bit architectures, it falls back to base_convert.
- *
- * @param string $hex
- * @return string|int
- */
- public static function hexToInt64($hex)
- {
- // If we're on a 32-bit architecture, fall back to base_convert.
- if (PHP_INT_SIZE === 4) {
- return base_convert($hex, 16, 10);
- }
-
- $hi = intval(substr($hex, -16, -8), 16);
- $lo = intval(substr($hex, -8, 8), 16);
-
- return $hi << 32 | $lo;
- }
-}