feat(telemetry): anonymous usage telemetry — documented schema, opt-out, public ingest worker#834
Merged
Merged
Conversation
…ut, public ingest worker 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 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 anonymous usage telemetry to the engine: which commands and MCP tools get used, which languages get indexed, which agents connect — so language/agent support work goes where real usage is. Designed trust-first for a local-first tool:
TELEMETRY.md; the ingest endpoint (telemetry-worker/, public in this repo on purpose) enforces that list and drops everything else. Never code, file paths, file/symbol names, queries, or IP addresses.DO_NOT_TRACK=1honored. Off is off: nothing recorded, no socket opened, buffered data deleted.fetch), zero stdout (MCP protocol channel), zero hot-path latency (in-memory increment, counted after the tool reply is on the wire), fail-silent everywhere, bounded 256 KB local buffer, no retries. CLI commands ending inprocess.exit()are handled via a tiny synchronous exit-append; sends piggyback on long-running commands and the daemon's unref'd interval.Surface
codegraph telemetry status|on|off(+CODEGRAPH_TELEMETRY=0,DO_NOT_TRACK=1)install(targets/scope/kind),index(languages + coarse buckets),usage_rollup(per-day per-tool counts + MCPclientInfoattribution),uninstallTELEMETRY.md(user contract), README section,docs/design/telemetry.md(engineering contract), CHANGELOG entry under UnreleasedTest plan
CODEGRAPH_TELEMETRY=0guard so spawned CLI/MCP test processes never pollute real telemetry)codegraph init→ notice → POST → Worker → PostHog, verified; production endpoint live-verified (GET /info text, valid POST204, garbage400, rate limit429after 6/min)🤖 Generated with Claude Code