Skip to content

feat(telemetry): add surface to the zitadel CLI's usage analytics events - #2292

Merged
fforootd merged 4 commits into
mainfrom
claude/analytics-event-catalog
Oct 24, 2026
Merged

fforootd merged 4 commits into
mainfrom
claude/analytics-event-catalog

Conversation

@fforootd

@fforootd fforootd commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds docs/product-analytics-events.yaml, a catalog of product analytics events that splits every event into a header, which every component sends the same way, and a body, which each component owns. The header is what lets events from different components be compared, such as cloud against self-hosted.

  • Header: surface, the component's version as <surface>_version, and server_kind. The version is the release version of a build that came from a release (the CLI, a self-hosted or local server and the Console it embeds), and the git commit of one we deploy ourselves (the cloud's server and Console, the website, the docs). Website and docs belong to no Zitadel deployment, so they send no server_kind.
  • Body: the component's context, which all its events carry, and each event's own properties.
  • Components: the CLI's three lifecycle events, its per-command dimensions (moved here from apps/cli/AGENTS.md), its install profile and the journey events planned in Track developer journeys in the CLI #2200; the Console's events planned in Track developer journeys in the Console #2233; Vercel page views for website and docs; nothing yet for the server.

The CLI now sends surface: "cli" on every event. It already sent cli_version and server_kind, so its events now carry the whole header.

A new CLI test, catalog.test.ts, checks:

  • that the catalog is well-formed: every component is a surface value, every property is defined, and no event repeats a header or context property in its body;
  • that the CLI sends the header, with cli as its surface, and exactly the properties the catalog lists on each lifecycle event and on the install profile, read from commandEventProperties and BaseCommand;
  • each command's dimensions, in both directions, parsed with the TypeScript compiler so shorthand keys count.

It replaces the AGENTS.md checks in setup-dimensions, variables-dimensions and api-dimensions, which covered three commands and missed shorthand keys. docs/product-analytics.md now describes the header and the body, and it and apps/cli/AGENTS.md point at the catalog.

Validation

  • vitest run in apps/cli: 4210 tests in 222 files pass.
  • The new test fails when the CLI stops sending surface, when an event repeats a header property (tried on console.viewed_page), and when a recorded dimension is missing from the catalog (tried by removing branding:eject's design).
  • biome check on the changed CLI files and tsc --noEmit for tsconfig.app.json and tsconfig.spec.json: clean.
  • node scripts/check.mjs --only release: passed.
  • node scripts/check-pr-title.mjs --title "…": ok.

Release notes / changeset

.changeset/cli-analytics-surface.md (@zitadel/cli, minor): the CLI's usage analytics events now carry surface: cli. The telemetry page lists the new property. apps/cli/package.json also gains yaml as a dev dependency, for the new test.

Notes

Conflicts the catalog surfaces, for product to settle:

Also:

  • branding eject records force again, although every event already carries it; the test accepts header and context properties as dimensions.
  • When the draft feat(telemetry): send CLI usage events and a service ping to Vercel Web Analytics #2253 lands, its service ping takes the header (surface: server, server_version and server_kind in place of version and platform), the CLI's Vercel copy adds surface, and both get added here. The ping also needs to report server_kind: local when zitadel start runs the server, or local servers will count as self-hosted installs once the ping is on by default. In the cloud, its server_version has to come from build.Commit(): apps/cloud/build.sh stamps build.Version() as the package version plus +cloud, which many deploys share.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 23, 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:02am UTC

Request Review

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: 19281f7

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/testing Minor
@zitadel/server 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 fforootd changed the title test: check CLI telemetry against a product analytics event catalog feat(telemetry): add surface to the zitadel CLI's usage analytics events Oct 23, 2026
@fforootd
fforootd added this pull request to stack #2295 October 24, 2026 00:02
@fforootd
fforootd marked this pull request as ready for review October 24, 2026 03:35
Copilot AI balanced review requested due to automatic review settings October 24, 2026 03:35
@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-24T03:37:04.765928Z 0e13630 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.

🟢 Approval recommended

The only runtime change is a single, fully test-covered surface: "cli" property; the rest is catalog documentation, consolidated tests, and build wiring that I verified for consistency.

No open issues 🎉

1 file not reviewed
  • pnpm-lock.yaml: Generated file
What changed in this PR

This PR introduces docs/product-analytics-events.yaml, a single source-of-truth catalog for product analytics events across all Zitadel components (CLI, Console, website, docs, server). It formalizes the split between a shared header (surface, <surface>_version, server_kind) that lets events compare across components, and a per-component body (context + event properties). On the runtime side, the only behavioral change is the CLI now stamping surface: "cli" on every lifecycle event, completing its header. The former per-command dimension lists in apps/cli/AGENTS.md are moved into the catalog, and a new catalog.test.ts enforces catalog/code agreement bidirectionally (replacing three narrower AGENTS.md-based tests).

Changes:

  • Add the analytics catalog and point product-analytics.md, telemetry.mdx, and apps/cli/AGENTS.md to it as the authority.
  • CLI telemetry sends surface: "cli"; add catalog.test.ts that validates the header, per-command dimensions, and install profile against the catalog, and remove the superseded AGENTS.md dimension checks.
  • Wire the catalog as a test input (moon.yml, turbo.json), add yaml dev dependency, and add a @zitadel/cli minor changeset.
File Description
docs/​product-analytics-events.yaml New catalog: header, property definitions, per-component context/events/dimensions/profile.
docs/​product-analytics.md Points to the catalog and describes the header/body split.
apps/​docs/​content/​docs/​reference/​cli/​telemetry.mdx Adds the surface property row to the CLI telemetry table.
apps/​cli/​src/​lib/​oclif/​command-telemetry.ts Adds surface: "cli" to commandEventProperties; updates the docstring.
apps/​cli/​tests/​unit/​lib/​telemetry/​catalog.test.ts New test validating catalog well-formedness and CLI telemetry against it.
apps/​cli/​tests/​unit/​lib/​telemetry/​{setup,variables,api}-dimensions.test.ts Remove AGENTS.md "documented dimension" checks now covered by the catalog test.
apps/​cli/​AGENTS.md Replaces the dimension lists with a pointer to the catalog and the catalog test.
apps/​cli/​moon.yml, apps/​cli/​turbo.json Add the catalog as a test input so the test re-runs on catalog changes.
apps/​cli/​package.json, pnpm-lock.yaml Add yaml (catalog:) dev dependency; alphabetize deps.
.changeset/​cli-analytics-surface.md @zitadel/cli minor: events now carry surface: cli.

I verified the catalog/code consistency the new test relies on: the surface/server_kind enums match serverKind.value, the base + stamped + lifecycle-extra property sets line up with commandEventProperties, the relative catalog path (6×../) resolves correctly, the removed tests leave no unused imports, and the 11 commands recording dimensions match the catalog's dimensions keys exactly. No concrete issues were found.

Review effort: Balanced

fforootd and others added 4 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>
@fforootd
fforootd force-pushed the claude/analytics-event-catalog branch from 0e13630 to 19281f7 Compare October 24, 2026 04:00
@fforootd
fforootd added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 6392fe2 Oct 24, 2026
16 checks passed
@fforootd
fforootd deleted the claude/analytics-event-catalog branch October 24, 2026 04:23
@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 — 19281f78 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