Browse Source

ref(analytics): convert remaining performance view analytics (#47117)

Stephen Cefali 1 year ago
parent
commit
f87333a8e4

+ 14 - 0
static/app/utils/analytics/performanceAnalyticsEvents.tsx

@@ -160,6 +160,12 @@ export type PerformanceEventParameters = {
     value: string;
     widget_type: string;
   };
+  'performance_views.trends.change_function': {
+    function_name: string;
+  };
+  'performance_views.trends.change_parameter': {
+    parameter_name: string;
+  };
   'performance_views.trends.widget_interaction': {
     widget_type: string;
   };
@@ -175,6 +181,8 @@ export type PerformanceEventParameters = {
     project_platforms: string;
   };
   'performance_views.vitals.filter_changed': {value: string};
+  'performance_views.vitals.open_all_events': {vital: string};
+  'performance_views.vitals.open_in_discover': {vital: string};
   'performance_views.vitals.reset_view': {};
   'performance_views.vitals.vitals_tab_clicked': PageLayoutParams;
 };
@@ -289,4 +297,10 @@ export const performanceEventMap: Record<PerformanceEventKey, string | null> = {
   'performance_views.tags.interaction': 'Performance Views: Tag Page - Interaction',
   'performance_views.vitals.filter_changed': 'Performance Views: Change vitals filter',
   'performance_views.vitals.reset_view': 'Performance Views: Reset vitals view',
+  'performance_views.trends.change_parameter': 'Performance Views: Change Parameter',
+  'performance_views.trends.change_function': 'Performance Views: Change Function',
+  'performance_views.vitals.open_in_discover':
+    'Performance Views: Open vitals in discover',
+  'performance_views.vitals.open_all_events':
+    'Performance Views: Open vitals in all events',
 };

+ 5 - 11
static/app/views/performance/transactionSummary/transactionVitals/vitalCard.tsx

@@ -14,7 +14,7 @@ import Placeholder from 'sentry/components/placeholder';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization} from 'sentry/types';
-import {trackAnalyticsEvent} from 'sentry/utils/analytics';
+import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
 import EventView from 'sentry/utils/discover/eventView';
 import {getAggregateAlias} from 'sentry/utils/discover/fields';
 import {WebVital} from 'sentry/utils/fields';
@@ -118,11 +118,8 @@ class VitalCard extends Component<Props, State> {
   trackOpenInDiscoverClicked = () => {
     const {organization} = this.props;
     const {vitalDetails: vital} = this.props;
-
-    trackAnalyticsEvent({
-      eventKey: 'performance_views.vitals.open_in_discover',
-      eventName: 'Performance Views: Open vitals in discover',
-      organization_id: organization.id,
+    trackAdvancedAnalyticsEvent('performance_views.vitals.open_in_discover', {
+      organization,
       vital: vital.slug,
     });
   };
@@ -130,11 +127,8 @@ class VitalCard extends Component<Props, State> {
   trackOpenAllEventsClicked = () => {
     const {organization} = this.props;
     const {vitalDetails: vital} = this.props;
-
-    trackAnalyticsEvent({
-      eventKey: 'performance_views.vitals.open_all_events',
-      eventName: 'Performance Views: Open vitals in all events',
-      organization_id: organization.id,
+    trackAdvancedAnalyticsEvent('performance_views.vitals.open_all_events', {
+      organization,
       vital: vital.slug,
     });
   };

+ 5 - 9
static/app/views/performance/trends/content.tsx

@@ -17,7 +17,7 @@ import {MAX_QUERY_LENGTH} from 'sentry/constants';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization, PageFilters, Project} from 'sentry/types';
-import {trackAnalyticsEvent} from 'sentry/utils/analytics';
+import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
 import EventView from 'sentry/utils/discover/eventView';
 import {generateAggregateFields} from 'sentry/utils/discover/fields';
 import {decodeScalar} from 'sentry/utils/queryString';
@@ -92,10 +92,8 @@ class TrendsContent extends Component<Props, State> {
       offsets[queryKey] = undefined;
     });
 
-    trackAnalyticsEvent({
-      eventKey: 'performance_views.trends.change_function',
-      eventName: 'Performance Views: Change Function',
-      organization_id: parseInt(organization.id, 10),
+    trackAdvancedAnalyticsEvent('performance_views.trends.change_function', {
+      organization,
       function_name: field,
     });
 
@@ -134,10 +132,8 @@ class TrendsContent extends Component<Props, State> {
     const {organization, location} = this.props;
     const cursors = resetCursors();
 
-    trackAnalyticsEvent({
-      eventKey: 'performance_views.trends.change_parameter',
-      eventName: 'Performance Views: Change Parameter',
-      organization_id: parseInt(organization.id, 10),
+    trackAdvancedAnalyticsEvent('performance_views.trends.change_parameter', {
+      organization,
       parameter_name: label,
     });
 

+ 6 - 9
static/app/views/performance/vitalDetail/table.tsx

@@ -14,7 +14,7 @@ import Tag from 'sentry/components/tag';
 import {IconStar} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {Organization, Project} from 'sentry/types';
-import {trackAnalyticsEvent} from 'sentry/utils/analytics';
+import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
 import EventView, {
   EventsMetaType,
   isFieldSortable,
@@ -84,10 +84,8 @@ class Table extends Component<Props, State> {
     return (action: Actions, value: React.ReactText) => {
       const {eventView, location, organization} = this.props;
 
-      trackAnalyticsEvent({
-        eventKey: 'performance_views.overview.cellaction',
-        eventName: 'Performance Views: Cell Action Clicked',
-        organization_id: parseInt(organization.id, 10),
+      trackAdvancedAnalyticsEvent('performance_views.overview.cellaction', {
+        organization,
         action,
       });
 
@@ -300,10 +298,9 @@ class Table extends Component<Props, State> {
 
   handleSummaryClick = () => {
     const {organization, projects, location} = this.props;
-    trackAnalyticsEvent({
-      eventKey: 'performance_views.overview.navigate.summary',
-      eventName: 'Performance Views: Overview view summary',
-      organization_id: parseInt(organization.id, 10),
+
+    trackAdvancedAnalyticsEvent('performance_views.overview.navigate.summary', {
+      organization,
       project_platforms: getSelectedProjectPlatforms(location, projects),
     });
   };