Skip to main content
Beads exports metrics via OTLP HTTP. Telemetry is disabled by default — zero overhead when no variable is set.

Configuration

Telemetry is explicit opt-in. Set BD_OTEL_ENABLED=true and configure the exporter via standard OpenTelemetry SDK environment variables — both go in your shell profile or workspace .env:
A standard OTEL_* variable alone will not turn bd telemetry on — bd won’t auto-activate from a machine-global OTEL_* setting that was set for some other instrumented tool. Log export is not implemented yet. BD_OTEL_LOGS_URL is reserved for a future VictoriaLogs exporter and does not activate telemetry today.

Environment variables

Resource attributes

Every metric and span carries the OTel resource describing the bd process: The resource never carries the command line (process.command_args), the executable path or the OS user name (process.owner): the command line can hold secrets, issue titles and search text, and the other two identify the user. The command span’s bd.args names the command and the flags that were set, never their values (see Traces). Add anything else via OTEL_RESOURCE_ATTRIBUTES.

Local debug mode

Legacy environment variables (deprecated)

The earlier BD_OTEL_* data variables are honored for backwards compatibility. Setting any of them activates telemetry on its own (no BD_OTEL_ENABLED=true required) and translates to the standard OTLP equivalent — a legacy value wins over a pre-existing OTEL_* value so a machine-global OTEL_* setting cannot silently redirect bd telemetry. Each bd invocation that sees one logs a one-line deprecation warning to stderr:

Verification

Verification queries in Grafana (VictoriaMetrics datasource):

Confirm storage instrumentation locally

To verify the storage decorator chain is wired up without standing up a collector, run bd with the console exporters and look for bd.storage.* records on stderr:
Expect at least one line per storage call (GetReadyWork, GetIssue, …). If bd.storage.* and bd.issue.count are absent but bd.db.pool_* is present, the storage decorator is not in the chain — check wireStorageDecorators in cmd/bd/storage_chain.go.

Metrics

Storage (bd_storage_*)

These metrics are emitted by InstrumentedStorage, the beads SDK wrapper.

Dolt database (bd_db_*)

The connection-pool gauges (bd_db_pool_open, bd_db_pool_in_use, bd_db_pool_idle, bd_db_pool_max_open) sum the pools of the stores open in the process. With no store open they report the last-known values of the stores that closed since the last open, not live ones; a short command closes its store before its final export.

Issues (bd_issue_*)

status values: open, in_progress, closed, deferred.

AI (bd_ai_*)


Traces (spans)

Spans are only exported when OTEL_TRACES_EXPORTER=console — there is no trace backend in the recommended local stack.

Notable attributes

bd.command.<name> hook.exec The hook.stdout / hook.stderr events carry one attribute, bytes (how much the script wrote). The text is not exported: a hook receives the issue as JSON on stdin and often echoes or logs it.

Issue content

Span attributes and events say what ran and count and time it: issue ids, actors, issue types, config and kv keys, provenance refs, branch and remote names, the hook path, and SQL statements with their ? placeholders. Some of these repeat what you typed: an issue id you named, an --actor value, a bd kv set key, a bd provenance by-ref ref or a branch name. They never carry issue content: no titles, descriptions, notes, labels, comments, close reasons, search text, commit messages or hook output, and bd.args never carries an argument or a flag value. A failed span records its error message, which can quote the input that failed.

Architecture

When no OpenTelemetry SDK environment variable selects an exporter, telemetry.Init() installs no-op providers: hot paths execute only no-op calls with no memory allocation.