Browse Source

feat(starfish): add transaction.op:http.server to webservice queries (#53355)

I also double checked mobile, currently it does not use `useSpansQuery`,
but instead uses traditional HOC, so no need to update anything there
yet.
Dominik Buszowiecki 1 year ago
parent
commit
0e3d1f301e

+ 10 - 9
static/app/views/starfish/queries/useSpanList.tsx

@@ -69,15 +69,16 @@ function getEventView(
   spanCategory?: string,
   sorts?: Sort[]
 ) {
-  const query = buildEventViewQuery({
-    moduleName,
-    location,
-    transaction,
-    method,
-    spanCategory,
-  })
-    .filter(Boolean)
-    .join(' ');
+  const query = [
+    ...buildEventViewQuery({
+      moduleName,
+      location,
+      transaction,
+      method,
+      spanCategory,
+    }),
+    'transaction.op:http.server',
+  ].join(' ');
 
   const fields = [
     SPAN_OP,

+ 1 - 0
static/app/views/starfish/types.tsx

@@ -6,6 +6,7 @@ import {FieldDefinition, FieldKind, FieldValueType} from 'sentry/utils/fields';
 export enum StarfishType {
   BACKEND = 'backend',
   MOBILE = 'mobile',
+  FRONTEND = 'frontend',
 }
 
 export enum ModuleName {

+ 9 - 1
static/app/views/starfish/utils/useSpansQuery.tsx

@@ -13,6 +13,7 @@ import {
 import {useLocation} from 'sentry/utils/useLocation';
 import useOrganization from 'sentry/utils/useOrganization';
 import usePageFilters from 'sentry/utils/usePageFilters';
+import {StarfishType} from 'sentry/views/starfish/types';
 import {
   getRetryDelay,
   shouldRetryHandler,
@@ -28,6 +29,7 @@ export function useSpansQuery<T = any[]>({
   enabled,
   referrer = 'use-spans-query',
   cursor,
+  view = StarfishType.BACKEND,
 }: {
   cursor?: string;
   enabled?: boolean;
@@ -35,6 +37,7 @@ export function useSpansQuery<T = any[]>({
   initialData?: T;
   limit?: number;
   referrer?: string;
+  view?: StarfishType;
 }) {
   const isTimeseriesQuery = (eventView?.yAxis?.length ?? 0) > 0;
   const queryFunction = isTimeseriesQuery
@@ -44,8 +47,13 @@ export function useSpansQuery<T = any[]>({
   const {isReady: pageFiltersReady} = usePageFilters();
 
   if (eventView) {
+    const newEventView = eventView.clone();
+    // We can also add `if (view == 'mobile') -> 'transaction.op:ui.load'` here in the future
+    if (view === StarfishType.BACKEND) {
+      newEventView.query = `${eventView.query} transaction.op:http.server`;
+    }
     const response = queryFunction<T>({
-      eventView,
+      eventView: newEventView,
       initialData,
       limit,
       // We always want to wait until the pageFilters are ready to prevent clobbering requests