-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Otel-php:632 Move stack trace formatting out of Span class * added function usages * fix linting errors * Added documentation for adding Span Attributes * removing TracingUtl class * Refactor TraceState's __toString method * Added path with @Covers to remove warnings * Added @coversDefaultClass annotation * fix to check if iterable is empty * fixed for faling test case * unit test * Resolved review Comments * reverting changes * removing check for empty iterable span list * review changes for SpanProcessor incorrect calls to SpanExporter::forceFlush() * updated test case * resolved review comments * reverted changes for batch span processors * reverting changes for batch span proccessor * merge upstream and changes * updating changes * Refactoring SpanContext * updating changes * updated test cases * updated changes suggested after review * Revert "Reverting back to previous commit" This reverts commit 941f368. * updating changes after review * unused use statement * added unit test and resolved review comments * Removed Double underscores from constant variables * Removed constants from SpanContext.php to remove duplicacy * updated failing test * Moving Factory Methods back into SpanContext.php * modified constructor of SpanContext * updated SpanContext * Modified use of additional if statement * corrected parsing error
- Loading branch information
Showing
18 changed files
with
238 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\API\Trace\Propagation; | ||
|
||
use function strlen; | ||
|
||
class TraceContextValidator | ||
{ | ||
public const TRACE_FLAG_LENGTH = 2; | ||
public const TRACE_VERSION_REGEX = '/^(?!ff)[\da-f]{2}$/'; | ||
|
||
/** | ||
* @param string $traceVersion | ||
* @return bool Returns a value that indicates whether a trace version is valid. | ||
*/ | ||
public static function isValidTraceVersion(string $traceVersion): bool | ||
{ | ||
return 1 === preg_match(self::TRACE_VERSION_REGEX, $traceVersion); | ||
} | ||
|
||
/** | ||
* @return bool Returns a value that indicates whether trace flag is valid | ||
* TraceFlags must be exactly 1 bytes (1 char) representing a bit field | ||
*/ | ||
public static function isValidTraceFlag($traceFlag): bool | ||
{ | ||
return ctype_xdigit($traceFlag) && strlen($traceFlag) === self::TRACE_FLAG_LENGTH; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace OpenTelemetry\API\Trace; | ||
|
||
use function strlen; | ||
use function strtolower; | ||
|
||
class SpanContextValidator | ||
{ | ||
public const VALID_SPAN = '/^[0-9a-f]{16}$/'; | ||
public const VALID_TRACE = '/^[0-9a-f]{32}$/'; | ||
public const INVALID_SPAN = '0000000000000000'; | ||
public const INVALID_TRACE = '00000000000000000000000000000000'; | ||
public const SPAN_LENGTH = 16; | ||
public const TRACE_LENGTH = 32; | ||
public const SPAN_LENGTH_BYTES = 8; | ||
|
||
/** | ||
* @return bool Returns a value that indicates whether a trace id is valid | ||
*/ | ||
public static function isValidTraceId($traceId): bool | ||
{ | ||
return ctype_xdigit($traceId) && strlen($traceId) === self::TRACE_LENGTH && $traceId !== self::INVALID_TRACE && $traceId === strtolower($traceId); | ||
} | ||
|
||
/** | ||
* @return bool Returns a value that indicates whether a span id is valid | ||
*/ | ||
public static function isValidSpanId($spanId): bool | ||
{ | ||
return ctype_xdigit($spanId) && strlen($spanId) === self::SPAN_LENGTH && $spanId !== self::INVALID_SPAN && $spanId === strtolower($spanId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.