Introducing a new way to review your PRs.

Read the announcement

helixdb / helix-db

HelixDB is an OLTP graph database with native vector and full-text search built in Rust on Object Storage.

View on GitHub

27 documents · Updated Nov 23, 2026

docs / telemetry-collection

Telemetry collection

Telemetry collection provides operational observations for the Helix CLI, server, and embedded runtimes. It records product operations and query outcomes as optional, privacy-bounded events so telemetry problems do not block the work that produces those observations.

Collection model

The metrics crate is the shared boundary for event meaning, collection settings, local buffering, and HTTP delivery. It has two paths: a durable CLI path and a best-effort query path.

Event sources

The system marks each envelope as helix-cli, helix-server, or helix-embedded. CLI events describe actions such as compile, deploy, test, and Chef runs. Query events describe work done by server or embedded query services.

The source is part of the shared event contract. This lets operational analysis compare product actions with query behavior without using separate event formats.

References: crates/…/telemetry.rs• L56-64 crates/…/mod.rs• L149-158 crates/…/query.rs• L304-315

Privacy and attribution

Collection has basic, full, and off levels. basic keeps a stable installation ID but no user ID. full may include the configured user ID. off starts no sender and removes pending CLI events.

Each runtime also reports pseudonymous attribution. A session ID identifies one telemetry runtime. Project and deployment IDs allow related activity to be grouped when the system can derive them from a repository or storage. These IDs do not send repository or bucket names, but they are pseudonymous rather than anonymous because a party with known source values can check the hashes.

The system identifies the runtime environment as CI, Kubernetes, a container, or a host. DO_NOT_TRACK can turn collection off, and process environment values can override the saved level, identity, and endpoint without changing the saved preference.

References: crates/…/config.rs• L10-17 crates/…/config.rs• L46-107 crates/…/attribution.rs• L1-16 crates/…/attribution.rs• L227-284 crates/…/README.md• L14-37

Event contract

Events use a versioned JSON envelope with a source, send time, client details, and one or more events. The contract limits event properties and envelope size before a request leaves the process.

ContractLimit or rule
Envelope eventsUp to 500
Envelope sizeUp to 1 MiB
Event propertiesA JSON object up to 16 KiB
EndpointHTTPS, except for loopback HTTP test endpoints
Accepted responseHTTP 202 Accepted

The default endpoint is https://telemetry.helix-db.com/v1/events. The endpoint may be changed for a process, but it must pass the transport's URL and security checks.

References: crates/…/telemetry.rs• L16-26 crates/…/telemetry.rs• L190-250 crates/…/telemetry.rs• L514-532 crates/…/README.md• L74-83

CLI collection

CLI collection turns user-facing operations into events and makes them durable before it attempts delivery. The main CLI operation does not wait for the telemetry endpoint.

CLI configuration

The CLI stores its collection choice and installation identity in the Helix home directory. A missing configuration starts at basic and creates a UUIDv4 installation ID. The user-facing metrics command changes this saved choice and reports its state.

The query path reads the same saved choice. Environment overrides support one-process changes for level, installation ID, user ID, and endpoint. A full identity can include a user ID, while email and display name remain settings used by the CLI flow and are not event fields.

References: crates/…/config.rs• L19-73 crates/…/config.rs• L83-107 crates/…/README.md• L57-72

CLI event flow

This flow shows how the CLI moves an operation from a non-blocking send into durable storage and then to the endpoint.

flowchart LR
    A[CLI operation] --> B[Bounded event queue]
    B --> C[Validate and encode]
    C --> D[Atomic spool envelope]
    D --> E[Background delivery]
    E --> F[Telemetry endpoint]

The sender adds an event ID and time when it queues an event. A worker flushes queued events on a short interval or during shutdown. Invalid events are skipped so valid events in the same flush can still be saved.

The queue is bounded and non-blocking. A disabled sender, a stopped worker, or a full queue drops the event instead of delaying the CLI operation.

References: crates/…/mod.rs• L244-272 crates/…/mod.rs• L454-579

CLI spool

The CLI spool is a local queue of complete JSON envelopes under the Helix home directory. The system writes and syncs a temporary file before it makes the file visible as pending work, which protects the delivery task from partial envelopes after a process stop.

Pending files survive later CLI runs. Startup removes obsolete files, applies the current privacy level, and prunes files older than 30 days or beyond the 16 MiB spool cap. A privacy downgrade removes the user ID from pending envelopes. Turning collection off removes them.

References: crates/…/spool.rs• L11-35 crates/…/spool.rs• L73-163 crates/…/mod.rs• L462-475

Query telemetry

Query telemetry observes server and embedded query work without entering the query result path. The recorder accepts an observation without waiting for network delivery, and a separate runtime sends events in the background.

Query observations

The query event records the query shape, read or write type, latency, outcome, warnings or errors, and selected planner data. Server requests may add a bounded tenant ID and the first product token from User-Agent; embedded requests do not have those transport fields.

The canonical query keeps structure while replacing property values with their stable value kinds. It therefore supports query-shape analysis without sending request values, parameters, embeddings, email addresses, or returned rows. If an event is too large, planner diagnostics are removed first and the query shape is replaced with an omission marker so the query still counts when possible.

References: crates/…/query.rs• L57-100 crates/…/query.rs• L193-245 crates/…/query.rs• L304-404 crates/…/README.md• L57-83

Query transport

The query transport accepts only server and embedded sources. It loads the shared privacy settings and endpoint, adds optional HELIX_CLUSTER_ID context, and exposes counters for accepted events and local drops.

Every recorded query contributes to a session count. A query.summary event reports the cumulative query count plus invalid-event and full-queue drops. The latest summary is sent before queued query events, is sent again after a rejected delivery, and is sent once more at runtime shutdown. This lets downstream counts include observations that individual query.execute events could not deliver.

The query path has no disk spool. Its bounded queue favors low overhead, so process loss or delivery failure can lose individual query events without changing query execution or its public response.

References: crates/…/transport.rs• L1-9 crates/…/transport.rs• L41-85 crates/…/transport.rs• L113-165 crates/…/telemetry.rs• L323-369

Delivery and failure handling

Telemetry treats the network as a secondary path. The CLI protects observations by persisting them before delivery. Query transport protects query latency by recording and sending in the background.

HTTP outcomes

An HTTP 202 means that the endpoint accepted an envelope. Any other received response is a rejected attempt. A timeout, connection error, or other request error is a no-response attempt.

PathAccepted or rejected responseNo response
CLIRemove the spool fileKeep it for a later run
QueryComplete the attempt; summaries remain pending for retryKeep a pending summary in memory; individual events are not retained

The CLI retries only files that have no response. The query transport retries a pending summary with later events or after its retry interval, but it does not create a durable retry store.

References: crates/…/telemetry.rs• L302-320 crates/…/telemetry.rs• L476-511 crates/…/spool.rs• L37-70

Runtime shutdown

Shutdown is part of collection ownership. The CLI first asks its worker to persist queued events and then waits for delivery only within a bound. The query runtime first publishes final cumulative counts and then gives the transport a bounded flush window.

If a worker cannot complete the CLI durable handoff, shutdown reports an error. If query delivery exceeds its bound, the telemetry task stops and the owning server or embedded runtime continues its own close sequence. Telemetry therefore cannot keep the main service open indefinitely.

References: crates/…/mod.rs• L410-441 crates/…/mod.rs• L524-535 crates/…/transport.rs• L151-173 crates/…/telemetry.rs• L345-377

Operational relationships

The same privacy decision controls both CLI collection and query collection. The CLI produces durable product-operation events, while server and embedded runtimes produce short-lived query observations and cumulative summaries.

For the wider observability and validation model, see Telemetry and validation. For database test and verification concerns that relate to operational behavior, see Database testkit verification.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep source names, event names, envelope limits, and response rules aligned with the receiving telemetry service.
  • If privacy settings or identity fields change, update saved configuration, environment overrides, pending-spool rewriting, and query startup together.
  • If query properties change, preserve literal redaction and the large-event fallback before changing size limits.
  • If attribution changes, check project and deployment grouping as well as the environment fields forwarded into started runtimes.
  • If shutdown ownership changes, preserve the order of final summaries, CLI persistence, transport flush, and the owning runtime close.
  • If retry behavior changes, keep durable CLI files separate from in-memory query summaries and distinguish a response from no response.

Important failure modes

TriggerConsequenceGuard
Collection level is off or DO_NOT_TRACK is activeNo sender starts and pending CLI events are removedConfiguration resolves privacy before CLI and query startup
Endpoint is invalid or uses non-loopback HTTPThe affected telemetry runtime does not startEndpoint validation requires a safe URL and HTTPS outside loopback
CLI queue is full or disconnectedThe CLI event is dropped without delaying the commandThe sender uses a bounded, non-blocking queue
Query event is invalid or too largeQuery execution continues, but the event may be dropped or reducedQuery conversion validates data and drops diagnostics before the query shape
CLI delivery gets no responseThe spool file remains for a later runThe CLI removes a file only after receiving a response
Query delivery fails or the process stopsIndividual query events can be lost; query results are unchangedQuery summaries retain cumulative counts in memory until accepted or shutdown
Telemetry shutdown exceeds its boundThe telemetry task stops before all network work completesCLI and query runtimes use explicit shutdown limits

Key files

FileWhy to read it
crates/…/telemetry.rsDefines the event envelope, limits, endpoint rules, and shared HTTP transport
crates/…/config.rsDefines saved privacy settings, installation identity, and environment overrides
crates/…/mod.rsShows CLI event creation, queueing, persistence order, and shutdown behavior
crates/…/spool.rsShows durable envelope storage, privacy changes, pruning, and CLI delivery outcomes
crates/…/attribution.rsDefines pseudonymous project, deployment, session, and environment attribution
crates/…/query.rsDefines query observations and the rules that keep query values out of telemetry
crates/…/transport.rsConnects query observations to settings, counters, summaries, and background delivery
crates/…/README.mdStates the operational privacy model, attribution meaning, count rules, and CLI durability contract