Reference for all environment variables supported by laravel-opentelemetry.
Most configuration options in config/opentelemetry.php can be set via environment variables. This page lists every supported variable grouped by category.
Variables that follow the official OpenTelemetry specification (prefixed OTEL_) are read directly by both the package and the underlying OpenTelemetry PHP SDK.
Core
Variable
Description
Default
OTEL_SDK_DISABLED
Disable the OpenTelemetry SDK entirely. No telemetry data is collected or exported.
false
OTEL_SERVICE_NAME
Logical name of your service, reported on all telemetry.
Slugified APP_NAME
OTEL_SERVICE_INSTANCE_ID
Unique identifier for this instance of the service. A random ID is generated per request when not set.
—
OTEL_RESOURCE_ATTRIBUTES
Additional resource attributes attached to all telemetry. Format: key1=value1,key2=value2.
—
OTEL_USER_CONTEXT
Attach the authenticated user ID as user.id on root spans and log records.
true
OTEL_PROPAGATORS
Comma-separated list of context propagators. Options: tracecontext, baggage, b3, b3multi, none.
tracecontext
Exporters
OTLP (default exporter)
Variable
Description
Default
OTEL_EXPORTER_OTLP_ENDPOINT
Base URL of the OTLP receiver for all signals.
http://localhost:4318
OTEL_EXPORTER_OTLP_PROTOCOL
Transport protocol for all signals. Options: grpc, http/protobuf, http/json.
http/protobuf
OTEL_EXPORTER_OTLP_HEADERS
Default HTTP headers for all OTLP export requests. Format: key=value,key=value.
—
OTEL_EXPORTER_OTLP_TIMEOUT
Default export timeout in milliseconds for all signals.
10000
OTEL_EXPORTER_OTLP_MAX_RETRIES
Number of retry attempts on transient failures.
3
Per-signal overrides — Traces
Variable
Description
Default
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
Override transport protocol for traces.
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_TRACES_HEADERS
Override HTTP headers for trace export requests.
OTEL_EXPORTER_OTLP_HEADERS
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT
Override timeout (ms) for trace export requests.
OTEL_EXPORTER_OTLP_TIMEOUT
Per-signal overrides — Metrics
Variable
Description
Default
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL
Override transport protocol for metrics.
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_METRICS_HEADERS
Override HTTP headers for metrics export requests.
OTEL_EXPORTER_OTLP_HEADERS
OTEL_EXPORTER_OTLP_METRICS_TIMEOUT
Override timeout (ms) for metrics export requests.
OTEL_EXPORTER_OTLP_TIMEOUT
Per-signal overrides — Logs
Variable
Description
Default
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL
Override transport protocol for logs.
OTEL_EXPORTER_OTLP_PROTOCOL
OTEL_EXPORTER_OTLP_LOGS_HEADERS
Override HTTP headers for log export requests.
OTEL_EXPORTER_OTLP_HEADERS
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT
Override timeout (ms) for log export requests.
OTEL_EXPORTER_OTLP_TIMEOUT
Zipkin
Variable
Description
Default
OTEL_EXPORTER_ZIPKIN_ENDPOINT
Base URL of the Zipkin server. The /api/v2/spans path is appended automatically.
http://localhost:9411
OTEL_EXPORTER_ZIPKIN_TIMEOUT
Export timeout in milliseconds.
10000
OTEL_EXPORTER_ZIPKIN_MAX_RETRIES
Number of retry attempts on transient failures.
3
Signals
Variable
Description
Default
OTEL_TRACES_EXPORTER
Exporter driver for traces. Options: otlp, zipkin, console, memory, null.
otlp
OTEL_METRICS_EXPORTER
Exporter driver for metrics. Options: otlp, console, memory, null.
otlp
OTEL_LOGS_EXPORTER
Exporter driver for logs. Options: otlp, console, memory, null.
otlp
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
Preferred aggregation temporality for OTLP metrics. Options: Delta, Cumulative.
SDK default
Trace sampling
Head sampling
Variable
Description
Default
OTEL_TRACES_SAMPLER_PARENT
Wrap the sampler in a ParentBasedSampler so child spans follow the parent’s decision.
true
OTEL_TRACES_SAMPLER_TYPE
Head sampler type. Options: always_on, always_off, traceidratio.
always_on
OTEL_TRACES_SAMPLER_TRACEIDRATIO_RATIO
Sampling ratio for the traceidratio sampler. 0.05 means 5% of traces are kept.
0.05
Tail sampling
Variable
Description
Default
OTEL_TRACES_TAIL_SAMPLING_ENABLED
Enable tail sampling. When enabled, sampling decisions are deferred until the trace ends.
false
OTEL_TRACES_TAIL_SAMPLING_DECISION_WAIT
Maximum time in milliseconds to wait for a trace to complete before making a decision.
5000
OTEL_TRACES_TAIL_SAMPLING_RULE_KEEP_ERRORS
Enable the built-in ErrorsRule that keeps traces containing error spans.
true
OTEL_TRACES_TAIL_SAMPLING_RULE_SLOW_TRACES
Enable the built-in SlowTraceRule that keeps traces exceeding the duration threshold.