config/opentelemetry.php:
Root options
When
true, the OpenTelemetry SDK is disabled entirely. No traces, metrics, or logs are collected or exported. Reads from OTEL_SDK_DISABLED.The logical name of this service, reported on all telemetry data. Reads from
OTEL_SERVICE_NAME. Defaults to a URL-safe slug of your APP_NAME environment variable.A unique identifier for this specific instance of the service. Useful when running multiple replicas. If not set, a random ID is generated per request. Reads from
OTEL_SERVICE_INSTANCE_ID.Additional key-value pairs added as resource attributes to all telemetry data. By default, the value is parsed from the
OTEL_RESOURCE_ATTRIBUTES environment variable using the standard key1=value1,key2=value2 format.When enabled, the authenticated user’s ID is automatically added as
user.id on root trace spans and log records. Reads from OTEL_USER_CONTEXT. You can customize the attributes via a resolver callback — see User context.Comma-separated list of context propagators. Reads from
OTEL_PROPAGATORS. Supported values: tracecontext, baggage, b3, b3multi, none.metrics
Configuration for the OpenTelemetry Meter.Key of the exporter to use for metrics. Must correspond to an entry in the
exporters section. Reads from OTEL_METRICS_EXPORTER. Supported built-in drivers: otlp, console, memory, null.traces
Configuration for distributed tracing.Key of the exporter to use for traces. Must correspond to an entry in the
exporters section. Reads from OTEL_TRACES_EXPORTER. Supported built-in drivers: otlp, zipkin, console, memory, null.traces.sampler
When
true, wraps the configured sampler in a ParentBasedSampler. This causes the sampling decision to follow the parent span’s decision when one exists. Reads from OTEL_TRACES_SAMPLER_PARENT.The head sampler type. Reads from
OTEL_TRACES_SAMPLER_TYPE. Supported values:always_on— sample every tracealways_off— sample no tracestraceidratio— probabilistic sampling based on trace ID
Sampling ratio used when
type is traceidratio. A value of 0.05 means 5% of traces are sampled. Reads from OTEL_TRACES_SAMPLER_TRACEIDRATIO_RATIO.traces.sampler.tail_sampling
Tail sampling makes decisions after a trace has completed, allowing you to keep only meaningful traces. See Sampling for a full explanation.Application-level tail sampling is intended for single-service deployments. For multi-service tail sampling, use the OpenTelemetry Collector instead.
Enables tail sampling. When
true, sampling decisions are deferred until the trace ends (or decision_wait expires). Reads from OTEL_TRACES_TAIL_SAMPLING_ENABLED.Maximum time in milliseconds to wait for a trace to complete before making a sampling decision. Reads from
OTEL_TRACES_TAIL_SAMPLING_DECISION_WAIT.Ordered map of rule classes to their options. Rules are evaluated in order; the first rule that returns
Keep or Drop determines the outcome. If no rule decides, the configured head sampler is used.Built-in rules:ErrorsRule— keeps traces that contain any span with an error status. Set totrue/falseor pass['enabled' => true].SlowTraceRule— keeps traces exceeding a duration threshold. Accepts['enabled' => true, 'threshold_ms' => 2000].
traces.processors
List of additional span processor class names to register. Each class must implement
OpenTelemetry\SDK\Trace\SpanProcessorInterface.logs
Configuration for the OpenTelemetry logs pipeline.Key of the exporter to use for logs. Must correspond to an entry in the
exporters section. Reads from OTEL_LOGS_EXPORTER. Supported built-in drivers: otlp, console, memory, null.When
true, the active trace ID is injected into Laravel’s log context. This correlates log entries from non-OpenTelemetry loggers with the active trace.When using the
otlp log channel, the trace ID is always attached to the log record regardless of this setting.The key name used when injecting the trace ID into the log context.
List of additional log record processor class names to register. Each class must implement
OpenTelemetry\SDK\Logs\LogRecordProcessorInterface.exporters
Defines named exporter configurations that signals reference by key. You can define multiple exporters of the same driver type with different options (for example, different endpoints for different signals). Supported drivers:otlp, zipkin (traces only), console, memory, null.
exporters.otlp
Identifies this as an OTLP exporter.
Base URL of the OTLP receiver. Reads from
OTEL_EXPORTER_OTLP_ENDPOINT.Default transport protocol. Reads from
OTEL_EXPORTER_OTLP_PROTOCOL. Supported values: grpc, http/protobuf, http/json.Number of retry attempts on transient failures. Reads from
OTEL_EXPORTER_OTLP_MAX_RETRIES.Timeout in milliseconds for trace export requests. Reads from
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT, falling back to OTEL_EXPORTER_OTLP_TIMEOUT.Additional HTTP headers for trace export requests, in
key=value,key=value format. Reads from OTEL_EXPORTER_OTLP_TRACES_HEADERS, falling back to OTEL_EXPORTER_OTLP_HEADERS.Override the transport protocol for trace exports only. Reads from
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL. Falls back to protocol when not set.Timeout in milliseconds for metrics export requests. Reads from
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT, falling back to OTEL_EXPORTER_OTLP_TIMEOUT.Additional HTTP headers for metrics export requests, in
key=value,key=value format. Reads from OTEL_EXPORTER_OTLP_METRICS_HEADERS, falling back to OTEL_EXPORTER_OTLP_HEADERS.Override the transport protocol for metrics exports only. Reads from
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL. Falls back to protocol when not set.Preferred aggregation temporality for exported metrics. Reads from
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE. Supported values: Delta, Cumulative. When not set, the SDK and exporter defaults apply.Timeout in milliseconds for log export requests. Reads from
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT, falling back to OTEL_EXPORTER_OTLP_TIMEOUT.Additional HTTP headers for log export requests, in
key=value,key=value format. Reads from OTEL_EXPORTER_OTLP_LOGS_HEADERS, falling back to OTEL_EXPORTER_OTLP_HEADERS.Override the transport protocol for log exports only. Reads from
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL. Falls back to protocol when not set.exporters.zipkin
Zipkin is supported for traces only.Identifies this as a Zipkin exporter.
Base URL of the Zipkin server. The path
/api/v2/spans is appended automatically. Reads from OTEL_EXPORTER_ZIPKIN_ENDPOINT.Timeout in milliseconds for export requests. Reads from
OTEL_EXPORTER_ZIPKIN_TIMEOUT.Number of retry attempts on transient failures. Reads from
OTEL_EXPORTER_ZIPKIN_MAX_RETRIES.instrumentation
Controls which built-in instrumentations are active and their options. The key is the instrumentation class name; the value is either a boolean or an options array containing at minimumenabled.
HttpServerInstrumentation
HttpServerInstrumentation
Automatically traces incoming HTTP requests by registering a middleware globally.
Enable or disable this instrumentation. Reads from
OTEL_INSTRUMENTATION_HTTP_SERVER.List of URL paths to exclude from tracing.
List of HTTP methods to exclude from tracing (e.g.,
HEAD, OPTIONS).Request/response headers to capture and include in the span attributes.
Headers present in
allowed_headers whose values should be redacted.Query parameter names whose values should be redacted from the span.
HttpClientInstrumentation
HttpClientInstrumentation
Automatically traces outgoing HTTP requests made with Laravel’s
Http facade.Enable or disable this instrumentation. Reads from
OTEL_INSTRUMENTATION_HTTP_CLIENT.When
true, tracing is opt-in per request. You must call Http::withTrace()->get(...) to trace a specific request.Request/response headers to capture and include in the span attributes.
Headers present in
allowed_headers whose values should be redacted.Query parameter names whose values should be redacted from the span.
QueryInstrumentation
QueryInstrumentation
Traces each database query as an individual span.Set to
true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_QUERY.QueueInstrumentation
QueueInstrumentation
Traces queue job dispatch (as a
PRODUCER span) and execution (as a CONSUMER span).Set to true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_QUEUE.RedisInstrumentation
RedisInstrumentation
Traces each Redis command as an individual span.Set to
true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_REDIS.CacheInstrumentation
CacheInstrumentation
Records cache operations as events on the current active span.Set to
true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_CACHE.EventInstrumentation
EventInstrumentation
Records Laravel events as events on the current active span.
Enable or disable this instrumentation. Reads from
OTEL_INSTRUMENTATION_EVENT.List of event class names to exclude from recording.
ViewInstrumentation
ViewInstrumentation
Creates a span for each view rendered by Laravel.Set to
true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_VIEW.LivewireInstrumentation
LivewireInstrumentation
Creates a span for each Livewire component render.Set to
true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_LIVEWIRE.ConsoleInstrumentation
ConsoleInstrumentation
Traces Artisan commands. Commands are not traced by default — you must list them explicitly.
Enable or disable this instrumentation. Reads from
OTEL_INSTRUMENTATION_CONSOLE.List of commands to trace. Accepts command signatures (e.g.,
app:sync) or fully-qualified class names.ScoutInstrumentation
ScoutInstrumentation
Traces Laravel Scout search, update, and delete operations.Set to
Requires the
opentelemetry PHP extension and Laravel Scout 10.23+.true/false or an array with enabled. Reads from OTEL_INSTRUMENTATION_SCOUT.worker_mode
Configuration for long-running process support (Octane, Horizon, queue workers). Worker mode is detected automatically using the configured detectors.When
true, all telemetry data is flushed at the end of each iteration (HTTP request, queue job). When false, data is batched and flushed periodically or on process shutdown. Reads from OTEL_WORKER_MODE_FLUSH_AFTER_EACH_ITERATION.Interval in seconds at which metrics are collected and exported when running in worker mode. Ignored when
flush_after_each_iteration is true. The actual interval may be slightly longer since the check occurs after each iteration. Reads from OTEL_WORKER_MODE_COLLECT_INTERVAL.Ordered list of detector class names used to identify whether the application is running in worker mode. Detectors are checked in order; the first one that returns
true activates worker mode.Built-in detectors:OctaneWorkerModeDetector— detects Laravel OctaneQueueWorkerModeDetector— detects Laravel default queue worker and Horizon
WorkerModeDetectorInterface.