feat(telemetry): track workspace feature flags in workspace features observed#12976
Draft
jordanl17 wants to merge 1 commit into
Draft
feat(telemetry): track workspace feature flags in workspace features observed#12976jordanl17 wants to merge 1 commit into
jordanl17 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Expands the Workspace Features Observed telemetry event to emit a flat, low-cardinality snapshot of resolved workspace feature flags (instead of only advancedVersionControlEnabled), and prevents duplicate emission per workspace in React StrictMode while still re-emitting on active workspace changes.
Changes:
- Added
collectWorkspaceFeatures(workspace)helper to generate the expanded telemetry payload (with reducer-aligned defaults). - Updated
StudioTelemetryProviderto log the expanded payload and dedupe the event per workspace identity. - Extended unit tests and updated telemetry documentation to reflect the richer event payload.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/sanity/src/core/studio/telemetry/StudioTelemetryProvider.tsx | Uses collectWorkspaceFeatures and adds per-workspace dedupe for Workspace Features Observed emission. |
| packages/sanity/src/core/studio/telemetry/tests/StudioTelemetryProvider.test.tsx | Adds coverage for expanded payload fields, default/effective values, StrictMode dedupe, and workspace-switch re-emission. |
| packages/sanity/src/core/studio/telemetry/featureAvailability.telemetry.ts | Defines the expanded event payload shape and implements collectWorkspaceFeatures mapping with effective defaults. |
| docs/TELEMETRY.md | Updates the event description to document the expanded workspace feature snapshot. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Description
Expands the existing
Workspace Features Observedtelemetry event from a singleadvancedVersionControlEnabledflag to a flat snapshot of the workspace feature flags, via a newcollectWorkspaceFeatures(workspace)helper. The snapshot covers releases, tasks, scheduled drafts, scheduled publishing (both effective and explicit opt-in), media library, canvas, variants, events API (documents and releases), announcements, drafts, partial indexing, file and image direct uploads, and search strategy.The event name and
version: 1are intentionally left unchanged so existing queries stay backwards compatible - the new fields are purely additive and the originaladvancedVersionControlEnabledfield is preserved.While here, the event is now deduped per workspace: it fires once per workspace identity (re-emitting when the active workspace changes) rather than double-firing under React StrictMode.
What to review
collectWorkspaceFeaturesinfeatureAvailability.telemetry.ts- the field selection and the?? defaultfallbacks, which mirror the config reducers so an unset option reports its effective value. Every field is a low-cardinality boolean, small enum, or short number; there is deliberately no free text, identifier, customer value, project/dataset (already on the envelope), or token.The per-workspace dedupe ref in
StudioTelemetryProvider.tsxis keyed on${projectId}:${name}, so a workspace switch still re-emits while a StrictMode remount does not.scheduledPublishingis tracked as two fields:scheduledPublishingEnabled(effective, on by default) andscheduledPublishingExplicitlyEnabled(the explicit opt-in__internal__workspaceEnabled, which is the real adoption signal). The gating that consumes both lives inScheduledPublishingEnabledProvider.Testing
Unit tests in
StudioTelemetryProvider.test.tsxcover the effective defaults, explicitly configured flags, the complete payload shape, StrictMode deduplication, and re-emission on workspace switch. All 15 tests pass; type-check, eslint, and format are green.Notes for release
N/A