# Telemetry

Source: https://dbmcp.haymon.ai/configuration/telemetry/

dbmcp sends usage metrics to the dbmcp maintainers' collector at `telemetry.haymon.ai`, every `telemetry.interval` (about hourly by default) and at exit: dbmcp version, OS and architecture, install channel, database type, version line, and support tier, MCP client name and protocol version, transport, the state of one randomly picked feature setting, and tool-call counts and durations. It never sends SQL, query results, error text, database or table names, or identifiers. Every start prints one `telemetry:` line on stderr that says whether metrics are sent and, if so, what and where.

To stop it, see [Turn it off](#turn-it-off).

## What is sent

dbmcp sends OTLP metrics only: one resource, five instruments under the scope `dbmcp`, and the attributes below. Nothing else is sent, and every value is one listed here or, for `service.version` and `dbmcp.mcp.client.name`, described here. The schema is the same for every collector, except for what you add to your own (see [Differences for your own collector](#differences-for-your-own-collector)).

### Service information

| Key | Values |
|-----|--------|
| `service.name` | `dbmcp` |
| `service.version` | The dbmcp version, for example `0.21.0` |
| `os.type` | `linux`, `darwin`, or `windows` for release builds. Source builds for other systems send `freebsd`, `netbsd`, `openbsd`, `dragonflybsd`, or `solaris` (illumos too); any other system omits the key |
| `host.arch` | `amd64` or `arm64` for release builds. Source builds send `x86`, `arm32`, `ppc64`, or `s390x`; any other architecture omits the key. This is the architecture the binary was built for, so an `amd64` build running under emulation (Rosetta, QEMU) sends `amd64` |
| `db.system.name` | `mysql`, `mariadb`, `postgresql`, or `sqlite`: the configured `database.backend` |
| `dbmcp.install.channel` | `plugin`, `npm`, `docker`, `helm`, `direct`, or `unknown`: how dbmcp was installed |

### Instruments

Every instrument has delta temporality: each export carries what changed since the previous one. The counters are `u64` monotonic counters; `dbmcp.tool.duration` is an `f64` histogram in seconds with fixed buckets, described under **Durations** below.

| Instrument | Kind | Unit | Records | Attributes |
|------------|------|------|--------|------------|
| `dbmcp.process.starts` | Counter | `{start}` | +1 when telemetry starts | `dbmcp.config.key`, `dbmcp.config.state`, `network.transport` |
| `dbmcp.process.ready` | Counter | `{start}` | +1 on the first successful tool call of the process | `dbmcp.db.line`, `dbmcp.db.tier`, `dbmcp.mcp.client.name`, `network.transport`, `mcp.protocol.version` |
| `dbmcp.tool.calls` | Counter | `{call}` | +1 per tool call | `gen_ai.tool.name`, `error.type`, `dbmcp.mcp.client.name`, `network.transport`, `mcp.protocol.version` |
| `dbmcp.tool.duration` | Histogram | `s` | Seconds per tool call | `gen_ai.tool.name`, `error.type`, `network.transport` |
| `dbmcp.uptime` | Observable counter | `s` | Whole seconds since the previous export, counted from when telemetry started (summed over exports, about the process's run time, short of a skipped or abandoned exit export) | `network.transport` |

### Attribute values

| Attribute | Values |
|-----------|--------|
| `gen_ai.tool.name` | `objects`, `read`, `write`, or `explain` |
| `error.type` | Absent when the call succeeded. Otherwise `refused` (dbmcp refused the statement or could not parse it), `db_error` (the database reported an error), `timeout` (the query timeout passed), `connection` (the database could not be reached), `invalid` (the call's parameters were rejected), or `tool_error` (any other failure) |
| `dbmcp.db.line` | The version line of the connected server when it is one of the [Supported lines](/supported-versions#versions) of that release (for example `17`, `8.4`, `11.8`, or `3.54`), else `other`, whatever `dbmcp.db.tier` is (a fork reporting a listed line keeps it) |
| `dbmcp.db.tier` | `supported`, `best_effort`, or `unsupported`, as on [Supported versions](/supported-versions#tiers); `unknown` when the version could not be read or did not match `database.backend` |
| `dbmcp.mcp.client.name` | The name the MCP client reports for itself, guarded as below |
| `network.transport` | `pipe` (stdio transport) or `tcp` (HTTP transport) |
| `dbmcp.config.key` | `privacy.mode`, `privacy.rules`, `privacy.model`, `database.read_only`, `ssh`, or `database.ssl`: the setting this start samples |
| `dbmcp.config.state` | `none`, `rules`, or `full` for `privacy.mode`; `on` or `off` for every other key |
| `mcp.protocol.version` | The MCP protocol revision the call used, for example `2025-11-25` or `2026-07-28`, when it is one the release supports. Absent when no version is known: HTTP clients older than `2025-06-18` send none. |

**Client name.** dbmcp takes the name each request's client reports (the MCP `clientInfo` name), trims it, and then sends `unknown` when it is empty, missing, or `rmcp` (the placeholder the MCP SDK fills in when a client sends none), `other` when it is longer than 64 bytes or contains any character outside printable ASCII, and the name itself otherwise. No client version is sent. Claude Desktop reports `local-agent-mode-<server>`, where `<server>` is the name you gave the dbmcp server in its config; dbmcp sends only `local-agent-mode`, never that name. One process sends at most eight distinct client names besides `unknown` and `other` (`local-agent-mode` counts as one); any further name is sent as `other`.

**Config sample.** Each start picks one `dbmcp.config.key` at random, each equally likely, and sends its effective state, never a configured value: `privacy.rules` is `on` when column rules apply, `privacy.model` when the NER model runs (`privacy.mode: full`), `ssh` when the SSH tunnel is configured, and `database.ssl` when set on a backend other than SQLite. Across many starts, each state's share estimates how common the setting is. A start sends neither key when the system offers no random number.

**Tool calls.** Every call to one of the four tools counts, whatever its outcome. Calls to unknown tool names are not counted.

**Durations.** `dbmcp.tool.duration` measures each call from dbmcp starting the tool to its result being ready, parameter checks, the database, and redaction included. It records one duration for every call `dbmcp.tool.calls` counts, rejected calls included. Each point carries the number of calls, the sum, minimum, and maximum of their durations, and a count per bucket. The bucket upper bounds, in seconds, are `0.001`, `0.0025`, `0.005`, `0.01`, `0.025`, `0.05`, `0.1`, `0.25`, `0.5`, `1`, `2.5`, `5`, `10`, `30`, `60`, `120`, and `300`, plus one bucket above `300`.

### Differences for your own collector

Your own collector differs only in that:

- your `telemetry.resource_attributes` are added to the resource, and can replace the `service.*`, `os.type`, `host.arch`, and `db.system.name` values (never a `dbmcp.*` key);
- your `telemetry.headers` and `telemetry.ssl_ca` apply to its requests.

### Schema changes

A schema change (an added, removed, or renamed instrument, attribute key, or value, or a changed kind, unit, temporality, or bucket bounds) ships in one `feat(telemetry): …` pull request that updates this page and, for a new category of data, the startup `telemetry:` line.

Not a schema change: a Supported line added or dropped (it changes which `dbmcp.db.line` values appear, by the rule above), a new client name passing the guard, and an MCP protocol revision added to or dropped from those the release supports.

The default collector stores only the keys and values listed here and drops the rest, including new ones until its list is updated.

## Turn it off

Set `telemetry.mode: off` in the config file, or `DBMCP_TELEMETRY_MODE=off` in the process env or an [env file](/configuration/env-files). The startup line then reads `telemetry: off (telemetry.mode)`.

- **Helm**: `config.telemetry.mode: "off"`, quoted, because Helm reads a bare `off` as `false`, which fails startup.
- **Claude Code plugin**: set **Usage metrics** to `off` in `/plugin configure`.
- **Codex plugin**: add `DBMCP_TELEMETRY_MODE=off` to the env file the setup skill created (`${CODEX_HOME:-$HOME/.codex}/plugins/data/dbmcp-haymon-ai/.env`), or export it in the shell that starts Codex.
- **CI**: set `DO_NOT_TRACK=1` or `DBMCP_TELEMETRY_MODE=off` in the job's environment. dbmcp does not detect CI.

`off` also stops export to [your own collector](#send-it-to-your-own-collector) and `log` mode.

When telemetry cannot start, it is off and the startup line names the cause, for example `telemetry: off (telemetry.ssl_ca holds no readable PEM certificate)`. The line prints at every log level.

### `DO_NOT_TRACK`

dbmcp honours the [Console Do Not Track](https://web.archive.org/web/2022/https://consoledonottrack.com/) convention. When the process env sets `DO_NOT_TRACK` to `1` or `true` (any case, surrounding whitespace ignored), nothing is sent to the default collector, whatever `telemetry.mode` says, and the startup line reads `telemetry: off (DO_NOT_TRACK)`. Any other value, including `0`, `false`, or empty, is ignored.

`DO_NOT_TRACK` only stops export to the default collector: [your own collector](#send-it-to-your-own-collector) and `log` mode keep working. It is read from the process env only, not from env files. When `telemetry.mode` is also `off`, the startup line names `telemetry.mode`.

## Security and privacy

- SQL text (`db.query.text`) isn't sent. Only the tool called is recorded.
- Tool arguments, tool results, and row content aren't sent. Only each call's outcome and duration are recorded.
- Error messages and any other error text aren't sent. Only the error kind (`error.type`) is recorded.
- Database, schema, table, and column names aren't sent. Only the database type, version line, and support tier are recorded.
- Host names, IP addresses (beyond the TCP connection itself), `service.instance.id`, and any other identifier aren't sent.
- Traces, logs, and exemplars aren't sent. dbmcp exports metrics only.
- Request headers are limited to `content-type`, `content-length`, `host`, and `user-agent` (`dbmcp/<version>`). `OTEL_*` headers are never sent.

The same holds for your own collector, except for what you add yourself through `telemetry.resource_attributes` and `telemetry.headers`.

Because no process identifier is sent, many processes report identical series. The default collector therefore adds up the delta points it receives as they arrive; it never deduplicates them or converts them to cumulative series.

## When

dbmcp exports about every `telemetry.interval` seconds (default `3600`; `60` to `86400`) and once at exit. Each process picks a fixed period between 75% and 125% of the interval at startup, so processes started together do not export together (the exact interval when the system offers no random number). `DBMCP_LOG_LEVEL=debug` logs the period picked.

**Failed exports.** An export that fails with a network error or HTTP `429`, `502`, `503`, or `504` is retried once, then dropped; any other HTTP error is dropped at once. If the endpoint's IPv6 route is broken, dbmcp falls back to IPv4 after 250 ms. At exit it waits at most 3 seconds for the last export. `DBMCP_LOG_LEVEL=debug` logs each request that fails at the network level and how the exit export ended; HTTP error responses are not logged.

**Short runs.** In `otlp` mode, a process that exits within 60 seconds of starting without a tool call skips its exit export. With `telemetry.interval` below `80`, a periodic export may already have gone out by then. `log` mode always prints the exit export.

## Send it to your own collector

Set `telemetry.endpoint` to send to your OpenTelemetry collector over OTLP/HTTP (protobuf) **instead** of the default collector. The endpoint alone is enough, because `telemetry.mode` defaults to `otlp`.

```yaml
telemetry:
  endpoint: https://otel.example.com:4318
  headers:
    authorization: ${OTEL_AUTH_HEADER}
  interval: 60
  resource_attributes:
    deployment.environment.name: production
```

For debugging, lower `interval` to `60` as above, and reset it for production use. To check what would be sent without sending it, set `telemetry.mode: log`: dbmcp prints each request to stderr instead.

| YAML key | Env var | Type | Default | Description |
|----------|---------|------|---------|-------------|
| `telemetry.mode` | `DBMCP_TELEMETRY_MODE` | enum | `otlp` | `otlp` exports over OTLP/HTTP; `log` prints the request to stderr and sends nothing; `off` sends nothing |
| `telemetry.endpoint` | `DBMCP_TELEMETRY_ENDPOINT` | string | — (the default collector) | Base URL of your own collector, without `/v1/metrics` |
| `telemetry.headers` | `DBMCP_TELEMETRY_HEADERS` | map | — | Request headers, e.g. an `authorization` token |
| `telemetry.ssl_ca` | `DBMCP_TELEMETRY_SSL_CA` | path | — | Extra CA certificate for an `https` endpoint |
| `telemetry.interval` | `DBMCP_TELEMETRY_INTERVAL` | seconds | `3600` | Average export interval, `60` to `86400` |
| `telemetry.resource_attributes` | `DBMCP_TELEMETRY_RESOURCE_ATTRIBUTES` | map | — | Extra resource attributes |

`telemetry.headers`, `telemetry.ssl_ca`, and `telemetry.resource_attributes` apply only to your own collector: without `telemetry.endpoint` they are ignored. Any set `telemetry.endpoint` counts as your own collector, even `https://telemetry.haymon.ai`: then these settings reach the default collector and `DO_NOT_TRACK` no longer applies, so leave it unset to use the default collector.

`telemetry.endpoint`, `telemetry.headers`, and `telemetry.resource_attributes` are checked at startup in every mode, so a bad value fails startup even with `telemetry.mode: off`. The `telemetry.ssl_ca` file is read only when it is used (`otlp` mode, `https` endpoint); an unreadable file or one with no PEM certificate then turns telemetry off with a startup line naming the cause.

**Endpoint.** An absolute `http://` or `https://` base URL. dbmcp strips one trailing `/` and appends `/v1/metrics`, keeping any query string: `https://otel.example.com:4318/` sends to `https://otel.example.com:4318/v1/metrics`. A URL whose path already ends in `/v1/metrics` is rejected, since dbmcp appends it itself. The scheme alone decides TLS. A user name or password in the URL is rejected, since its host is printed at startup; put credentials in `telemetry.headers`.

**Headers.** Sent with every request to your collector. `content-type`, `content-length`, `host`, `user-agent`, and `content-encoding` (any case) are set by dbmcp and rejected, as are names or values that are not valid HTTP and a name repeated in another case. `transfer-encoding`, `connection`, `te`, `expect`, and `upgrade` are dropped. Header values are never shown in error messages, but they are secrets: keep them in an [env file](/configuration/env-files) or `${}`-interpolate them rather than writing them into a shared config file.

**Resource attributes.** Added to every request's resource; they win over dbmcp's `service.*`, `os.type`, `host.arch`, and `db.system.name`. Keys starting with `dbmcp.` (lowercase) are rejected.

**Map values.** In YAML, `headers` and `resource_attributes` are a mapping of strings. In an env var, an env file, or a YAML string, they are `key=value` pairs separated by commas, each key and value trimmed and percent-decoded: `DBMCP_TELEMETRY_HEADERS=authorization=Bearer%20abc,x-tenant=a`. The source that wins supplies the whole map; maps from different sources are never merged. A malformed value fails startup with an error that names the setting, never the text.

**CA certificate.** `telemetry.ssl_ca` adds a PEM certificate to the built-in WebPKI roots for an `https` endpoint. With an `http` endpoint it is ignored.

**Proxy.** Requests honour `ALL_PROXY`, `HTTPS_PROXY`, `HTTP_PROXY`, and `NO_PROXY` (either case, uppercase first), read from the process env only, never from env files. The first one set, in that order, applies to every request, so `HTTP_PROXY` alone also proxies `https`, including the default collector.

**No implicit `OTEL_*`.** dbmcp ignores every `OTEL_*` variable, `OTEL_SDK_DISABLED` and `OTEL_EXPORTER_OTLP_ENDPOINT` included. To reuse one, interpolate it, for example `endpoint: ${OTEL_EXPORTER_OTLP_ENDPOINT}`.

**Cumulative backends.** Every instrument uses delta temporality. For a backend that stores cumulative series, such as Prometheus, give each process its own identity with a `service.instance.id` resource attribute and convert in the collector with the `deltatocumulative` processor.