function SpanContext::__construct
File
-
vendor/
open-telemetry/ api/ Trace/ SpanContext.php, line 20
Class
Namespace
OpenTelemetry\API\TraceCode
private function __construct(string $traceId, string $spanId, int $traceFlags, bool $isRemote, ?TraceStateInterface $traceState = null) {
// TraceId must be exactly 16 bytes (32 chars) and at least one non-zero byte
// SpanId must be exactly 8 bytes (16 chars) and at least one non-zero byte
if (!SpanContextValidator::isValidTraceId($traceId) || !SpanContextValidator::isValidSpanId($spanId)) {
$this->traceId = SpanContextValidator::INVALID_TRACE;
$this->spanId = SpanContextValidator::INVALID_SPAN;
$this->isValid = false;
}
$this->isSampled = ($traceFlags & TraceFlags::SAMPLED) === TraceFlags::SAMPLED;
}