Просмотр исходного кода

fix(trace) add extra analytics properties (#73432)

add more analytics info so we can debug where these are mostly coming
from
Jonas 8 месяцев назад
Родитель
Сommit
f468264d14

+ 3 - 0
static/app/utils/analytics/tracingEventMap.tsx

@@ -22,6 +22,9 @@ export type TracingEventParameters = {
     num_children: number;
     project_platform: string;
     type: string;
+    next_op?: string;
+    parent_op?: string;
+    previous_op?: string;
   };
   'trace.trace_layout.tab_pin': {};
   'trace.trace_layout.tab_view': {

+ 2 - 0
static/app/views/performance/newTraceDetails/index.tsx

@@ -73,6 +73,7 @@ import {type TraceMetaQueryResults, useTraceMeta} from './traceApi/useTraceMeta'
 import {useTraceRootEvent} from './traceApi/useTraceRootEvent';
 import {TraceDrawer} from './traceDrawer/traceDrawer';
 import {
+  traceNodeAdjacentAnalyticsProperties,
   traceNodeAnalyticsName,
   TraceTree,
   type TraceTreeNode,
@@ -590,6 +591,7 @@ export function TraceViewWaterfall(props: TraceViewWaterfallProps) {
         type: traceNodeAnalyticsName(node),
         project_platform:
           projects.find(p => p.slug === node.metadata.project_slug)?.platform || 'other',
+        ...traceNodeAdjacentAnalyticsProperties(node),
       });
 
       if (traceStateRef.current.preferences.drawer.minimized) {

+ 25 - 0
static/app/views/performance/newTraceDetails/traceModels/traceTree.tsx

@@ -6,6 +6,7 @@ import type {RawSpanType} from 'sentry/components/events/interfaces/spans/types'
 import {pickBarColor} from 'sentry/components/performance/waterfall/utils';
 import type {Event, EventTransaction, Measurement} from 'sentry/types/event';
 import type {Organization} from 'sentry/types/organization';
+import type {TracingEventParameters} from 'sentry/utils/analytics/tracingEventMap';
 import {MobileVital, WebVital} from 'sentry/utils/fields';
 import type {
   TraceError as TraceErrorType,
@@ -2443,6 +2444,30 @@ export function traceNodeAnalyticsName(node: TraceTreeNode<TraceTree.NodeValue>)
   return 'unknown';
 }
 
+export function traceNodeAdjacentAnalyticsProperties(
+  node: TraceTreeNode<TraceTree.NodeValue>
+): Pick<
+  TracingEventParameters['trace.trace_layout.span_row_click'],
+  'next_op' | 'parent_op' | 'previous_op'
+> {
+  if (isNoDataNode(node)) {
+    const parent_transaction = node.parent_transaction;
+    if (!parent_transaction) return {};
+    return {
+      parent_op: parent_transaction.value['transaction.op'],
+    };
+  }
+
+  if (isMissingInstrumentationNode(node)) {
+    return {
+      previous_op: node.previous.value.op,
+      next_op: node.next.value.op,
+    };
+  }
+
+  return {};
+}
+
 // Creates an example trace response that we use to render the loading placeholder
 function partialTransaction(
   partial: Partial<TraceTree.Transaction>