function Span::setStatus
Same name in this branch
- 11.1.x vendor/open-telemetry/gen-otlp-protobuf/Opentelemetry/Proto/Trace/V1/Span.php \Opentelemetry\Proto\Trace\V1\Span::setStatus()
@inheritDoc
File
-
vendor/
open-telemetry/ sdk/ Trace/ Span.php, line 227
Class
Namespace
OpenTelemetry\SDK\TraceCode
public function setStatus(string $code, ?string $description = null) : self {
if ($this->hasEnded) {
return $this;
}
// An attempt to set value Unset SHOULD be ignored.
if ($code === API\StatusCode::STATUS_UNSET) {
return $this;
}
// When span status is set to Ok it SHOULD be considered final and any further attempts to change it SHOULD be ignored.
if ($this->status
->getCode() === API\StatusCode::STATUS_OK) {
return $this;
}
$this->status = StatusData::create($code, $description);
return $this;
}