function Span::addEvent
@inheritDoc
File
-
vendor/
open-telemetry/ sdk/ Trace/ Span.php, line 172
Class
Namespace
OpenTelemetry\SDK\TraceCode
public function addEvent(string $name, iterable $attributes = [], ?int $timestamp = null) : self {
if ($this->hasEnded) {
return $this;
}
if (++$this->totalRecordedEvents > $this->spanLimits
->getEventCountLimit()) {
return $this;
}
$timestamp ??= Clock::getDefault()->now();
$eventAttributesBuilder = $this->spanLimits
->getEventAttributesFactory()
->builder($attributes);
$this->events[] = new Event($name, $timestamp, $eventAttributesBuilder->build());
return $this;
}