Files
OpenShell/crates/openshell-cli/Cargo.toml
T
Russell Bryant 3aba30c36f feat(telemetry): add build-time option to compile out telemetry (#1845)
* feat(telemetry): add build-time option to compile out telemetry

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>

* ci(telemetry): guard that telemetry can be compiled out

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>

---------

Signed-off-by: Russell Bryant <russell.bryant@gmail.com>
2026-06-09 14:19:26 -07:00

99 lines
2.6 KiB
TOML

# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
[package]
name = "openshell-cli"
description = "OpenShell CLI tool"
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
[[bin]]
name = "openshell"
path = "src/main.rs"
[dependencies]
openshell-bootstrap = { path = "../openshell-bootstrap" }
openshell-core = { path = "../openshell-core", default-features = false }
openshell-policy = { path = "../openshell-policy" }
openshell-providers = { path = "../openshell-providers" }
openshell-prover = { path = "../openshell-prover" }
openshell-tui = { path = "../openshell-tui" }
serde = { workspace = true }
serde_json = { workspace = true }
serde_yml = { workspace = true }
prost-types = { workspace = true }
# Async runtime
tokio = { workspace = true }
# gRPC client
tonic = { workspace = true, features = ["tls", "tls-native-roots"] }
# CLI
chrono = "0.4"
clap = { workspace = true }
clap_complete = { workspace = true }
crossterm = { workspace = true }
dialoguer = "0.11"
indicatif = { workspace = true }
owo-colors = { workspace = true }
# HTTP client (health fallback)
bytes = { workspace = true }
http-body-util = { workspace = true }
hyper = { workspace = true }
hyper-util = { workspace = true }
hyper-rustls = { version = "0.27", default-features = false, features = ["native-tokio", "http1", "http2", "tls12", "logging", "ring", "webpki-tokio"] }
rustls = { workspace = true }
rustls-pemfile = { workspace = true }
tokio-rustls = { workspace = true }
tower = { workspace = true }
reqwest = { workspace = true }
# Error handling
miette = { workspace = true }
thiserror = { workspace = true }
anyhow = { workspace = true }
# File archiving (tar-over-SSH sync)
tar = "0.4"
tempfile = "3"
# OIDC/Auth
oauth2 = "5"
base64 = { workspace = true }
# WebSocket (Cloudflare tunnel proxy)
tokio-tungstenite = { workspace = true }
# Streams
futures = { workspace = true }
tokio-stream = { workspace = true }
nix = { workspace = true }
# URL parsing
url = { workspace = true }
# Logging
tracing = { workspace = true }
tracing-subscriber = { workspace = true }
[lints]
workspace = true
[features]
bundled-z3 = ["openshell-prover/bundled-z3"]
dev-settings = ["openshell-core/dev-settings"]
[dev-dependencies]
futures = { workspace = true }
rcgen = { version = "0.13", features = ["crypto", "pem"] }
reqwest = { workspace = true }
serde_json = { workspace = true }
temp-env = "0.3"
tokio-stream = { workspace = true }
url = { workspace = true }