Console Commands
Console commands are not traced by default. You must explicitly opt in by listing the commands you want to trace in the commands configuration option. This prevents high-frequency or low-value scheduler tasks from polluting your traces.
When a traced command runs, a root span is created using the command signature as the span name. Command arguments and options are recorded as span attributes (console.argument.* and console.option.*). The span status is set to OK on success or ERROR on a non-zero exit code.
Adding Commands
By signature
By class name
use Keepsuit\LaravelOpenTelemetry\Instrumentation;
'instrumentation' => [
Instrumentation\ConsoleInstrumentation::class => [
'enabled' => env('OTEL_INSTRUMENTATION_CONSOLE', true),
'commands' => [
'app:example-command',
'app:another-command',
],
],
],
use Keepsuit\LaravelOpenTelemetry\Instrumentation;
use App\Console\Commands\ExampleCommand;
'instrumentation' => [
Instrumentation\ConsoleInstrumentation::class => [
'enabled' => env('OTEL_INSTRUMENTATION_CONSOLE', true),
'commands' => [
ExampleCommand::class,
],
],
],
Both styles can be mixed in the same commands array. Wildcard suffixes (e.g. app:*) are also supported.
Configuration Options
| Option | Type | Description |
|---|
commands | string[] | List of command signatures or fully-qualified class names to trace. |
Disabling Console
OTEL_INSTRUMENTATION_CONSOLE=false
Alternatively, remove ConsoleInstrumentation::class from the instrumentation array in config/opentelemetry.php.
Scout
The Scout instrumentation traces Laravel Scout search, update, and delete operations. Each operation produces a CLIENT span containing the search engine name, operation type, target index, and (for search operations) the query text.
Traced operations:
| Operation | Span name pattern |
|---|
search / paginate | search {index} |
update | search_update {index} |
delete | search_delete {index} |
Scout instrumentation requires the ext-opentelemetry PHP extension to be installed and enabled. If the extension is not loaded, this instrumentation silently disables itself.
Metrics
| Metric | Type | Unit | Description |
|---|
db.client.operation.duration | Histogram | seconds | Duration of Scout search engine operations. |
Configuration
In config/opentelemetry.php:
use Keepsuit\LaravelOpenTelemetry\Instrumentation;
'instrumentation' => [
Instrumentation\ScoutInstrumentation::class => env('OTEL_INSTRUMENTATION_SCOUT', true),
],
Disabling Scout
OTEL_INSTRUMENTATION_SCOUT=false
Alternatively, remove ScoutInstrumentation::class from the instrumentation array in config/opentelemetry.php.