11import { Fragment , memo , useCallback } from 'react' ;
22import styled from '@emotion/styled' ;
33
4+ import { Flex } from '@sentry/scraps/layout' ;
5+
6+ import { Button } from 'sentry/components/core/button' ;
47import Pagination from 'sentry/components/pagination' ;
58import GridEditable , {
69 COL_WIDTH_UNDEFINED ,
@@ -16,6 +19,7 @@ import {useApiQuery} from 'sentry/utils/queryClient';
1619import useOrganization from 'sentry/utils/useOrganization' ;
1720import usePageFilters from 'sentry/utils/usePageFilters' ;
1821import { getExploreUrl } from 'sentry/views/explore/utils' ;
22+ import { useTraceViewDrawer } from 'sentry/views/insights/agents/components/drawer' ;
1923import { LLMCosts } from 'sentry/views/insights/agents/components/llmCosts' ;
2024import { useTableCursor } from 'sentry/views/insights/agents/hooks/useTableCursor' ;
2125import { ErrorCell } from 'sentry/views/insights/agents/utils/cells' ;
@@ -52,9 +56,10 @@ export function ConversationsTable() {
5256const EMPTY_ARRAY : never [ ] = [ ] ;
5357
5458const defaultColumnOrder : Array < GridColumnOrder < string > > = [
55- { key : 'conversationId' , name : t ( 'Conversation ID' ) , width : 150 } ,
59+ { key : 'conversationId' , name : t ( 'Conversation ID' ) , width : 135 } ,
60+ { key : 'traceIds' , name : t ( 'Traces' ) , width : 130 } ,
5661 { key : 'flow' , name : t ( 'Flow' ) , width : COL_WIDTH_UNDEFINED } , // Containing summary of the conversation or list of agents
57- { key : 'duration' , name : t ( 'Root Duration' ) , width : 130 } ,
62+ { key : 'duration' , name : t ( 'Duration' ) , width : 130 } ,
5863 { key : 'errors' , name : t ( 'Errors' ) , width : 100 } ,
5964 { key : 'llmCalls' , name : t ( 'LLM Calls' ) , width : 110 } ,
6065 { key : 'toolCalls' , name : t ( 'Tool Calls' ) , width : 110 } ,
@@ -69,6 +74,8 @@ const rightAlignColumns = new Set([
6974 'toolCalls' ,
7075 'totalTokens' ,
7176 'totalCost' ,
77+ 'timestamp' ,
78+ 'duration' ,
7279] ) ;
7380
7481function ConversationsTableInner ( ) {
@@ -158,10 +165,26 @@ const BodyCell = memo(function BodyCell({
158165} ) {
159166 const organization = useOrganization ( ) ;
160167 const { selection} = usePageFilters ( ) ;
168+ const { openTraceViewDrawer} = useTraceViewDrawer ( ) ;
161169
162170 switch ( column . key ) {
163171 case 'conversationId' :
164- return < span > { dataRow . conversationId } </ span > ;
172+ return dataRow . conversationId . slice ( 0 , 8 ) ;
173+ case 'traceIds' :
174+ return (
175+ < Flex align = "start" direction = "column" gap = "sm" >
176+ { dataRow . traceIds . length > 0 &&
177+ dataRow . traceIds . map ( traceId => (
178+ < TraceIdButton
179+ key = { traceId }
180+ priority = "link"
181+ onClick = { ( ) => openTraceViewDrawer ( traceId ) }
182+ >
183+ { traceId . slice ( 0 , 8 ) }
184+ </ TraceIdButton >
185+ ) ) }
186+ </ Flex >
187+ ) ;
165188 case 'flow' :
166189 return < span > { dataRow . flow . join ( ' → ' ) } </ span > ;
167190 case 'duration' :
@@ -220,3 +243,7 @@ const HeadCell = styled('div')<{align: 'left' | 'right'}>`
220243 gap: ${ p => p . theme . space . xs } ;
221244 justify-content: ${ p => ( p . align === 'right' ? 'flex-end' : 'flex-start' ) } ;
222245` ;
246+
247+ const TraceIdButton = styled ( Button ) `
248+ font-weight: normal;
249+ ` ;
0 commit comments