chore(settings): track settings changes via telemetry COMPASS-10277#7884
chore(settings): track settings changes via telemetry COMPASS-10277#7884johnjackweir wants to merge 10 commits intomainfrom
Conversation
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.
| if (track) { | ||
| return ( | ||
| <TelemetryContext.Provider value={track}> | ||
| {tree} | ||
| </TelemetryContext.Provider> | ||
| ); | ||
| } |
There was a problem hiding this comment.
Please use track function returned by render method below instead of these custom wrappers. We already have this built into our test harness
There was a problem hiding this comment.
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
packages/compass-settings/src/components/settings/settings-list.tsx
Outdated
Show resolved
Hide resolved
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
…c.ts" This reverts commit 1325441.
|
Assigned |
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.
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 |
gribnoysup
left a comment
There was a problem hiding this comment.
Code-wise looks good, but I'd double-check if that's what we actually want to track just in case
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
UserConfigurablePreferencessettings changes via thetrackfunction in the Redux store'schangeFieldValuethunk. When a user toggles any setting in the settings modal, aSetting Changedtelemetry event is fired with the name of the setting that was changed.Changes
packages/compass-telemetry/src/telemetry-events.ts: Added a newSettingChangedEventtype with asettingpayload field identifying which preference was changed.packages/compass-settings/src/stores/settings.ts: Addedtrack('Setting Changed', { setting: field })in thechangeFieldValuethunk action.packages/compass-settings/src/stores/index.ts: Addedtrack: TrackFunctiontoSettingsThunkExtraArgsandSettingsPluginServices, wired it into the thunk middleware.packages/compass-settings/src/index.ts: RegisteredtelemetryLocatorin the plugin service locators.packages/compass-settings/package.json: Added@mongodb-js/compass-telemetryas a dependency.packages/compass-settings/test/configure-store.ts: AddedcreateNoopTrack()to the test store configuration.packages/compass-settings/src/stores/settings.spec.ts: Added tests verifying thatchangeFieldValuefires the expectedSetting Changedevents.Checklist
Motivation and Context
COMPASS-10277: Track when users toggle settings to provide usage insights.
Open Questions
setting), not the new value. This keeps the event simple and avoids transmitting potentially sensitive preference values.Types of changes