Environment variable
Configure agentcrumbs with the AGENTCRUMBS env var
In Node.js, everything is controlled by a single AGENTCRUMBS environment variable. In the browser, use configure() instead.
Shorthand values
| Value | Effect |
|---|---|
1 | Enable all namespaces |
* | Enable all namespaces |
true | Enable all namespaces |
| (unset) | Disabled. All calls are noop. |
AGENTCRUMBS=1 node your-app.jsNamespace filter
Non-JSON string values are treated as namespace filters:
AGENTCRUMBS=auth-* # Wildcard match
AGENTCRUMBS=auth-service # Exact matchJSON config
For full control, pass a JSON object:
# Enable specific namespaces
AGENTCRUMBS='{"ns":"auth-*,api-*"}'
# With exclusions
AGENTCRUMBS='{"ns":"* -internal-*"}'
# Custom port
AGENTCRUMBS='{"ns":"*","port":9999}'
# JSON output format (instead of pretty)
AGENTCRUMBS='{"ns":"*","format":"json"}'
# Explicit app name
AGENTCRUMBS='{"app":"my-project","ns":"*"}'Config schema
| Field | Type | Default | Description |
|---|---|---|---|
app | string | (auto-detect) | App name. Defaults to nearest package.json name |
ns | string | (required) | Namespace filter pattern |
port | number | 8374 | Collector HTTP port |
format | "pretty" | "json" | "pretty" | Output format for stderr |
App name
Every crumb is stamped with an app name. This keeps crumbs from different projects separate.
The app name is resolved in this order:
appfield in the JSON configAGENTCRUMBS_APPenvironment variable- Auto-detected from the nearest
package.jsonname field (walking up fromcwd) - Fallback:
"unknown"
# Override via dedicated env var
AGENTCRUMBS_APP=my-project AGENTCRUMBS=1 node app.jsNamespace patterns
*matches everythingauth-*matchesauth-service,auth-oauth, etc.auth-*,api-*matches multiple patterns (comma or space separated)* -internal-*matches everything except namespaces starting withinternal-