Browse Source

fix(discover): Don't send Discover Queries to reload (#33085)

Stops sending analytics for discover queries from the discover results page
edwardgou-sentry 2 years ago
parent
commit
9fcf18f29d

+ 0 - 4
static/app/utils/analytics/discoverAnalyticsEvents.tsx

@@ -1,9 +1,6 @@
 export type DiscoverEventParameters = {
   'discover_views.add_to_dashboard.confirm': {};
   'discover_views.add_to_dashboard.modal_open': {saved_query: boolean};
-  'discover_views.query': {
-    conditions: string[];
-  };
 };
 
 export type DiscoverEventKey = keyof DiscoverEventParameters;
@@ -13,5 +10,4 @@ export const discoverEventMap: Record<DiscoverEventKey, string | null> = {
     'Discover2: Add to Dashboard modal opened',
   'discover_views.add_to_dashboard.confirm':
     'Discover2: Add to Dashboard modal form submitted',
-  'discover_views.query': 'Discover2: Query sent from Discover Results page',
 };

+ 0 - 26
static/app/views/eventsV2/resultsChart.tsx

@@ -12,10 +12,8 @@ import {WorldMapChart} from 'sentry/components/charts/worldMapChart';
 import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
 import {Panel} from 'sentry/components/panels';
 import Placeholder from 'sentry/components/placeholder';
-import {parseSearch} from 'sentry/components/searchSyntax/parser';
 import {t} from 'sentry/locale';
 import {Organization} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
 import {getUtcToLocalDateObject} from 'sentry/utils/dates';
 import EventView from 'sentry/utils/discover/eventView';
 import {isEquation, stripEquationPrefix} from 'sentry/utils/discover/fields';
@@ -159,10 +157,6 @@ type ContainerProps = {
 };
 
 class ResultsChartContainer extends Component<ContainerProps> {
-  componentDidMount() {
-    this.trackQueryConditions();
-  }
-
   shouldComponentUpdate(nextProps: ContainerProps) {
     const {eventView, ...restProps} = this.props;
     const {eventView: nextEventView, ...restNextProps} = nextProps;
@@ -177,26 +171,6 @@ class ResultsChartContainer extends Component<ContainerProps> {
     return !isEqual(restProps, restNextProps);
   }
 
-  componentDidUpdate(prevProps: ContainerProps) {
-    if (this.props.eventView.query !== prevProps.eventView.query) {
-      this.trackQueryConditions();
-    }
-  }
-
-  trackQueryConditions() {
-    const {organization, eventView} = this.props;
-    const parsedSearch = parseSearch(eventView.query);
-    if (parsedSearch) {
-      const conditions = parsedSearch
-        .filter(({text}) => text.trim() !== '')
-        .map(({text}) => text);
-      trackAdvancedAnalyticsEvent('discover_views.query', {
-        organization,
-        conditions,
-      });
-    }
-  }
-
   render() {
     const {
       api,