Skip to content

feat(telemetryx): add Argvio usage analytics with error reasons, features and counters - #61

Merged
emmanuelgautier merged 1 commit into
mainfrom
feat/telemetryx-argvio
Nov 1, 2026
Merged

emmanuelgautier merged 1 commit into
mainfrom
feat/telemetryx-argvio

Conversation

@emmanuelgautier

@emmanuelgautier emmanuelgautier commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds telemetryx.Instrument(root, version, apiKey, opts...), which wires argvio-go's cobrasdk into a CLI's whole Cobra tree (command, flag names, exit code, latency, help usage, sessions). It sits alongside telemetryx.New, so the existing OTel metrics and traces are unchanged.
  • apiKey is each CLI's own public_ingest Argvio key, so every CLI lands in its own Argvio tenant. The telemetry.cerberauth.com collector forwards it as is.
  • Adds telemetryx.Exit / telemetryx.Fatal to use instead of os.Exit / log.Fatal inside commands. Those skip the hooks that record a command's outcome and the deferred flush, so such runs were never reported.
  • Error categories and reasons. Fatal and errors returned from RunE are classified by a default classifier (timeout, canceled, network, missing or unreadable file and Cobra usage errors are user; the rest unknown). telemetryx.Reason(err, "no-token") and telemetryx.Classified(err, category, reason) attach a fixed-vocabulary reason where a CLI knows the cause, and WithClassifier replaces the default.
  • Product signals. telemetryx.Counter(ctx, name, n, label) adds to an Argvio counter and telemetryx.Feature(ctx, name) records a capability as used. telemetryx.Vocab(value, allowed...) limits a value read from the CLI's input to a list written in code.
  • Counters are accepted at the anonymous tier, so they are also sent from CI. Their names and labels must be fixed identifiers, never user input; the doc comment says so.
  • Interactive runs report at the Basic tier and CI runs at Anonymous. --sqa-opt-out, DO_NOT_TRACK and ARGVIO_DISABLED disable everything. New now honors DO_NOT_TRACK too.
  • Requires argvio-go v0.3.0 or later (this branch uses v0.4.0).

Test plan

  • go build ./..., go vet ./..., go test ./..., golangci-lint run --new-from-rev=origin/main (0 issues)
  • A test points the client at a local collector and checks a counter and a feature reach it, and that an invalid counter name is dropped. It fails when telemetry is disabled.
  • Used by the 8 Go CLIs on their feat/argvio branches.

The CLI PRs depend on this one. Please merge it first.

🤖 Generated with Claude Code

@codecov-commenter

codecov-commenter commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.88889% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.21%. Comparing base (ae6bcf1) to head (b46113e).

Files with missing lines Patch % Lines
telemetryx/classify.go 97.05% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
+ Coverage   87.42%   89.21%   +1.79%     
==========================================
  Files           8       11       +3     
  Lines         485      575      +90     
==========================================
+ Hits          424      513      +89     
- Misses         61       62       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@emmanuelgautier
emmanuelgautier force-pushed the feat/telemetryx-argvio branch 2 times, most recently from 330f863 to 0f3a0ed Compare October 19, 2026 22:32
@emmanuelgautier emmanuelgautier changed the title feat(telemetryx): add Argvio CLI usage analytics with per-CLI keys feat(telemetryx): add Argvio usage analytics with error reasons, features and counters Oct 19, 2026
@emmanuelgautier
emmanuelgautier force-pushed the feat/telemetryx-argvio branch 2 times, most recently from c2c4efa to 94dae8e Compare October 28, 2026 23:59
@emmanuelgautier
emmanuelgautier merged commit 4c77180 into main Nov 1, 2026
4 checks passed
@emmanuelgautier
emmanuelgautier deleted the feat/telemetryx-argvio branch November 1, 2026 10:01
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