ProfilingCollector
API reference › Yii3 Debug › Collector › ProfilingCollector
Captures request metrics and completed Yii profiler spans in the canonical Profiling panel payload.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Creates a profiling collector for live and already flushed spans. | ProfilingCollector |
capture() | Encodes the captured spans into the Profiling panel payload. | ProfilingCollector |
collectRequest() | Records the request start when the middleware did not already supply it. | ProfilingCollector |
collectRequestStart() | Uses the request start already resolved by the middleware so summary and profiler timing share one origin. | ProfilingCollector |
id() | Returns the stable identifier of this collector. | ProfilingCollector |
shutdown() | Stops capturing and clears the spans accumulated for the request. | ProfilingCollector |
startup() | Starts capturing and resets the cursor into the profiler message list. | ProfilingCollector |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(Yiisoft\Profiler\ProfilerInterface|null $profiler = null, Yii3\Debug\Profiling\DebugProfilerTarget|null $target = null)Creates a profiling collector for live and already flushed spans.
Parameters
| Parameter | Type | Description |
|---|---|---|
$profiler | Yiisoft\ | Application profiler supplying the spans, or null when none is configured. |
$target | Yii3\| | Target keeping the spans the profiler already flushed, or null when the profiler dispatches to no debugger target. |
capture()
Section titled “capture() ”public function capture(): array<string, mixed>|nullEncodes the captured spans into the Profiling panel payload.
Returns
array<string, mixed>|null: Encoded Profiling panel payload; null when the collector never started.
collectRequest()
Section titled “collectRequest() ”public function collectRequest(Psr\Http\Message\ServerRequestInterface $request): voidRecords the request start when the middleware did not already supply it.
Parameters
| Parameter | Type | Description |
|---|---|---|
$request | Psr\ | Request reaching the debugger middleware. |
collectRequestStart()
Section titled “collectRequestStart() ”public function collectRequestStart(float $start): voidUses the request start already resolved by the middleware so summary and profiler timing share one origin.
Parameters
| Parameter | Type | Description |
|---|---|---|
$start | float | Request start, in seconds. |
public function id(): stringReturns the stable identifier of this collector.
Returns
string: Stable ID pairing this collector with its panel.
shutdown()
Section titled “shutdown() ”public function shutdown(): voidStops capturing and clears the spans accumulated for the request.
startup()
Section titled “startup() ”public function startup(): voidStarts capturing and resets the cursor into the profiler message list.