Warning
Tracewick Symfony Bundle 1.0.0-rc.1 is a release candidate, not final 1.0. Compatibility fixes may still be needed during RC validation. Pin candidate versions explicitly and read the changelog before upgrading from 0.2.
Official Symfony integration for
tracewick/tracewick — a PHP sampling profiler on
ext-excimer that writes profiles to a local spool
(recommended) or optionally to Grafana Pyroscope.
| PHP | 8.2–8.5 |
| Symfony | 6.4 / 7.x / 8.x (CI matrix: 6.4, 7.4, 8.1) |
| Tracewick | `^0.2 |
| ext-excimer | suggested (fail-open no-op without it) |
Symfony 6.4 on PHP 8.1 is not supported (same PHP floor as the core library).
Install the candidate pair after publication. Explicit versions permit these prereleases while the application's global stability floor remains unchanged:
composer require 'tracewick/symfony-bundle:1.0.0-rc.1' 'tracewick/tracewick:1.0.0-rc.1'For releases with signed assets, verify the release ZIP and SBOM. The older 0.1.0 and 0.2.0 releases are unsigned; Composer does not verify Cosign automatically.
The contrib Flex recipe is pending review. Until it is merged, register the bundle (if not already registered) and copy the config by hand:
// config/bundles.php
return [
// ...
Tracewick\Bridge\Symfony\TracewickBundle::class => ['all' => true],
];cp vendor/tracewick/symfony-bundle/config/packages/tracewick.yaml config/packages/tracewick.yamlInstall the extension separately when you want samples (prefer PIE):
pie install wikimedia/excimer
php -m | grep -i excimerMinimal config:
# config/packages/tracewick.yaml
tracewick:
application_name: '%env(TRACEWICK_APPLICATION)%'
spool_directory: '%env(TRACEWICK_SPOOL_DIR)%'Set both variables in the application environment, or in .env when the application's
Symfony Dotenv bootstrap loads it. The full example above provides fallback values.
enabled defaults to true, sample_rate to 0.1, sink to spool. Optional
keys (label_controller, profile_console, profile_messenger, base_labels,
Pyroscope) are documented in the fuller example:
config/packages/tracewick.yaml.
On each main HTTP request the bundle:
- Starts a unit-of-work profile early (
kernel.request, priority4096) withroute=unmatchedand the HTTP method. - After the router (priority
31), sets theroutelabel to the Symfony route name (never the raw URI). Optionally also setscontrollerwhenlabel_controller: true. - On
kernel.terminate(priority-4096), stops and flushes to the configured sink.
On each console command (opt-in: profile_console: true):
- Starts on
console.command(priority4096) withcommand=<name>(never argv). - On
console.terminate(priority-4096), stops and flushes.
On each consumed Messenger message (opt-in: profile_messenger: true, needs symfony/messenger):
- Middleware starts only when the envelope has a
ReceivedStamp(worker path), withmessage=<FQCN>(never the payload). Syncdispatch()inside HTTP is left to the request profile. - Stops and flushes in
finallyafter the rest of the bus stack.
HTTP is profiled by default; console and Messenger stay off until enabled. For
messenger:consume, prefer profile_messenger: true. If both flags are on, the console
subscriber skips messenger:consume / messenger:consume-messages so the long-lived consumer
command does not share one unit of work with every message.
One shared UnitOfWorkProfiler is built per worker process.
Each request or consumed message starts a separate unit of work on that same profiler;
the bundle stops and flushes it at the lifecycle boundaries above, including in long-lived
workers. These calls also publish the core's deferred diagnostics outside sampling callbacks.
Fail-open (runtime): listener/middleware boundaries swallow errors; factory construction
failures (including a broken logger or an unknown sink after env resolve) return a no-op
profiler so the worker keeps serving. Not fail-open: invalid YAML / config-tree values still
fail at container build / cache:warmup — that is intentional so a half-wired profiler never
reaches request handling. Missing %env(...)% values also fail when Symfony resolves service
arguments, before the factory try/catch.
Inspect this process counters (collected / dropped / delivered / inactive sampler, …):
bin/console tracewick:statsThat command starts a new CLI process, so it shows zeros unless something profiled in that
same process. FPM / RoadRunner / messenger:consume counters live in those workers —
use HttpProfiler::diagnostics() from app code there, or scrape host metrics from core when
configured. Same snapshot API is available as HttpProfiler::diagnostics().
- Prefer
SpoolSink(sink: spool) from the request worker. - Deliver spool files with
tracewick-drainor the Go agent beside the app. - Direct
sink: pyroscopefrom PHP-FPM is for experiments only — not the default.
vendor/bin/tracewick-drain \
--spool-dir=/var/spool/tracewick \
--pyroscope-url=http://127.0.0.1:4040Bundle configuration is resolved by Symfony's %env(...)% mechanism. The standalone
tracewick-drain and Go agent read their own process environment and CLI arguments;
they do not boot Symfony or load the application's .env. Export variables into the
reader process through your service manager or container configuration. Either reader
must share the bundle's spool directory or volume, with compatible filesystem permissions;
run one normal reader per spool.
Reader settings (aggregation, limits, sleep, authentication) belong to that reader,
not to tracewick.yaml. Consult the documentation for your installed core or agent
version for supported environment variables and CLI precedence.
Put the spool on a local volume or tmpfs. Details: core runtime, drain.
Turn profiling off without a deploy:
| Layer | How |
|---|---|
| Bundle | tracewick.enabled: false (no subscriber / profiler services) |
| Core | TRACEWICK_DISABLE_FILE — if the path exists, profiling is off |
| Core | TRACEWICK_ENABLED=0 / false / off / no |
Core kill switches still apply when the bundle is enabled. See
docs/runtime.md.
Without ext-excimer, Tracewick is a no-op (warn once, then idle). The app keeps serving.
The installation preflight passes with published core 1.0.0-rc.1
and an archive of this bundle's development branch, without Excimer. It covers clean installation
and upgrades from the published 0.2.0 pair on Symfony 6.4 / 7.4 / 8.1.
The older bundle 0.2.0 requires core ^0.2; this candidate supports ^0.2 || ^1.0.
After publication, repeat installation with both actual Packagist RC packages using the explicit
requirements above. Archive preflight does not verify a future published release or its signatures.
composer install
make ci
make infection # needs the Infection PHAR (same version as CI)