Skip to main content

Configuration

Introduction​

All of the package's configuration lives in config/monitor.php. Publish it with php artisan vendor:publish --tag=monitor-config. Every key has a default, so the package runs unpublished.

domains​

How a class name becomes the domain field on every record.

KeyTypeDefaultMeaning
maparray<string, string|null>App\ControlPoints\, App\Services\, App\ all nullNamespace prefix to domain. null takes the namespace segment right after the prefix; a string is used as-is. Tried in order, first match wins.
fallbackstring'App'The domain for a class matching no prefix, or sitting directly under one.

critical_namespaces​

TypeDefault
string[]['App\ControlPoints']

Namespaces whose classes are expected to be control points. The inventory's critical_namespace_uncontrolled rule, the toBeControlled() Pest expectation and the PHPStan rule read this list: a class here that neither extends ControlPoint nor calls Monitor::control() is reported. Interfaces, traits, enums, abstract classes, escalations and policies are exempt.

point_name_pattern​

TypeDefault
string (regex)'/^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$/'

Every point name is validated against this at declaration time and by the inventory's name_pattern rule. The default is dotted lowercase with at least one dot.

discovery​

KeyTypeDefaultMeaning
pathsstring[]['app']Directories the inventory scans for control point classes and inline Monitor::control() calls. Absolute, or relative to base_path().

inventory​

KeyTypeDefaultMeaning
rulesarray<string, bool>[]Rules to switch off by setting them to false. Every rule is on unless listed.

The rules are duplicate_names, name_pattern, missing_escalation, critical_namespace_uncontrolled, unreadable_control (errors) and catch_all_without_escalation, dynamic_name (warnings). See Inventory.

profiles​

TypeDefault
array<string, array>external, database, messaging, internal

Named bundles applied with ->profile() or the attribute's profile: argument. Each profile is an array with any of these keys:

KeyShape
retry['times' => int, 'backoff_ms' => int, 'multiplier' => float, 'jitter' => bool, 'on' => class[], 'except' => class[]]
transaction['retries' => int, 'on' => class[], 'except' => class[], 'connection' => string|null, 'backoff_ms' => int]
breaker['name' => string, 'after' => int, 'within' => int, 'for' => int, 'on' => class[], 'except' => class[]]; name defaults to the point's name
withinseconds, int|float
attemptsint

The shipped values are listed in Policies and Limits. Class names in on and except that are not Throwable are ignored.

trace​

KeyTypeDefaultEnvMeaning
headerstring'traceparent'The W3C header the middleware reads first and writes back.
legacy_headerstring'X-Trace-Id'MONITOR_TRACE_HEADERA plain trace-ID header read second and written back, for clients that do not speak traceparent.
consolebooltrueMONITOR_TRACE_CONSOLEStart a trace when an artisan command starts (on CommandStarting), so commands and workers have one.

breakers​

Defaults for circuits used without explicit numbers, including the standalone Monitor::breaker() API, the route middleware and profiles that omit a value.

KeyTypeDefaultEnvMeaning
storestring|nullnullMONITOR_BREAKER_STOREThe cache store holding circuit state; null is the default store.
prefixstring'monitor:breaker:'Cache key prefix.
afterint5Failures that open a circuit.
withinint60Seconds a failure stays counted.
forint120Seconds a circuit stays open before a probe is allowed.

once​

Where the once() policy keeps its idempotency keys.

KeyTypeDefaultEnvMeaning
storestring|nullnullMONITOR_ONCE_STOREThe cache store holding the keys; null is the default store. Keys are shared exactly as far as the store is.
prefixstring'monitor:once:'Cache key prefix, followed by the point name, a colon and the key.

records​

KeyTypeDefaultEnvMeaning
channelstring|nullnullMONITOR_LOG_CHANNELThe log channel records are written to; null is the default channel.
redactionstring|null'observability'MONITOR_REDACTION_PROFILEThe Redactor profile applied to record context and exception messages, to stored outcomes, and to MCP responses. Empty or null disables redaction.
exception_trace'never'|'debug'|'always''never'MONITOR_EXCEPTION_TRACEWhether exception summaries include a stack trace: never, only when app.debug is on, or always.
exception_trace_linesint15Trace lines kept when a trace is included; the rest is counted in trace_truncated.

records.levels​

TypeDefault
array<string, string>see below

The PSR-3 level for each record event. Events not listed are written at info.

EventDefault
point.starteddebug
point.retriednotice
point.limitwarning
point.recoveredwarning
point.refusedwarning
point.escalatederror
point.endedinfo
escalation.failedcritical
breaker.openederror
breaker.half_opennotice
breaker.closedinfo

Event names contain dots, so set the whole array rather than one nested key.

records.store​

KeyTypeDefaultEnvMeaning
enabledboolfalseMONITOR_STORE_ENABLEDKeep outcomes in a table. Publish and run the migration first; see Store.
connectionstring|nullnullMONITOR_STORE_CONNECTIONThe database connection for the table; null is the default.
tablestring'monitor_outcomes'The table name.
retention_daysint30What monitor:prune deletes past.

mcp​

KeyTypeDefaultEnvMeaning
enabledboolfalseMONITOR_MCP_ENABLEDRegister the read-only MCP server. Requires laravel/mcp.
handlestring'monitor'The handle for php artisan mcp:start monitor.

Environment Variables​

VariableKey
MONITOR_TRACE_HEADERtrace.legacy_header
MONITOR_TRACE_CONSOLEtrace.console
MONITOR_BREAKER_STOREbreakers.store
MONITOR_ONCE_STOREonce.store
MONITOR_LOG_CHANNELrecords.channel
MONITOR_REDACTION_PROFILErecords.redaction
MONITOR_EXCEPTION_TRACErecords.exception_trace
MONITOR_STORE_ENABLEDrecords.store.enabled
MONITOR_STORE_CONNECTIONrecords.store.connection
MONITOR_MCP_ENABLEDmcp.enabled

Only values that change between environments have a variable; the rest are code-level defaults edited in the published file. php artisan about shows the store, MCP and profile settings in effect.