PerformanceTracerInterface
interface PerformanceTracerInterface (View source)
Interface for tracing performance and execution flow in the Content Repository.
Methods
Creates a named span that traces the execution until the corresponding {self::closeSpan()} is called. {self::openSpan()} and {self::closeSpan()} always need to be called in pairs.
Close a span, opened by {self::openSpan()} before.
Creates a point-in-time marker AFTER an operation completes, within the current span.
Details
void
openSpan(string $name, array $params = [])
Creates a named span that traces the execution until the corresponding {self::closeSpan()} is called. {self::openSpan()} and {self::closeSpan()} always need to be called in pairs.
A span represents a unit of work with a defined beginning and end. Any mark() calls made during the closure execution are automatically associated with this span. Spans can be nested, allowing for hierarchical performance analysis.
Suggested pattern:
$this->performanceTracer?->openSpan('foo');
try {
// doFoo -> your code here
$this->performanceTracer?->mark('doFoo')
// doBar -> your code here
$this->performanceTracer?->mark('doBar')
} finally {
$this->performanceTracer?->closeSpan();
}
void
closeSpan()
Close a span, opened by {self::openSpan()} before.
void
mark(string $name, array $params = [])
Creates a point-in-time marker AFTER an operation completes, within the current span.
Markers measure the elapsed time from the previous mark (or span start) up to and including the operation just completed. Place mark() calls immediately AFTER the operation you want to measure.