Repository navigation
feat(telemetry): send CLI usage events and a service ping to Vercel Web Analytics - #2253
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: f597249 The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9ae9864 to
c11b9d6
Compare
Add docs/product-analytics-events.yaml: every product analytics event per component (CLI, Console, website, docs, server), emitted today or planned by its tracking ticket (#2200, #2233), with each property defined once. catalog.test.ts checks the catalog is well-formed and that the CLI sends exactly what it lists: lifecycle events and their properties, every command's dimensions (parsed with the TypeScript compiler, so shorthand keys count) and the install profile. It replaces the AGENTS.md-based checks in the setup, variables and api dimension tests, and the dimension list moves from apps/cli/AGENTS.md into the catalog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every event now starts with a header that every component sends the same way: surface, the component's version as <surface>_version, and server_kind. The rest is the body, which the component owns: its context and the event's own properties. The CLI sends surface: "cli", so its events carry the whole header. The catalog test checks the header and that no event repeats a header or context property. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A build that came from a release reports its release version; one we deployed ourselves reports the git commit, the cloud's server and Console included, not only the website and the docs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The catalog test reads docs/product-analytics-events.yaml, outside the CLI's folder, so cli:test lists it as an input in moon and turbo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eb Analytics Prove that the CLI, a self-hosted server and the cloud can all report into Vercel Web Analytics on the cloud project. - CLI: the telemetry client sends a copy of each lifecycle event to the Web Analytics intake, behind the same opt-outs, with at most the 8 properties in VERCEL_EVENT_KEYS. Mixpanel is unchanged. - Server: internal/serviceping reports version, dialect and platform at start and then daily. Off by default (service_ping.enabled). - Event names carry a poc_ prefix so proof traffic stays apart from released names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CLI's Vercel copy now follows the channel Mixpanel uses: a run on the development channel (ZITADEL_TELEMETRY_ENV=development, CI included) sends no copy, since the cloud's intake has no dev counterpart. ZITADEL_TELEMETRY_VERCEL_ENDPOINT still names an intake for any run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…copy CI runs send no Vercel copy, so is_ci was almost always false there. non_interactive takes its slot among the copy's 8 properties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… copy The ping sends surface, server_version (the git commit in the cloud) and server_kind (local on a loopback public base), then dialect, os and arch under the names Node.js uses. The CLI's Vercel copy keeps the header first and drops os. Both are in the catalog: the CLI's catalog test checks the copy, a Go test checks the ping, and the catalog is among the server's test inputs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
c11b9d6 to
b48b7ca
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces new telemetry egress to a hardcoded third-party intake — on by default for released CLIs on the production channel — and is explicitly a proof-of-concept the author says must change host/prefix before release, so a human should weigh the privacy/release implications.
No open issues 🎉
What changed in this PR
This PR extends Zitadel's product-analytics catalog (from stacked #2292) with the Vercel Web Analytics plumbing for two sources: the zitadel CLI sends a copy of each lifecycle event to a Vercel intake, and a new internal/serviceping package sends an opt-in "service ping" from the Go server at start and daily. Both carry #2292's shared event header (surface, <surface>_version, server_kind). It is explicitly framed as a proof of concept: event names carry a poc_ prefix and both senders POST straight to https://preview.zitadel.com/_vercel/insights/event.
Changes:
- Adds
internal/serviceping(anonymous version/dialect/os/arch ping, off by default viaservice_ping.enabled/NEXTGEN_SERVICE_PING_ENABLED) and wires it intocmd/server. - Adds the CLI Vercel copy (
apps/cli/src/lib/telemetry/vercel.ts) behind the existing telemetry opt-outs, with no copy on the development/CI channel. - Extends
docs/product-analytics-events.yaml(sharedos/arch/dialect, CLIvercelkeys, newservercomponent), with matching Go + TS catalog tests, build inputs, docs, and changesets.
| File | Description |
|---|---|
| internal/serviceping/serviceping.go | New ping package: facts→properties, loopback/cloud server_kind, Node-named os/arch, background loop with bounded Close. |
| internal/serviceping/serviceping_test.go | Unit tests for send, kinds, platform naming, property limit, disabled pinger. |
| internal/serviceping/catalog_test.go | Checks the ping payload against the product-analytics catalog. |
| docs/product-analytics-events.yaml | Adds os/arch/dialect + CLI vercel keys and a server component/service_ping event. |
| cmd/server/server.go | Builds/starts the pinger; adds databaseDialectName mirroring buildDatabaseDialect; sets defaults. |
| cmd/server/config.go | Adds ServicePing config section. |
| apps/server/turbo.json, apps/server/moon.yml | Add the catalog YAML to server task inputs (Go test reads it). |
| apps/cli/src/lib/telemetry/vercel.ts | New Vercel copy: endpoint resolution + event body (prefix, 8-property cap). |
| apps/cli/src/lib/telemetry/index.ts | Wires the fire-and-forget Vercel copy into track, gated by consent. |
| apps/cli/src/lib/telemetry/config.ts | Exports resolveChannel. |
| apps/cli/src/lib/oclif/command-telemetry.ts, base.ts | Adds VERCEL_EVENT_KEYS and passes them when creating telemetry. |
| apps/cli/tests/... (vercel/catalog/command-telemetry) | Tests for the copy, catalog conformance, and key ordering. |
| apps/cli/AGENTS.md, apps/docs/.../telemetry.mdx, CONTRIBUTING.md | Document the Vercel copy and IP-based location. |
| .changeset/cli-vercel-usage-copy.md, .changeset/server-service-ping.md | Customer-facing minor changesets for CLI and server. |
I reviewed the changes in depth and found no objective code defects to flag: the Go ping's concurrency/lifecycle, the egress:allow directive placement, the server_kind parity with the CLI's server-kind.ts, the dialect-name mapping (sqlite/postgres/spanner/unknown) against the catalog enum, the env-var binding, the build-input parity, and the CLI opt-out gating all check out, and the new behavior is well covered by tests.
Review effort: Balanced
…d-self-hosted-ec32c3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> # Conflicts: # apps/cli/tests/unit/lib/telemetry/catalog.test.ts # cmd/server/server.go # docs/product-analytics-events.yaml
Stacked on #2292, which defines the product analytics catalog and the header every event carries: review that one first. This PR adds only the Vercel parts on top.
Summary
A proof that all three sources can report into Vercel Web Analytics on the cloud project: the CLI, a self-hosted server (service ping) and the cloud itself. Both events it adds send #2292's header.
started,completed,failed) to the Web Analytics intake, behind the same opt-outs. The copy keeps at most 8 properties, listed inVERCEL_EVENT_KEYS: the header first (surface,cli_version,server_kind), thencommand,status,reason,host_agentandnon_interactive. Development runs send no copy: those are the runs whose Mixpanel events go to the dev project (ZITADEL_TELEMETRY_ENV=development, CI included), unlessZITADEL_TELEMETRY_VERCEL_ENDPOINTnames an intake. The CLI's Mixpanel telemetry is unchanged.internal/servicepingpackage sends a ping when the server starts and then daily. It is off by default (service_ping.enabled,NEXTGEN_SERVICE_PING_ENABLED). The ping sends:surface: server;server_version, the release version, or in the cloud the git commit; andserver_kind:cloudon Vercel,localwhenserver.public_baseis on a loopback host (as underzitadel start), otherwiseself_hosted;dialect,osandarch, withosandarchnamed as Node.js names them, so they match the CLI's.vercelas a destination, with the copy's keys and prefix, and the server gets its context and theservice_pingevent.catalog.test.tschecks the CLI's copy against the catalog, and a new Go test checks the ping against it. The server's test inputs now include the catalog, in moon and turbo.Event names carry a
poc_prefix so proof traffic never mixes with released names.Validation
go test ./internal/serviceping/ ./cmd/server/,go vet,gofmt -land the repo's analyzers on both packages: clean.vitest runinapps/cli: 4223 tests in 223 files pass.biome checkon the changed CLI files andtsc --noEmitfor both CLI projects: clean.node scripts/check-moon-graph.mjs: ok.node scripts/check.mjs --only release: passed.node scripts/check-pr-title.mjs --title "…": ok.Live ingestion on the cloud project, read back with the Web Analytics API (
events/aggregate, filtered topoc_names):0.0.0-poc,nextgen migrate, thennextgen serveron SQLite withNEXTGEN_SERVICE_PING_ENABLED=true; it loggedservice ping sentpoc_service_ping: version, dialect, platform, os, archTelemetry.create,commandEventProperties,shutdown) driven once withtsxandZITADEL_TELEMETRY_ENV=development, before development runs stopped sending a copy; the intake answered200twice. The same run now logsvercel: no copy on the development channelpoc_cli_command_startedandpoc_cli_command_completed, all 7 propertieswindow.va("event", …)on the cloud Console's sign-in page;POST /_vercel/insights/eventanswered200poc_cloud_console_eventVercel parsed the operating system from the CLI's and the server's own User-Agent strings. These events predate the header: the ping then sent
versionandplatform, and the CLI's copy sentoswhere it now sendssurface.Release notes / changeset
.changeset/cli-vercel-usage-copy.md(@zitadel/cli, minor): the CLI also sends a copy of its anonymous usage events to Vercel Web Analytics, and the existing opt-outs turn it off too..changeset/server-service-ping.md(@zitadel/server, minor): an opt-in service ping that reports the server's version, whether it runs self-hosted or locally, its database dialect, operating system and CPU architecture, never its address. It is off by default.Notes
main, which then needs merging in. A PR in a stack goes into the merge queue through themerge-asyncAPI, notgh pr merge.https://preview.zitadel.com/_vercel/insights/event), with the body@vercel/analytics/serversends. Before a release, both should send to an address we own, so the format and the host aren't baked into released CLIs and self-hosted binaries. Thepoc_prefix also has to go.ip: 0.+cloud, which many deploys share, so the ping reports the commit there instead.zitadelcommand run.@vercel/analyticscanary addsidentify/groupand server-sideuserId/groupId(feat: add identify/group vercel/analytics#210, feat: attribution implementation vercel/analytics#211). With that, the ping could send an install ID as itsgroupId.poc_events above and one earlierzz_intake_probe_externalprobe.🤖 Generated with Claude Code