Skip to content

feat(cli-sdk): add anonymous telemetry to all CLI tools#47

Open
arein wants to merge 1 commit intomainfrom
feat/telemetry
Open

feat(cli-sdk): add anonymous telemetry to all CLI tools#47
arein wants to merge 1 commit intomainfrom
feat/telemetry

Conversation

@arein
Copy link
Member

@arein arein commented Mar 12, 2026

Summary

  • Adds a lightweight, fire-and-forget telemetry module (cli-sdk/src/telemetry.ts) that sends anonymous usage events to the Pulse analytics endpoint (pulse.walletconnect.com/e)
  • Integrates telemetry into all 4 CLIs: walletconnect, walletconnect-staking, walletconnect-pay, companion-wallet
  • Tracks command lifecycle (command_invoked / command_succeeded / command_failed), wallet connections, on-chain transactions, and bridge completions

Details

Opt-out: WALLETCONNECT_TELEMETRY=0 env var or walletconnect config set telemetry false

Privacy: 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 via Promise.race, never blocks process exit. No-op client returned when telemetry is disabled or no project ID is configured.

Region: Endpoint auto-selects .org for China/HK timezones, .com otherwise.

Event taxonomy:

Event When Extra Props
command_invoked Every CLI command start { command }
command_succeeded Command completes OK { command }
command_failed Command errors { command, error }
connection_established Wallet connected { command }
transaction_sent On-chain tx submitted { command, chainId }
bridge_completed Swidge/bridge done { command, fromChain, toChain }

Test plan

  • 15 new tests in cli-sdk/test/telemetry.spec.ts covering no-op paths, payload shape, flush behavior, error handling, and address sanitization
  • npm run build passes
  • npm run test passes (all 78 tests)
  • npm run lint passes
  • Manual: WALLETCONNECT_TELEMETRY=0 walletconnect --version produces no network calls
  • Manual: With project-id set, commands send events to pulse endpoint

🤖 Generated with Claude Code

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

1 participant