Repository navigation
feat(telemetry): add surface to the zitadel CLI's usage analytics events - #2292
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 19281f7 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 |
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.
🟢 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, andapps/cli/AGENTS.mdto it as the authority. - CLI telemetry sends
surface: "cli"; addcatalog.test.tsthat 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), addyamldev dependency, and add a@zitadel/climinor 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
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>
0e13630 to
19281f7
Compare
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.surface, the component's version as<surface>_version, andserver_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 noserver_kind.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 sentcli_versionandserver_kind, so its events now carry the whole header.A new CLI test,
catalog.test.ts, checks:surfacevalue, every property is defined, and no event repeats a header or context property in its body;clias its surface, and exactly the properties the catalog lists on each lifecycle event and on the install profile, read fromcommandEventPropertiesandBaseCommand;It replaces the AGENTS.md checks in
setup-dimensions,variables-dimensionsandapi-dimensions, which covered three commands and missed shorthand keys.docs/product-analytics.mdnow describes the header and the body, and it andapps/cli/AGENTS.mdpoint at the catalog.Validation
vitest runinapps/cli: 4210 tests in 222 files pass.surface, when an event repeats a header property (tried onconsole.viewed_page), and when a recorded dimension is missing from the catalog (tried by removingbranding:eject'sdesign).biome checkon the changed CLI files andtsc --noEmitfortsconfig.app.jsonandtsconfig.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 carrysurface: cli. The telemetry page lists the new property.apps/cli/package.jsonalso gainsyamlas a dev dependency, for the new test.Notes
Conflicts the catalog surfaces, for product to settle:
step:setuprecords the furthest stage it reached (framework_resolvedtodependencies_installed), while Track developer journeys in the CLI #2200 plans onboarding flow steps (initial_checkstoapplication_setup) under the same name.error_code;docs/product-analytics.mdsaysreason. The catalog usesreasonfor the planned events.Also:
branding ejectrecordsforceagain, although every event already carries it; the test accepts header and context properties as dimensions.surface: server,server_versionandserver_kindin place ofversionandplatform), the CLI's Vercel copy addssurface, and both get added here. The ping also needs to reportserver_kind: localwhenzitadel startruns the server, or local servers will count as self-hosted installs once the ping is on by default. In the cloud, itsserver_versionhas to come frombuild.Commit():apps/cloud/build.shstampsbuild.Version()as the package version plus+cloud, which many deploys share.🤖 Generated with Claude Code