feat(preprod): Add analytics for status check rule CRUD#109116
feat(preprod): Add analytics for status check rule CRUD#109116
Conversation
Track create, update, and delete actions for status check rules in the project settings UI to understand feature usage in Amplitude. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: http://localhost:5173/share/opxnFrSR20ag5gH3jd5zERc1cotkhr3_xH6R1-roiHo
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| trackAnalytics('preprod.settings.status_check_rule_created', { | ||
| organization, | ||
| project_slug: project.slug, | ||
| }); |
There was a problem hiding this comment.
Analytics track failed operations as successes
High Severity
Analytics events for rule create, update, and delete fire before their async operations complete. When addRule, updateRule, or deleteRule fail due to network errors or validation issues, the analytics still record successful operations, inflating metrics and misrepresenting actual adoption/usage. The tracking calls happen synchronously while the underlying saveRules mutation in useStatusCheckRules is asynchronous.
Additional Locations (2)
| project_slug: project.slug, | ||
| metric: updated.metric, | ||
| measurement: updated.measurement, | ||
| artifact_type: updated.artifactType ?? 'all_artifacts', |
There was a problem hiding this comment.
Inconsistent artifact_type default in analytics fallback
Low Severity
The fallback value for artifact_type uses 'all_artifacts', but the rule parsing logic in useStatusCheckRules.ts defaults to 'main_artifact' (via DEFAULT_ARTIFACT_TYPE). While the form should always provide an artifactType value making this fallback unused in practice, the inconsistency could cause confusion or incorrect analytics if the fallback is ever triggered.


Add Amplitude analytics events for status check rule create, update, and
delete actions in the project settings UI. This lets us track adoption and
usage patterns for the status checks feature.
Three new events are defined in
preprodBuildAnalyticsEvents.tsxand firedfrom
statusCheckRules.tsx:preprod.settings.status_check_rule_created— on rule creationpreprod.settings.status_check_rule_updated— on rule save, includes metric/measurement/artifact_type/valuepreprod.settings.status_check_rule_deleted— on rule deletion