You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: trace event listener execution and add a global tracing kill switch
Event listener tracing:
- TracingEventDispatcher extends Laravel's Dispatcher and wraps each
non-wildcard, non-queued listener in EventListenerTracer::trace(),
recording a `listener` span per invocation (name, completion/failure
status). Wildcard and queued listeners are left unwrapped, and
listeners run normally with no tracing overhead when there's no
active trace.
- Bound as the app's 'events' singleton in the service provider.
Global enabled switch:
- New `laravel-trace.enabled` config key. Tracer checks it in start()
before establishing a trace context, so downstream consumers
(DatabaseQueryListener, EventListenerTracer) that already guard on
`context() === null` naturally no-op everywhere.
- The check reads the live ConfigRepository rather than a boolean
captured at construction time: Tracer is resolved early via the
container's 'events' -> TracingEventDispatcher -> EventListenerTracer
dependency chain, well before a test's config()->set() override (or
any runtime config change) would take effect against a frozen value.
- TraceRequest middleware now guards its span() call, since context()
can legitimately be null after a disabled start().
Also folds in and fixes a duplicate test: a stray tests/DatabaseTracingTest.php
had been added at the wrong path (should live under
tests/Feature/Tracing/, where an equivalently-named file already
existed) and imported the concrete Tracing\Tracer class instead of the
Contracts\Tracer interface used everywhere else. Merged its "globally
disabled" case into the existing tests/Feature/Tracing/DatabaseTracingTest.php
instead of keeping two same-named files, and removed the stray one.
0 commit comments