spiral/telemetry
spiral/telemetry provides telemetry support for Spiral apps, helping you collect and propagate traces, metrics, and runtime signals across services. Designed to integrate with Spiral components to improve observability and diagnose performance issues.
Start by installing the package via Composer:
composer require spiral/telemetry
Then register the service provider in your Spiral application’s config/app.php (typically in the providers array):
Spiral\Telemetry\TelemetryProvider::class,
Minimal setup requires no additional configuration — traces will be generated for HTTP requests, background jobs, and service calls by default. Verify functionality by triggering a request and checking the output (default: stderr or configured sink).
Telemetry::span() to add custom spans:
$span = Telemetry::span('user.login');
try {
// login logic
$span->setAttributes(['user_id' => $user->id]);
} finally {
$span->end();
}
QueueInterface. To trace custom logic inside jobs, wrap in spans as above.SpanModifierInterface to inject context (e.g., user ID, tenant) into every span globally. Register modifiers in config/telemetry.php.Spiral\Telemetry\ExporterInterface implementation.user.$id). Use static semantic names like user.login to ensure effective aggregation and filtering.span() call is paired with end() — unended spans may persist in memory across iterations. Use try/finally blocks or lazy span resolution where possible.config/telemetry.php — e.g., enabled, sampling, and exporter class — to tune behavior without code changes.How can I help you explore Laravel packages today?