feat(telemetry): anonymous usage telemetry — documented schema, opt-out, public ingest worker (#834)
Adds anonymous usage statistics (commands/tools used, languages indexed, connecting agents) with a strict, auditable allowlist. Never code, paths, file/symbol names, queries, or IPs. - src/telemetry/: zero-dep client — consent resolution (DO_NOT_TRACK > CODEGRAPH_TELEMETRY > stored choice > default-on), random machine UUID, in-memory counters → capped JSONL buffer → completed-day rollups; sync exit-append (survives process.exit) + opportunistic bounded sends; the first-run notice gates the first SEND, never local buffering, so the installer's consent toggle always precedes it. Off is off: no recording, no socket, buffered data deleted. - codegraph telemetry status|on|off; per-command counting via preAction hook. - MCP: tool counting after the reply is on the wire (session + proxy in-process fallback), agent attribution from initialize clientInfo, unref'd daemon flush interval. Zero hot-path cost, zero stdout. - Installer: visible default-on consent toggle (asked once, never re-asked), install/index/uninstall lifecycle events. - telemetry-worker/: public Cloudflare Worker behind telemetry.getcodegraph.com — allowlist validation, IP stripping, per-machine rate limit, forwards to PostHog as anonymous events. Ships nowhere with the npm package. - TELEMETRY.md (field-by-field contract) + README section + design doc. - 20 unit tests; suite-wide CODEGRAPH_TELEMETRY=0 guard so tests never pollute real telemetry. Full suite: 1448 passing. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
7db4c1d2f8
commit
848fde9f59
@@ -589,6 +589,23 @@ add a negation — `!vendor/`. The defaults apply uniformly, so committing a
|
||||
dependency or build directory doesn't force it into the graph; the `.gitignore`
|
||||
negation is the explicit opt-in.
|
||||
|
||||
## Telemetry
|
||||
|
||||
CodeGraph collects **anonymous usage statistics** — which tools and commands get
|
||||
used, which languages get indexed — to guide where language and agent support
|
||||
work goes. **Never** any code, paths, file or symbol names, queries, or IP
|
||||
addresses; usage is aggregated locally into daily totals before anything is
|
||||
sent, and the ingest endpoint is [public code in this repo](telemetry-worker/)
|
||||
that enforces the documented field list. The installer asks up front; turn it
|
||||
off any time:
|
||||
|
||||
```bash
|
||||
codegraph telemetry off # or: CODEGRAPH_TELEMETRY=0, or DO_NOT_TRACK=1
|
||||
```
|
||||
|
||||
[`TELEMETRY.md`](TELEMETRY.md) lists every field, with the off-switches and the
|
||||
full data-handling story.
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
Every release ships a self-contained build (bundled Node runtime — nothing to
|
||||
|
||||
Reference in New Issue
Block a user