Skip to content

feat(telemetry): add build-time option to compile out telemetry#1845

Merged
TaylorMutch merged 2 commits into
NVIDIA:mainfrom
russellb:worktree-feat+telemetry-build-feature
Jun 9, 2026
Merged

feat(telemetry): add build-time option to compile out telemetry#1845
TaylorMutch merged 2 commits into
NVIDIA:mainfrom
russellb:worktree-feat+telemetry-build-feature

Conversation

@russellb

@russellb russellb commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

OpenShell collects anonymous telemetry by default and already supports turning it off at runtime via OPENSHELL_TELEMETRY_ENABLED=false. That runtime switch is enough for most users, but privacy-sensitive operators often need a stronger guarantee than a runtime flag they have to trust, set correctly, and keep set. For them, the goal isn't "telemetry disabled," it's "telemetry not present": no endpoint baked into the binary, no HTTP client, nothing to misconfigure, re-enable, or audit at runtime.

This PR adds a default-on telemetry Cargo feature so telemetry can be compiled out entirely. Building with --no-default-features produces binaries that contain no telemetry endpoint, no telemetry HTTP client, and no emission code — provable, build-time absence rather than runtime suppression. On-by-default behavior and the runtime switch are unchanged for everyone else.

Related Issue

None — no tracking issue exists for this. Happy to file one if preferred.

Changes

  • openshell-core: new default-on telemetry feature. chrono and reqwest are now optional and gated behind it. In telemetry.rs, the data model (enums, validation, emit_*/enabled* signatures) stays always-compiled, while the endpoint, HTTP client, queue, and emission code are #[cfg(feature = "telemetry")]. With the feature off, enabled() returns false and emit_* are no-ops, so dependent crates compile unchanged.
  • Workspace threading: every crate depends on openshell-core with default-features = false; the default-on telemetry passthrough lives on the binary crates that emit/collect — openshell-server (gateway), openshell-sandbox, openshell-driver-vm. In-process drivers (docker/k8s/podman) inherit telemetry via resolver-v2 feature unification and carry no passthrough. The CLI calls no telemetry APIs and stays telemetry-free.
  • CI regression guard: tasks/scripts/verify-telemetry-compiled-out.sh + rust:verify:telemetry-off mise task inspect built binaries for telemetry markers (endpoint host + client ID). Wired into the branch-checks Rust job: the default gateway must contain the markers (positive control); --no-default-features gateway and sandbox must not.
  • Docs: README telemetry section + new "Build Features" section in architecture/build.md.

Testing

  • mise run pre-commit passes
  • Unit tests added/updated — disabled_tests (telemetry-off no-op behavior) in openshell-core; gated the telemetry-on sandbox collection test
  • E2E tests added/updated (if applicable) — n/a (no runtime behavior change in default builds)

Additional verification:

  • cargo test -p openshell-core --no-default-features: 156 pass; compiles both ways (gateway, sandbox, driver-vm)
  • clippy --workspace --all-targets and --no-default-features: clean
  • mise run rust:verify:telemetry-off: confirms endpoint URL + client ID present in default gateway, absent in --no-default-features gateway/sandbox

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (architecture/build.md)

russellb added 2 commits June 9, 2026 15:39
Gate anonymous telemetry emission behind a default-on `telemetry` Cargo
feature in openshell-core. The data model (enums, validation, emit_*/enabled*
signatures) stays always-compiled, while the endpoint, HTTP client, queue, and
emission code are feature-gated. With the feature off, enabled() returns false
and emit_* are no-ops, so dependent crates compile unchanged and no telemetry
endpoint, HTTP client, or emission code is included in the binary.

chrono and reqwest become optional dependencies of openshell-core, dropped from
its dependency graph when telemetry is disabled.

Thread the switch through the workspace: every crate depends on openshell-core
with default-features = false, and the default-on `telemetry` passthrough lives
on the binary crates that emit or collect telemetry (openshell-server,
openshell-sandbox, openshell-driver-vm). In-process drivers inherit it via
resolver v2 feature unification.

Build a telemetry-free binary with, e.g.:
  cargo build --release -p openshell-server --no-default-features

The runtime OPENSHELL_TELEMETRY_ENABLED switch is unchanged for default builds.

Signed-off-by: Russell Bryant <russell.bryant@gmail.com>
Add tasks/scripts/verify-telemetry-compiled-out.sh, which inspects a built
binary for telemetry markers (the telemetry endpoint host and client ID) that
exist only when emission code is compiled in. The rust:verify:telemetry-off
mise task builds the gateway with default features (positive control: markers
must be present, so the absent checks can never be silently vacuous) and with
--no-default-features (markers must be absent), and checks the
--no-default-features sandbox binary as well.

Wire the task into the Rust branch-checks job so a regression that reintroduces
telemetry code into a --no-default-features build fails CI.

Signed-off-by: Russell Bryant <russell.bryant@gmail.com>
@russellb russellb requested review from a team, derekwaynecarr and mrunalp as code owners June 9, 2026 20:19
@copy-pr-bot

copy-pr-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@TaylorMutch

Copy link
Copy Markdown
Collaborator

/ok to test 3869cec

@TaylorMutch TaylorMutch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TaylorMutch TaylorMutch merged commit 3aba30c into NVIDIA:main Jun 9, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants