Browse Source

fix(starfish): Manually add transaction filter (#60554)

Quick fix to allow transaction names to be added to the top transactions
query. This avoids any problems with incorrectly parsing the tokens that
results in `"` being placed at incorrect positions when passed an array
of values that are quoted.
Nar Saynorath 1 year ago
parent
commit
f112a3ad39
1 changed files with 9 additions and 4 deletions
  1. 9 4
      static/app/views/starfish/views/screens/index.tsx

+ 9 - 4
static/app/views/starfish/views/screens/index.tsx

@@ -17,7 +17,7 @@ import EventView from 'sentry/utils/discover/eventView';
 import {AggregationOutputType} from 'sentry/utils/discover/fields';
 import {AggregationOutputType} from 'sentry/utils/discover/fields';
 import {DiscoverDatasets} from 'sentry/utils/discover/types';
 import {DiscoverDatasets} from 'sentry/utils/discover/types';
 import {decodeScalar} from 'sentry/utils/queryString';
 import {decodeScalar} from 'sentry/utils/queryString';
-import {MutableSearch} from 'sentry/utils/tokenizeSearch';
+import {escapeFilterValue, MutableSearch} from 'sentry/utils/tokenizeSearch';
 import {useLocation} from 'sentry/utils/useLocation';
 import {useLocation} from 'sentry/utils/useLocation';
 import useOrganization from 'sentry/utils/useOrganization';
 import useOrganization from 'sentry/utils/useOrganization';
 import usePageFilters from 'sentry/utils/usePageFilters';
 import usePageFilters from 'sentry/utils/usePageFilters';
@@ -171,15 +171,20 @@ export function ScreensView({yAxes, additionalFilters, chartHeight}: Props) {
   const topEventsQuery = new MutableSearch([
   const topEventsQuery = new MutableSearch([
     'event.type:transaction',
     'event.type:transaction',
     'transaction.op:ui.load',
     'transaction.op:ui.load',
-    ...(topTransactions.length > 0 ? [`transaction:[${topTransactions.join()}]`] : []),
     ...(additionalFilters ?? []),
     ...(additionalFilters ?? []),
   ]);
   ]);
 
 
-  const topEventsQueryString = appendReleaseFilters(
+  const topEventsQueryString = `${appendReleaseFilters(
     topEventsQuery,
     topEventsQuery,
     primaryRelease,
     primaryRelease,
     secondaryRelease
     secondaryRelease
-  );
+  )} ${
+    topTransactions.length > 0
+      ? escapeFilterValue(
+          `transaction:[${topTransactions.map(name => `"${name}"`).join()}]`
+        )
+      : ''
+  }`.trim();
 
 
   const {data: releaseEvents, isLoading: isReleaseEventsLoading} = useTableQuery({
   const {data: releaseEvents, isLoading: isReleaseEventsLoading} = useTableQuery({
     eventView: EventView.fromNewQueryWithLocation(
     eventView: EventView.fromNewQueryWithLocation(