feat: add telemetry for CLI and remote setup#993
Open
EhabY wants to merge 6 commits into
Open
Conversation
faddf2d to
08be5c9
Compare
3bd8d11 to
69d562d
Compare
- Make fetchBinary/configure thin telemetry wrappers over private impls; thread trace as the trailing arg and group value params into an options object - Inline getDownloadAction and fold cli.ts phase helpers (downloadDecision, tracedPhase) for a smaller instrumentation surface - Categorize configure failures via a typed CredentialFileError instead of error-shape heuristics - Extract remote.setup compatibility check into checkCompatibility - Share a setupCliManager() harness across the cliManager unit and telemetry tests; per-test setup with local mocks, no beforeEach
Rename CliTelemetry span wrappers to the trace<Noun> form used across src/instrumentation (traceResolve, traceDownload, traceConfigure) and CliConfigureTrace outcome methods to the shared cancel/fail verb pair.
69d562d to
092212b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds structured, bounded telemetry traces for the CLI and remote-setup flows:
cli.resolveparent trace with bounded child phases —cache_lookup,version_check,download_decision,lock_wait/lock_wait_recheck, andfallback_to_existing_binary— surfaced on the parent as a singleoutcome,cache_source,version_check,download_reason, and a typedfailure_category.cli.downloadwithreasonand adownloaded_bytesmeasurement, plus acli.download.verifychild phase for signature verification.cli.configurewithsilent,credential_source, a typedfailure_category, result, and duration.remote.setupchild phases for CLI resolve/configure, compatibility check, workspace lookup/monitor/ready, agent resolve, SSH config/monitor, and connection handoff, with a typedoutcomefor non-throwing early exits.attempts,max_backoff_ms, andtotal_duration_msmeasurements.Attribute names follow the #996 conventions: snake_case keys and subject-first phase names.
Implementation notes
trace/spancallback arg. Public methods (fetchBinary,configure) are thin telemetry wrappers over private implementations, keeping instrumentation out of the business logic.cli.configurefailures are categorized from a typedCredentialFileErrorthrown by the storage layer rather than from error-shape heuristics.optionsobject, with the cross-cuttingtrace/spanas the trailing argument.cliManagerunit and telemetry tests share asetupCliManager()harness — per-test setup returning local mocks plus scenario builders — so the two files no longer duplicate setup.Verification
pnpm typecheckpnpm lintpnpm test(1928 passed, 1 skipped)pnpm format:checkCloses #985