Skip to content

feat(telemetry): send CLI usage events and a service ping to Vercel Web Analytics - #2253

Merged
fforootd merged 9 commits into
mainfrom
claude/analytics-cloud-self-hosted-ec32c3
Oct 24, 2026
Merged

fforootd merged 9 commits into
mainfrom
claude/analytics-cloud-self-hosted-ec32c3

Conversation

@fforootd

@fforootd fforootd commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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.

  • CLI: the telemetry client sends a copy of each lifecycle event (started, completed, failed) to the Web Analytics intake, behind the same opt-outs. The copy keeps at most 8 properties, listed in VERCEL_EVENT_KEYS: the header first (surface, cli_version, server_kind), then command, status, reason, host_agent and non_interactive. Development runs send no copy: those are the runs whose Mixpanel events go to the dev project (ZITADEL_TELEMETRY_ENV=development, CI included), unless ZITADEL_TELEMETRY_VERCEL_ENDPOINT names an intake. The CLI's Mixpanel telemetry is unchanged.
  • Server: a new internal/serviceping package 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:
    • the header: surface: server; server_version, the release version, or in the cloud the git commit; and server_kind: cloud on Vercel, local when server.public_base is on a loopback host (as under zitadel start), otherwise self_hosted;
    • the server's context: dialect, os and arch, with os and arch named as Node.js names them, so they match the CLI's.
  • Cloud: needs no code. The cloud Console already loads Vercel's script, and a custom event sent through it is counted.
  • Catalog: the CLI's lifecycle events list vercel as a destination, with the copy's keys and prefix, and the server gets its context and the service_ping event. catalog.test.ts checks 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 -l and the repo's analyzers on both packages: clean.

  • vitest run in apps/cli: 4223 tests in 223 files pass. biome check on the changed CLI files and tsc --noEmit for 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 to poc_ names):

    Source How it was sent Counted in Vercel
    Service ping Server built with version 0.0.0-poc, nextgen migrate, then nextgen server on SQLite with NEXTGEN_SERVICE_PING_ENABLED=true; it logged service ping sent poc_service_ping: version, dialect, platform, os, arch
    CLI The CLI's telemetry path (Telemetry.create, commandEventProperties, shutdown) driven once with tsx and ZITADEL_TELEMETRY_ENV=development, before development runs stopped sending a copy; the intake answered 200 twice. The same run now logs vercel: no copy on the development channel poc_cli_command_started and poc_cli_command_completed, all 7 properties
    Cloud window.va("event", …) on the cloud Console's sign-in page; POST /_vercel/insights/event answered 200 poc_cloud_console_event

    Vercel 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 version and platform, and the CLI's copy sent os where it now sends surface.

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

  • Stack: when feat(telemetry): add surface to the zitadel CLI's usage analytics events #2292 merges, GitHub retargets this PR to main, which then needs merging in. A PR in a stack goes into the merge queue through the merge-async API, not gh pr merge.
  • This is the proof's shape, not the release shape. The CLI and the ping post straight to Vercel's intake path (https://preview.zitadel.com/_vercel/insights/event), with the body @vercel/analytics/server sends. 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. The poc_ prefix also has to go.
  • Location: Vercel works out a location from the sender's IP address. The CLI telemetry page now says so; the Mixpanel events still go out with ip: 0.
  • Property limit: all 7 properties of the CLI event were stored and can be queried, although the team is on Pro, which the docs limit to 2. Web Analytics Plus is the documented way to get 8.
  • Cloud server: on Vercel the ping would fire on every function cold start, so it should stay off there. The cloud build stamps its version as the package version plus +cloud, which many deploys share, so the ping reports the commit there instead.
  • Not covered: a self-hosted Console sending from a browser on another origin, and a full built zitadel command run.
  • Coming in 2.1.0: @vercel/analytics canary adds identify/group and server-side userId/groupId (feat: add identify/group vercel/analytics#210, feat: attribution implementation vercel/analytics#211). With that, the ping could send an install ID as its groupId.
  • Test events: the proof left five test events in production Web Analytics: the four poc_ events above and one earlier zz_intake_probe_external probe.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Oct 24, 2026 4:29am UTC

Request Review

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: f597249

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@zitadel/cli Minor
@zitadel/server Minor
@zitadel/testing Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-win32-x64 Minor
@zitadel/api Minor
@zitadel/config Minor
@zitadel/components Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-react Minor
@zitadel/sdk-vue Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/website Patch

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

fforootd and others added 8 commits October 23, 2026 21:00
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>
@fforootd
fforootd force-pushed the claude/analytics-cloud-self-hosted-ec32c3 branch from c11b9d6 to b48b7ca Compare October 24, 2026 04:00
@fforootd
fforootd marked this pull request as ready for review October 24, 2026 04:14
Copilot AI balanced review requested due to automatic review settings October 24, 2026 04:14
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-24T04:18:49.472984Z b48b7ca Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 via service_ping.enabled / NEXTGEN_SERVICE_PING_ENABLED) and wires it into cmd/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 (shared os/arch/dialect, CLI vercel keys, new server component), 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

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 24, 2026
Base automatically changed from claude/analytics-event-catalog to main October 24, 2026 04:23
…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
@fforootd
fforootd added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 0529137 Oct 24, 2026
16 checks passed
@fforootd
fforootd deleted the claude/analytics-cloud-self-hosted-ec32c3 branch October 24, 2026 04:39
@github-project-automation github-project-automation Bot moved this from Inbox to Done in Engineering Kanban Oct 24, 2026

This branch was successfully deployed

1 active deployment
Preview — f5972490 Deployed Oct 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants