feat(cli-sdk): add anonymous telemetry to all CLI tools#47
Open
feat(cli-sdk): add anonymous telemetry to all CLI tools#47
Conversation
Introduces a lightweight, fire-and-forget telemetry module in cli-sdk that sends usage events to the Pulse analytics endpoint. Integrated into all 4 CLIs (walletconnect, staking, pay, companion-wallet). - Tracks command lifecycle (invoked/succeeded/failed), connections, transactions, and bridge completions - Opt-out via WALLETCONNECT_TELEMETRY=0 env var or config set telemetry false - Error messages sanitized (wallet addresses stripped, truncated to 256 chars) - Flush with 2-second timeout cap, never blocks process exit - Region-aware endpoint selection (.com vs .org) - 15 new tests for telemetry module Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
cli-sdk/src/telemetry.ts) that sends anonymous usage events to the Pulse analytics endpoint (pulse.walletconnect.com/e)walletconnect,walletconnect-staking,walletconnect-pay,companion-walletcommand_invoked/command_succeeded/command_failed), wallet connections, on-chain transactions, and bridge completionsDetails
Opt-out:
WALLETCONNECT_TELEMETRY=0env var orwalletconnect config set telemetry falsePrivacy: Error messages are sanitized — wallet addresses (
0x...) are stripped and messages truncated to 256 chars before sending.Reliability: Fire-and-forget (
fetch().catch(() => {})), flush with 2-second timeout cap viaPromise.race, never blocks process exit. No-op client returned when telemetry is disabled or no project ID is configured.Region: Endpoint auto-selects
.orgfor China/HK timezones,.comotherwise.Event taxonomy:
command_invoked{ command }command_succeeded{ command }command_failed{ command, error }connection_established{ command }transaction_sent{ command, chainId }bridge_completed{ command, fromChain, toChain }Test plan
cli-sdk/test/telemetry.spec.tscovering no-op paths, payload shape, flush behavior, error handling, and address sanitizationnpm run buildpassesnpm run testpasses (all 78 tests)npm run lintpassesWALLETCONNECT_TELEMETRY=0 walletconnect --versionproduces no network calls🤖 Generated with Claude Code