Skip to content

chore(settings): track settings changes via telemetry COMPASS-10277#7884

Open
johnjackweir wants to merge 10 commits intomainfrom
cursor/settings-changes-telemetry-d808
Open

chore(settings): track settings changes via telemetry COMPASS-10277#7884
johnjackweir wants to merge 10 commits intomainfrom
cursor/settings-changes-telemetry-d808

Conversation

@johnjackweir
Copy link
Copy Markdown
Collaborator

@johnjackweir johnjackweir commented Mar 17, 2026

Description

Human here!

Manually tested, the only meh behavior is that it tracks every keystroke in the maxTimeMs field as its own settings change (cause it is). If that's really undesirable I can omit that setting from tracking

**Bot description ** 🤖
Track all UserConfigurablePreferences settings changes via the track function in the Redux store's changeFieldValue thunk. When a user toggles any setting in the settings modal, a Setting Changed telemetry event is fired with the name of the setting that was changed.

Changes

  • packages/compass-telemetry/src/telemetry-events.ts: Added a new SettingChangedEvent type with a setting payload field identifying which preference was changed.
  • packages/compass-settings/src/stores/settings.ts: Added track('Setting Changed', { setting: field }) in the changeFieldValue thunk action.
  • packages/compass-settings/src/stores/index.ts: Added track: TrackFunction to SettingsThunkExtraArgs and SettingsPluginServices, wired it into the thunk middleware.
  • packages/compass-settings/src/index.ts: Registered telemetryLocator in the plugin service locators.
  • packages/compass-settings/package.json: Added @mongodb-js/compass-telemetry as a dependency.
  • packages/compass-settings/test/configure-store.ts: Added createNoopTrack() to the test store configuration.
  • packages/compass-settings/src/stores/settings.spec.ts: Added tests verifying that changeFieldValue fires the expected Setting Changed events.

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • If this change could impact the load on the MongoDB cluster, please describe the expected and worst case impact
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

COMPASS-10277: Track when users toggle settings to provide usage insights.

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

  • The event payload only includes the setting name (setting), not the new value. This keeps the event simple and avoids transmitting potentially sensitive preference values.

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)
Open in Web Open in Cursor 

Add a 'Setting Changed' telemetry event that fires whenever a user
toggles any UserConfigurablePreferences setting. The event includes
the setting name to identify which preference was changed.

- Added SettingChangedEvent type to compass-telemetry events
- Wrapped onChange in SettingsInput to track via useTelemetry()
- Added @mongodb-js/compass-telemetry dependency to compass-settings

COMPASS-10277
Verify that toggling a setting fires a 'Setting Changed' telemetry
event with the correct setting name, and that each setting change
fires its own event.
@github-actions github-actions bot added the feat label Mar 17, 2026
Comment on lines +34 to +40
if (track) {
return (
<TelemetryContext.Provider value={track}>
{tree}
</TelemetryContext.Provider>
);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please use track function returned by render method below instead of these custom wrappers. We already have this built into our test harness

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

moving to the store meant these tests moved, but let me know if there's a better way to do the testing side of this

Move 'Setting Changed' telemetry tracking from useTelemetry() in
SettingsInput to the changeFieldValue thunk in settings.ts. This
follows the Compass pattern of wiring track as a thunk extra arg.

- Reverted settings-list.tsx to its original state (no useTelemetry)
- Added track to SettingsThunkExtraArgs and SettingsPluginServices
- Wired telemetryLocator in plugin registration (src/index.ts)
- Added track call in changeFieldValue thunk
- Moved tests to settings.spec.ts (store-level)
- Reverted privacy.spec.tsx to original

COMPASS-10277
@johnjackweir johnjackweir requested a review from gribnoysup March 25, 2026 22:32
@johnjackweir johnjackweir marked this pull request as ready for review March 25, 2026 22:33
@johnjackweir johnjackweir requested a review from a team as a code owner March 25, 2026 22:33
@johnjackweir johnjackweir changed the title feat(settings): track settings changes via telemetry COMPASS-10277 chore(settings): track settings changes via telemetry COMPASS-10277 Mar 25, 2026
@johnjackweir johnjackweir added the no release notes Fix or feature not for release notes label Mar 25, 2026
@codeowners-service-app
Copy link
Copy Markdown

Assigned lerouxb for team compass-developers because gribnoysup is out of office.

@johnjackweir johnjackweir removed the request for review from lerouxb March 27, 2026 16:07
Resolve version-bump conflicts in package.json by taking main's
updated dependency versions and preserving our new
@mongodb-js/compass-telemetry dependency. Regenerated package-lock.json.
@gribnoysup
Copy link
Copy Markdown
Collaborator

the only meh behavior is that it tracks every keystroke in the maxTimeMs field as its own settings change (cause it is). If that's really undesirable I can omit that setting from tracking

Hmm, the actual value that is used by the app is not changed until you press the save button. So just to make sure: what do we care here about for tracking, the user clicking around or them actually making changes to the settings? If it's the latter, you probably want this tracking even to be in another place, somewhere near settings "saving" logic

Copy link
Copy Markdown
Collaborator

@gribnoysup gribnoysup left a comment

Choose a reason for hiding this comment

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

Code-wise looks good, but I'd double-check if that's what we actually want to track just in case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat no release notes Fix or feature not for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants