Browse Source

fix(new-trace): Fixing broken link from llm monitoring summary page (#83980)

<img width="797" alt="Screenshot 2025-01-24 at 1 26 53 AM"
src="https://github.com/user-attachments/assets/0e6fe9cf-6142-4fbb-b548-615881e3c9d4"
/>

---------

Co-authored-by: Abdullah Khan <abdullahkhan@PG9Y57YDXQ.local>
Abdullah Khan 1 month ago
parent
commit
8e3a61b989

+ 9 - 3
static/app/views/insights/llmMonitoring/components/tables/pipelineSpansTable.tsx

@@ -22,6 +22,10 @@ import {
   useSpansIndexed,
 } from 'sentry/views/insights/common/queries/useDiscover';
 import {QueryParameterNames} from 'sentry/views/insights/common/views/queryParameters';
+import {
+  type DomainView,
+  useDomainViewFilters,
+} from 'sentry/views/insights/pages/useFilters';
 import {SpanIndexedField} from 'sentry/views/insights/types';
 import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
 
@@ -80,6 +84,7 @@ interface Props {
 export function PipelineSpansTable({groupId, useEAP}: Props) {
   const location = useLocation();
   const organization = useOrganization();
+  const {view} = useDomainViewFilters();
 
   const sortField = decodeScalar(location.query?.[QueryParameterNames.SPANS_SORT]);
 
@@ -164,7 +169,7 @@ export function PipelineSpansTable({groupId, useEAP}: Props) {
               sortParameterName: QueryParameterNames.SPANS_SORT,
             }),
           renderBodyCell: (column, row) =>
-            renderBodyCell(column, row, meta, location, organization, groupId),
+            renderBodyCell(column, row, meta, location, organization, groupId, view),
         }}
       />
     </VisuallyCompleteWithData>
@@ -177,7 +182,8 @@ function renderBodyCell(
   meta: EventsMetaType | undefined,
   location: Location,
   organization: Organization,
-  groupId: string
+  groupId: string,
+  view: DomainView | undefined
 ) {
   if (column.key === SpanIndexedField.ID) {
     if (!row[SpanIndexedField.ID]) {
@@ -204,7 +210,7 @@ function renderBodyCell(
           eventView: EventView.fromLocation(location),
           spanId: row[SpanIndexedField.ID],
           source: TraceViewSources.LLM_MODULE,
-          view: 'ai',
+          view,
         })}
       >
         {row[SpanIndexedField.ID]}

+ 8 - 1
static/app/views/insights/mobile/appStarts/components/eventSamples.tsx

@@ -89,7 +89,14 @@ export function EventSamples({
 
   const newQuery: NewQuery = {
     name: '',
-    fields: ['trace', 'transaction.id', 'project.name', 'profile_id', 'span.duration'],
+    fields: [
+      'trace',
+      'timestamp',
+      'transaction.id',
+      'project.name',
+      'profile_id',
+      'span.duration',
+    ],
     query: searchQuery.formatString(),
     dataset: DiscoverDatasets.SPANS_INDEXED,
     version: 2,

+ 3 - 0
static/app/views/insights/mobile/common/components/spanSamplesPanelContainer.tsx

@@ -25,6 +25,7 @@ import {DataTitles} from 'sentry/views/insights/common/views/spans/types';
 import DurationChart from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/durationChart';
 import SampleTable from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/sampleTable/sampleTable';
 import useCrossPlatformProject from 'sentry/views/insights/mobile/common/queries/useCrossPlatformProject';
+import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
 import {
   type ModuleName,
   SpanMetricsField,
@@ -59,6 +60,7 @@ export function SpanSamplesContainer({
 }: Props) {
   const location = useLocation();
   const navigate = useNavigate();
+  const {view} = useDomainViewFilters();
   const [highlightedSpanId, setHighlightedSpanId] = useState<string | undefined>(
     undefined
   );
@@ -187,6 +189,7 @@ export function SpanSamplesContainer({
               organization,
               traceSlug: span.trace,
               timestamp: span.timestamp,
+              view,
               source: TraceViewSources.APP_STARTS_MODULE,
             })
           );

+ 1 - 0
static/app/views/insights/mobile/screenload/components/eventSamples.tsx

@@ -94,6 +94,7 @@ export function ScreenLoadEventSamples({
     fields: [
       'id',
       'trace',
+      'timestamp',
       'project.name',
       'profile.id',
       'measurements.time_to_initial_display',

+ 3 - 1
static/app/views/insights/mobile/screenload/components/tables/eventSamplesTable.tsx

@@ -28,6 +28,7 @@ import useOrganization from 'sentry/utils/useOrganization';
 import type {TableColumn} from 'sentry/views/discover/table/types';
 import SubregionSelector from 'sentry/views/insights/common/views/spans/selectors/subregionSelector';
 import {DeviceClassSelector} from 'sentry/views/insights/mobile/common/components/deviceClassSelector';
+import {useDomainViewFilters} from 'sentry/views/insights/pages/useFilters';
 import {ModuleName} from 'sentry/views/insights/types';
 import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
 
@@ -65,7 +66,7 @@ export function EventSamplesTable({
   const navigate = useNavigate();
   const location = useLocation();
   const organization = useOrganization();
-
+  const {view} = useDomainViewFilters();
   const eventViewColumns = eventView.getColumns();
 
   function renderBodyCell(column: any, row: any): React.ReactNode {
@@ -83,6 +84,7 @@ export function EventSamplesTable({
             timestamp: row.timestamp,
             organization,
             location,
+            view,
             source: TraceViewSources.SCREEN_LOADS_MODULE,
           })}
         >

+ 6 - 2
static/app/views/performance/traceDetails/utils.tsx

@@ -35,7 +35,7 @@ export function getTraceDetailsUrl({
   targetId,
   demo,
   location,
-  source = TraceViewSources.TRACES,
+  source,
   view,
 }: {
   // @TODO add a type for dateSelection
@@ -56,7 +56,11 @@ export function getTraceDetailsUrl({
   const baseUrl = view
     ? getPerformanceBaseUrl(organization.slug, view)
     : normalizeUrl(
-        `/organizations/${organization.slug}/${TRACE_SOURCE_TO_NON_INSIGHT_ROUTES[source]}`
+        `/organizations/${organization.slug}/${
+          TRACE_SOURCE_TO_NON_INSIGHT_ROUTES[
+            source ?? TraceViewSources.PERFORMANCE_TRANSACTION_SUMMARY
+          ]
+        }`
       );
   const queryParams: Record<string, string | number | undefined | DateString | string[]> =
     {