Skip to main content

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

use Keepsuit\LaravelOpenTelemetry\Instrumentation;

'instrumentation' => [
    Instrumentation\ConsoleInstrumentation::class => [
        'enabled' => env('OTEL_INSTRUMENTATION_CONSOLE', true),
        'commands' => [
            'app:example-command',
            'app:another-command',
        ],
    ],
],
Both styles can be mixed in the same commands array. Wildcard suffixes (e.g. app:*) are also supported.

Configuration Options

OptionTypeDescription
commandsstring[]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:
OperationSpan name pattern
search / paginatesearch {index}
updatesearch_update {index}
deletesearch_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

MetricTypeUnitDescription
db.client.operation.durationHistogramsecondsDuration 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.

Build docs developers (and LLMs) love