Skip to content

feat(cli): add consent-gated runtime telemetry for NAT CLI commands#1897

Draft
yczhang-nv wants to merge 7 commits intoNVIDIA:developfrom
yczhang-nv:feat/cli-telemetry
Draft

feat(cli): add consent-gated runtime telemetry for NAT CLI commands#1897
yczhang-nv wants to merge 7 commits intoNVIDIA:developfrom
yczhang-nv:feat/cli-telemetry

Conversation

@yczhang-nv
Copy link
Copy Markdown
Contributor

@yczhang-nv yczhang-nv commented Apr 27, 2026

Description

Summary

Adds aggregate, anonymous CLI-usage telemetry to the nat Python CLI. Modeled on DataDesigner's telemetry.py and piggybacks on the existing NeMo Usage Telemetry project (clientId=184482118588404, schema 1.4 — companion MR in aire/microservices/nemo-telemetry).

Posture is consent-gated, not default-on. A first-run prompt asks the user whether to allow telemetry; the decision is persisted. Non-interactive (CI / cron / piped) sessions never prompt and default OFF. NAT_TELEMETRY_ENABLED env var overrides both.

Note: The default ingest endpoint is intentionally blank in this PR — no telemetry will be sent over the network until an endpoint URL is configured (planned for a small follow-up PR after the schema MR lands and the GX Telemetry endpoint is confirmed). Until then, the code path is exercised but no traffic leaves the machine. Local debugging via NAT_TELEMETRY_ENDPOINT=stdout writes payloads to stderr.

Consent flow

Order of precedence for whether telemetry is active:

  1. NAT_TELEMETRY_ENABLED env var (any value — 1/true/yes enables, anything else disables). Sets the answer for this shell session and bypasses the prompt.
  2. Persisted decision at ~/.config/nat/telemetry.toml (TOML, written once when the user answers the first-run prompt; can be re-set anytime via nat configure telemetry --enable | --disable).
  3. Interactive prompt (TTY-only) on first run when neither of the above is set. Default answer is no (enter, EOF, or Ctrl-C all yield "disabled"). The prompt explicitly lists what is collected and what is not.
  4. Default OFF in non-interactive sessions (no TTY → no opportunity to ask → no data sent).

The persisted decision is at ~/.config/nat/telemetry.toml:

[telemetry]
consent = "enabled"
consented_at = "2026-04-30T21:21:04Z"
prompt_version = "1.0"

CLI subcommand: nat configure telemetry
Three modes:

  • nat configure telemetry --enable — persist consent as enabled
  • nat configure telemetry --disable — persist consent as disabled
  • nat configure telemetry --status (default) — show current effective state and its source

The status command also flags when an env var is overriding the persisted decision, so users aren't surprised when their persisted choice doesn't take effect.

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
@yczhang-nv yczhang-nv self-assigned this Apr 27, 2026
@yczhang-nv yczhang-nv added feature request New feature or request non-breaking Non-breaking change DO NOT MERGE PR should not be merged; see PR for details labels Apr 27, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9a75be43-bd37-4938-9feb-5efdb873d8dd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
@yczhang-nv yczhang-nv changed the title feat(cli): add opt-out runtime telemetry for NAT CLI commands feat(cli): add consent-gated runtime telemetry for NAT CLI commands Apr 30, 2026
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE PR should not be merged; see PR for details feature request New feature or request non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant