function SpanBuilder::addLink
@inheritDoc
File
-
vendor/
open-telemetry/ sdk/ Trace/ SpanBuilder.php, line 48
Class
Namespace
OpenTelemetry\SDK\TraceCode
public function addLink(API\SpanContextInterface $context, iterable $attributes = []) : API\SpanBuilderInterface {
if (!$context->isValid()) {
return $this;
}
$this->totalNumberOfLinksAdded++;
if (count($this->links) === $this->tracerSharedState
->getSpanLimits()
->getLinkCountLimit()) {
return $this;
}
$this->links[] = new Link($context, $this->tracerSharedState
->getSpanLimits()
->getLinkAttributesFactory()
->builder($attributes)
->build());
return $this;
}