-
Notifications
You must be signed in to change notification settings - Fork 410
feat(tracing): separate histogram into dedicated endpoint #2192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf CI / validate (pull_request).
|
Mark fields 1 and 2 as reserved in ListTracesRequest since start_time and end_time were moved to the nested Filter message.
|
|
||
| import { Button } from 'components/redpanda-ui/components/button'; | ||
| import { Text } from 'components/redpanda-ui/components/typography'; | ||
| import { Link, X } from 'lucide-react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: use components/icons barrel file for this
| // Truncate trace ID for display (show first 8 and last 4 characters) | ||
| const truncatedId = traceId.length > 16 ? `${traceId.slice(0, 8)}...${traceId.slice(-4)}` : traceId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better if we can truncate using CSS, then show the ID on hover? or just let the ID show up based on how much space is provided, something like white-space:nowrap; text-overflow: ellipsis;
| <code className="rounded bg-muted px-1 py-0.5 font-mono text-xs" title={traceId}> | ||
| {truncatedId} | ||
| </code> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try using Code component from typography component, hopefully it looks ok
| View Surrounding Traces | ||
| </Button> | ||
| <Button aria-label="Dismiss linked trace" className="h-7 w-7" onClick={onDismiss} size="icon" variant="ghost"> | ||
| <X className="h-3.5 w-3.5" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think standard is multiples of 4 (most icons in the UI should have consistent size of 16px across the board)
| * by the Apache License, Version 2.0 | ||
| */ | ||
|
|
||
| import { render, screen } from '@testing-library/react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: import from test-utils
|
|
||
| import { render, screen } from '@testing-library/react'; | ||
| import userEvent from '@testing-library/user-event'; | ||
| import { describe, expect, it } from 'vitest'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ultra nit: use test() because that's what we have elsewhere
- Use components/icons barrel file instead of direct lucide-react import - Use CSS truncation with title hover instead of JavaScript truncation
| it('renders tool name in header', () => { | ||
| render(<ToolEventCard content={smallPayload} testId="tool-card" toolName="readFile" type="call" />); | ||
|
|
||
| expect(screen.getByText('readFile')).toBeInTheDocument(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.toBeVisible() would be better than .toBeInTheDocument() since it will also verify it's not being obstructed by another z-index element in the DOM.
| onBucketClick={jumpedTo || isLinkedTraceMode ? undefined : handleBucketClick} | ||
| queryEndMs={ | ||
| isLinkedTraceMode && activeTraceTimeMs | ||
| ? Math.min(activeTraceTimeMs + 60 * 60 * 1000, Date.now()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe just say ONE_HOUR
| // Exit linked mode and center time range on the linked trace's time | ||
| if (activeTraceTimeMs) { | ||
| const THIRTY_MINUTES_MS = 30 * 60 * 1000; | ||
| const startMs = activeTraceTimeMs - THIRTY_MINUTES_MS; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
30 * ONE_MINUTE? we have time utils
| { | ||
| pageSize: TRANSCRIPTS_PAGE_SIZE, | ||
| pageToken: currentPageToken, | ||
| filter: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
| setSelectedTraceId(null); | ||
| setSelectedSpanId(null); | ||
| }, [setSelectedTraceId, setSelectedSpanId]); | ||
| setSelectedTab(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of useState hooks, it can get a bit out of control eventually given there is a lot of state to manage. At that point we should either consider:
useReducer(staying within React bounds)useContext(we will eventually use React 19 so this would need a refactor later)- recommended: zustand store for state management. (can be done in another PR) - simply add a new slice like
useTranscriptStore, this will also let people save their settings globally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to useQueryStates() but did not use zustand because we want to keep using the url params for state management, so that we have
- Sharable URLs that open the exact same view
- Different tabs cannot interfere with each other due to shared state
| const transport = createRouterTransport(({ rpc }) => { | ||
| rpc(listTraces, listTracesMock); | ||
| rpc(getTrace, getTraceMock); | ||
| rpc(getTraceHistogram, getTraceHistogramMock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome, this is the way to do tests, super happy with this
frontend/src/components/pages/transcripts/components/transcripts-table.tsx
Show resolved
Hide resolved
LinkedTraceBanner: - Use InlineCode component from typography instead of raw <code> - Use 16px icon size (h-4 w-4) for consistency tool-event-card.test.tsx: - Import from test-utils instead of @testing-library/react - Use test() instead of it() for consistency - Use toBeVisible() instead of toBeInTheDocument() for visible elements transcript-list-page.tsx: - Rename ONE_HOUR_MS to ONE_HOUR
frontend/src/components/pages/transcripts/components/tool-event-card.tsx
Show resolved
Hide resolved
|
|
||
| {/* Preview when collapsed */} | ||
| {!isExpanded && hasPreview ? ( | ||
| <button |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use a redpanda UI registry button
frontend/src/components/pages/transcripts/components/tool-event-card.tsx
Outdated
Show resolved
Hide resolved
|
Re: Negative margins in transcripts-table.tsx:218 The negative margins ( Re: Unordered list in tool-event-card.tsx:99 This is inline metadata display (Type • Call ID • Size) rather than a semantic list. Using |
tool-event-card.tsx: - Change icon sizes from h-3 w-3 to h-4 w-4 (16px standard) - Use Button component with variant="ghost" for preview area transcript-list-page.tsx: - Use ONE_MINUTE from time utils for time constants - Replace hardcoded values with 30 * ONE_MINUTE and 60 * ONE_MINUTE
Replace 4 separate useQueryState hooks with single useQueryStates for batched URL updates. This reduces hook count and ensures atomic updates when clearing multiple params (e.g., resetQueryState, handleDismissLinkedTrace).
… tabs Add consistent leading-relaxed line height and whitespace-pre-wrap text wrapping across detail tabs. Add section labels (DESCRIPTION, ARGUMENTS, RESPONSE) to tool call tab for better content organization.
Add updatePageTitle() to set uiState.pageTitle and pageBreadcrumbs, matching the pattern used by AI Agents and Remote MCP pages.
Update the transcripts page description to better explain the feature and add a "Learn more" link to the documentation, consistent with other pages like connect-clusters.
Allow users to double-click on transcript and span rows to toggle their expanded state, improving the table interaction UX.
Summary
GetTraceHistogramRPC endpoint instead of bundling histogram withListTracesToolEventCardcomponent for tool call displayLinkedTraceBannerfor viewing traces outside current time rangeTest plan
bun test transcript