Skip to content

feat(telemetryx): add durations, unknown commands, config count and auth state - #66

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

emmanuelgautier merged 1 commit into
mainfrom
feat/telemetryx-argvio-sdk-features

Conversation

@emmanuelgautier

Copy link
Copy Markdown
Member

Summary

Follow-up to #61: exposes the features argvio-go v0.4.0 added, through telemetryx.

  • telemetryx.Execute(root) replaces root.Execute() in main. It records a mistyped command as an unknown-command attempt (nearest command as suggestion, never the typed text) and returns exactly the error root.Execute would, so output and exit code don't change. A mistyped subcommand of a parent with nothing to run is recorded by Instrument already.
  • telemetryx.Duration(ctx, name, d, label) and telemetryx.Timer(ctx, name, label) record vendor timings the command's own duration doesn't cover. Like counters they are accepted at the anonymous tier, so names and labels must be fixed identifiers (use Vocab for values read from input); the doc comment carries the warning.
  • WithConfigCustomizedCount and WithAuthState are Instrument options that report how customized the config is and whether the user is signed in to the vendor's own service. Both are lazy, run once at session start and only when consent allows it, so they never read config or credentials for an opted-out user or in CI. Only a count or one of three states can be sent.
  • Shell, terminal, TTY and runtime on session start need no code: argvio sends them itself at the Basic tier. A test checks they reach the collector.

Test plan

  • go build ./..., go vet ./..., go test ./... (also with -race), golangci-lint run --new-from-rev=origin/main (0 issues)
  • Tests send each feature to a local collector. They pass with and without CI, GITHUB_ACTIONS, DO_NOT_TRACK and ARGVIO_DISABLED set.
  • The session callbacks are shown not to run in CI, with --sqa-opt-out, or with DO_NOT_TRACK.

The CLI PRs use these, so please merge this one first.

🤖 Generated with Claude Code

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.56%. Comparing base (4c77180) to head (240d423).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #66      +/-   ##
==========================================
+ Coverage   89.21%   89.56%   +0.34%     
==========================================
  Files          11       11              
  Lines         575      594      +19     
==========================================
+ Hits          513      532      +19     
  Misses         62       62              

☔ 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.

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