Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(tracing): add trace actions column to span list (#62629)

Jon McCallum8fd3772a6f68
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 487227d8e6c3..c3285be8864c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -446,7 +446,7 @@ importers:
'@storybook/react-webpack5':
specifier: ^8.6.14
'@storybook/test-runner':
specifier: ^0.19.1
@@ -500,7 +500,7 @@ importers:
version: 2.0.0([email protected])
webpack:
specifier: 5.88.2
webpack-cli:
specifier: ^5.1.4
version: 5.1.4([email protected])
@@ -3582,6 +3582,9 @@ importers:
'@posthog/icons':
specifier: '*'
+ '@testing-library/react':
+ specifier: '*'
'@types/react':
specifier: 18.3.27
version: 18.3.27
@@ -3630,7 +3633,7 @@ importers:
version: 1.2.1
jest:
specifier: '*'
kea:
specifier: 'catalog:'
version: 4.0.0-pre.5([email protected])
@@ -27266,6 +27269,41 @@ snapshots:
- ts-node
- utf-8-validate
+ dependencies:
+ '@jest/console': 29.7.0
+ '@jest/reporters': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/transform': 29.7.0
+ '@jest/types': 29.6.3
+ '@types/node': 22.18.8
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ ci-info: 3.8.0
+ exit: 0.1.2
+ graceful-fs: 4.2.11
+ jest-changed-files: 29.7.0
+ jest-config: 29.7.0(@types/[email protected])
+ jest-haste-map: 29.7.0
+ jest-message-util: 29.7.0
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-resolve-dependencies: 29.7.0
+ jest-runner: 29.7.0
+ jest-runtime: 29.7.0
+ jest-snapshot: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ jest-watcher: 29.7.0
+ micromatch: 4.0.8
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-ansi: 6.0.1
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
dependencies:
'@jest/console': 29.7.0
@@ -27407,6 +27445,42 @@ snapshots:
- supports-color
- ts-node
+ dependencies:
+ '@jest/console': 30.0.5
+ '@jest/pattern': 30.0.1
+ '@jest/reporters': 30.0.5
+ '@jest/test-result': 30.0.5
+ '@jest/transform': 30.0.5
+ '@jest/types': 30.0.5
+ '@types/node': 22.18.8
+ ansi-escapes: 4.3.2
+ chalk: 4.1.2
+ ci-info: 4.3.0
+ exit-x: 0.2.2
+ graceful-fs: 4.2.11
+ jest-changed-files: 30.0.5
+ jest-haste-map: 30.0.5
+ jest-message-util: 30.0.5
+ jest-regex-util: 30.0.1
+ jest-resolve: 30.0.5
+ jest-resolve-dependencies: 30.0.5
+ jest-runner: 30.0.5
+ jest-runtime: 30.0.5
+ jest-snapshot: 30.0.5
+ jest-util: 30.0.5
+ jest-validate: 30.0.5
+ jest-watcher: 30.0.5
+ micromatch: 4.0.8
+ pretty-format: 30.0.5
+ slash: 3.0.0
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - esbuild-register
+ - supports-color
+ - ts-node
+
dependencies:
'@jest/types': 29.6.3
@@ -31598,7 +31672,7 @@ snapshots:
ts-dedent: 2.2.0
dependencies:
'@storybook/core-webpack': 8.6.18([email protected]([email protected]))
'@types/semver': 7.7.1
@@ -31616,12 +31690,12 @@ snapshots:
semver: 7.8.0
storybook: 8.6.18([email protected])
style-loader: 3.3.3([email protected])
+ terser-webpack-plugin: 5.6.0([email protected])([email protected])
ts-dedent: 2.2.0
url: 0.11.1
util: 0.12.5
util-deprecate: 1.0.2
webpack-dev-middleware: 6.1.3([email protected])
webpack-hot-middleware: 2.25.4
webpack-virtual-modules: 0.6.2
@@ -31715,7 +31789,7 @@ snapshots:
dependencies:
storybook: 8.6.18([email protected])
dependencies:
'@storybook/core-webpack': 8.6.18([email protected]([email protected]))
@@ -31730,7 +31804,7 @@ snapshots:
semver: 7.8.0
storybook: 8.6.18([email protected])
tsconfig-paths: 4.2.0
optionalDependencies:
typescript: 6.0.3
transitivePeerDependencies:
@@ -31764,7 +31838,7 @@ snapshots:
react-docgen-typescript: 2.2.2([email protected])
tslib: 2.8.1
typescript: 6.0.3
transitivePeerDependencies:
- supports-color
@@ -31802,10 +31876,10 @@ snapshots:
- supports-color
- typescript
dependencies:
react: 18.3.1
react-dom: 18.3.1([email protected])
@@ -31899,7 +31973,7 @@ snapshots:
'@swc/core': 1.15.18
'@swc/jest': 0.2.37(@swc/[email protected])
expect-playwright: 0.8.0
+ jest: 29.7.0
jest-circus: 29.7.0
jest-environment-node: 29.7.0
jest-junit: 16.0.0
@@ -34164,17 +34238,17 @@ snapshots:
dependencies:
webpack-cli: 5.1.4([email protected])
dependencies:
webpack-cli: 5.1.4([email protected])
dependencies:
webpack-cli: 5.1.4([email protected])
'@xmldom/[email protected]': {}
@@ -34715,7 +34789,7 @@ snapshots:
loader-utils: 2.0.4
make-dir: 3.1.0
schema-utils: 2.7.1
dependencies:
@@ -35679,6 +35753,21 @@ snapshots:
safe-buffer: 5.2.1
sha.js: 2.4.12
+ dependencies:
+ '@jest/types': 29.6.3
+ chalk: 4.1.2
+ exit: 0.1.2
+ graceful-fs: 4.2.11
+ jest-config: 29.7.0
+ jest-util: 29.7.0
+ prompts: 2.4.2
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
dependencies:
'@jest/types': 29.6.3
@@ -35808,7 +35897,7 @@ snapshots:
postcss-value-parser: 4.2.0
schema-utils: 2.7.1
semver: 6.3.1
dependencies:
@@ -35820,7 +35909,7 @@ snapshots:
postcss-modules-values: 4.0.0([email protected])
postcss-value-parser: 4.2.0
semver: 7.8.0
dependencies:
@@ -37431,7 +37520,7 @@ snapshots:
dependencies:
loader-utils: 2.0.4
schema-utils: 3.3.0
@@ -37550,7 +37639,7 @@ snapshots:
semver: 7.8.0
tapable: 2.3.0
typescript: 6.0.3
dependencies:
@@ -38202,7 +38291,7 @@ snapshots:
dependencies:
html-webpack-plugin: 5.5.3([email protected])
dependencies:
@@ -38211,7 +38300,7 @@ snapshots:
lodash: 4.18.1
pretty-error: 4.0.0
tapable: 2.2.1
dependencies:
@@ -38939,6 +39028,25 @@ snapshots:
- ts-node
- utf-8-validate
+ dependencies:
+ '@jest/core': 29.7.0
+ '@jest/test-result': 29.7.0
+ '@jest/types': 29.6.3
+ chalk: 4.1.2
+ create-jest: 29.7.0
+ exit: 0.1.2
+ import-local: 3.2.0
+ jest-config: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ yargs: 17.7.2
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
dependencies:
@@ -39015,6 +39123,25 @@ snapshots:
- supports-color
- ts-node
+ dependencies:
+ '@jest/test-result': 30.0.5
+ '@jest/types': 30.0.5
+ chalk: 4.1.2
+ exit-x: 0.2.2
+ import-local: 3.2.0
+ jest-util: 30.0.5
+ jest-validate: 30.0.5
+ yargs: 17.7.2
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - esbuild-register
+ - supports-color
+ - ts-node
+
dependencies:
'@babel/core': 7.29.0
@@ -39049,6 +39176,64 @@ snapshots:
- supports-color
- utf-8-validate
+ dependencies:
+ '@babel/core': 7.29.0
+ '@jest/test-sequencer': 29.7.0
+ '@jest/types': 29.6.3
+ babel-jest: 29.7.0(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 3.8.0
+ deepmerge: 4.3.1
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ jest-circus: 29.7.0
+ jest-environment-node: 29.7.0
+ jest-get-type: 29.6.3
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-runner: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.29.0
+ '@jest/test-sequencer': 29.7.0
+ '@jest/types': 29.6.3
+ babel-jest: 29.7.0(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 3.8.0
+ deepmerge: 4.3.1
+ glob: 7.2.3
+ graceful-fs: 4.2.11
+ jest-circus: 29.7.0
+ jest-environment-node: 29.7.0
+ jest-get-type: 29.6.3
+ jest-regex-util: 29.6.3
+ jest-resolve: 29.7.0
+ jest-runner: 29.7.0
+ jest-util: 29.7.0
+ jest-validate: 29.7.0
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 29.7.0
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ optionalDependencies:
+ '@types/node': 22.18.8
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
dependencies:
'@babel/core': 7.29.0
@@ -39207,6 +39392,74 @@ snapshots:
- babel-plugin-macros
- supports-color
+ dependencies:
+ '@babel/core': 7.29.0
+ '@jest/get-type': 30.0.1
+ '@jest/pattern': 30.0.1
+ '@jest/test-sequencer': 30.0.5
+ '@jest/types': 30.0.5
+ babel-jest: 30.0.5(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 4.3.0
+ deepmerge: 4.3.1
+ glob: 10.5.0
+ graceful-fs: 4.2.11
+ jest-circus: 30.0.5
+ jest-docblock: 30.0.1
+ jest-environment-node: 30.0.5
+ jest-regex-util: 30.0.1
+ jest-resolve: 30.0.5
+ jest-runner: 30.0.5
+ jest-util: 30.0.5
+ jest-validate: 30.0.5
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 30.0.5
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ optionalDependencies:
+ '@types/node': 22.18.8
+ esbuild-register: 3.6.0([email protected])
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
+ dependencies:
+ '@babel/core': 7.29.0
+ '@jest/get-type': 30.0.1
+ '@jest/pattern': 30.0.1
+ '@jest/test-sequencer': 30.0.5
+ '@jest/types': 30.0.5
+ babel-jest: 30.0.5(@babel/[email protected])
+ chalk: 4.1.2
+ ci-info: 4.3.0
+ deepmerge: 4.3.1
+ glob: 10.5.0
+ graceful-fs: 4.2.11
+ jest-circus: 30.0.5
+ jest-docblock: 30.0.1
+ jest-environment-node: 30.0.5
+ jest-regex-util: 30.0.1
+ jest-resolve: 30.0.5
+ jest-runner: 30.0.5
+ jest-util: 30.0.5
+ jest-validate: 30.0.5
+ micromatch: 4.0.8
+ parse-json: 5.2.0
+ pretty-format: 30.0.5
+ slash: 3.0.0
+ strip-json-comments: 3.1.1
+ optionalDependencies:
+ '@types/node': 25.8.0
+ esbuild-register: 3.6.0([email protected])
+ transitivePeerDependencies:
+ - babel-plugin-macros
+ - supports-color
+
dependencies:
chalk: 4.1.2
@@ -39581,7 +39834,7 @@ snapshots:
dependencies:
expect-playwright: 0.8.0
+ jest: 29.7.0
jest-circus: 29.7.0
jest-environment-node: 29.7.0
jest-process-manager: 0.4.0
@@ -40016,7 +40269,7 @@ snapshots:
dependencies:
ansi-escapes: 6.0.0
chalk: 5.6.2
+ jest: 29.7.0
jest-regex-util: 29.6.3
jest-watcher: 29.7.0
slash: 5.1.0
@@ -40088,6 +40341,18 @@ snapshots:
- ts-node
- utf-8-validate
+ dependencies:
+ '@jest/core': 29.7.0
+ '@jest/types': 29.6.3
+ import-local: 3.2.0
+ jest-cli: 29.7.0
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - supports-color
+ - ts-node
+
dependencies:
@@ -40137,6 +40402,19 @@ snapshots:
- supports-color
- ts-node
+ dependencies:
+ '@jest/types': 30.0.5
+ import-local: 3.2.0
+ transitivePeerDependencies:
+ - '@types/node'
+ - babel-plugin-macros
+ - esbuild-register
+ - supports-color
+ - ts-node
+
@@ -40440,7 +40718,7 @@ snapshots:
less: 4.2.2
loader-utils: 2.0.4
schema-utils: 3.3.0
dependencies:
@@ -42739,7 +43017,7 @@ snapshots:
postcss: 8.5.15
schema-utils: 3.3.0
semver: 7.7.0
dependencies:
@@ -43526,7 +43804,7 @@ snapshots:
dependencies:
loader-utils: 2.0.4
schema-utils: 3.3.0
dependencies:
@@ -44569,7 +44847,7 @@ snapshots:
neo-async: 2.6.2
schema-utils: 3.3.0
semver: 7.7.0
optionalDependencies:
sass: 1.56.0
@@ -45233,11 +45511,11 @@ snapshots:
dependencies:
loader-utils: 2.0.4
schema-utils: 3.3.0
dependencies:
@@ -45602,28 +45880,26 @@ snapshots:
ansi-escapes: 4.3.2
supports-hyperlinks: 2.3.0
dependencies:
'@jridgewell/trace-mapping': 0.3.29
jest-worker: 27.5.1
schema-utils: 4.3.3
terser: 5.46.0
optionalDependencies:
'@swc/core': 1.15.18
- esbuild: 0.25.12
+ esbuild: 0.28.0
postcss: 8.5.15
dependencies:
'@jridgewell/trace-mapping': 0.3.29
jest-worker: 27.5.1
schema-utils: 4.3.3
terser: 5.46.0
optionalDependencies:
- '@swc/core': 1.15.18
- esbuild: 0.28.0
postcss: 8.5.15
@@ -46815,7 +47091,7 @@ snapshots:
import-local: 3.1.0
interpret: 3.1.1
rechoir: 0.8.0
webpack-merge: 5.8.0
@@ -46826,7 +47102,7 @@ snapshots:
range-parser: 1.2.1
schema-utils: 4.3.3
optionalDependencies:
dependencies:
@@ -46886,7 +47162,7 @@ snapshots:
- postcss
- uglify-js
dependencies:
'@types/eslint-scope': 3.7.7
'@types/estree': 1.0.8
@@ -46909,7 +47185,7 @@ snapshots:
neo-async: 2.6.2
schema-utils: 3.3.0
tapable: 2.3.0
+ terser-webpack-plugin: 5.6.0([email protected])([email protected])
watchpack: 2.5.1
webpack-sources: 3.3.4
optionalDependencies:
diff --git a/products/tracing/frontend/TracingScene.tsx b/products/tracing/frontend/TracingScene.tsx
index 4d29824b7141..29f8fc2559a5 100644
--- a/products/tracing/frontend/TracingScene.tsx
+++ b/products/tracing/frontend/TracingScene.tsx
@@ -48,7 +48,7 @@ function TracingSceneContents(): JSX.Element {
const {
rootSpans,
spansLoading,
- isTraceModalOpen,
+ isTraceOpen,
selectedTraceId,
sparklineData,
sparklineLoading,
@@ -68,8 +68,8 @@ function TracingSceneContents(): JSX.Element {
expandedSpanIds,
} = useValues(tracingSceneLogic())
const {
- openTraceModal,
- closeTraceModal,
+ openTrace,
+ closeTrace,
setDateRange,
setOverlayWindows,
openCompareFlame,
@@ -192,15 +192,16 @@ function TracingSceneContents(): JSX.Element {
// element; react-modal then scrolls it back into view when restoring focus
// on close. Blur so the restore target is <body>, which doesn't scroll.
;(document.activeElement as HTMLElement | null)?.blur?.()
- openTraceModal(span.trace_id)
+ openTrace(span.trace_id)
}}
/>
)}
</TracingSetupPrompt>
<LemonModal
- title={`Trace ${selectedTraceId}`}
- isOpen={isTraceModalOpen}
- onClose={closeTraceModal}
+ title="Trace waterfall"
+ description={selectedTraceId ? `Trace ${selectedTraceId}` : undefined}
+ isOpen={isTraceOpen}
+ onClose={closeTrace}
width="90vw"
>
<div className="relative min-h-32">
diff --git a/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.test.tsx b/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.test.tsx
new file mode 100644
index 000000000000..8c544a32fe5c
--- /dev/null
+++ b/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.test.tsx
@@ -0,0 +1,55 @@
+import { fireEvent, render } from '@testing-library/react'
+
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+
+import type { Span } from '../../types'
+import { SpanRowActions } from './SpanRowActions'
+
+jest.mock('lib/utils/copyToClipboard', () => ({
+ copyToClipboard: jest.fn(),
+}))
+
+const span = { trace_id: 'trace-abc-123', name: 'GET /api/projects' } as Span
+
+describe('SpanRowActions', () => {
+ beforeEach(() => {
+ jest.clearAllMocks()
+ })
+
+ it('renders the View trace and copy actions', () => {
+ const { container } = render(<SpanRowActions span={span} onViewTrace={jest.fn()} />)
+ expect(container.querySelector('[data-attr="tracing-view-trace"]')).toBeTruthy()
+ expect(container.querySelector('[data-attr="tracing-copy-trace-id"]')).toBeTruthy()
+ })
+
+ it('fires onViewTrace when View trace is clicked', () => {
+ const onViewTrace = jest.fn()
+ const { container } = render(<SpanRowActions span={span} onViewTrace={onViewTrace} />)
+ fireEvent.click(container.querySelector('[data-attr="tracing-view-trace"]')!)
+ expect(onViewTrace).toHaveBeenCalledTimes(1)
+ })
+
+ it('copies the trace id', () => {
+ const { container } = render(<SpanRowActions span={span} onViewTrace={jest.fn()} />)
+ fireEvent.click(container.querySelector('[data-attr="tracing-copy-trace-id"]')!)
+ expect(copyToClipboard).toHaveBeenCalledWith('trace-abc-123', 'trace ID')
+ })
+
+ // Both buttons stop propagation so a click never reaches the row's own onClick. This matters most
+ // for "View trace": in VirtualizedSpanList the row onClick and onViewTrace are the same handler, so
+ // dropping stopPropagation would open the trace modal twice on a single click.
+ it.each(['tracing-view-trace', 'tracing-copy-trace-id'])(
+ 'stops %s clicks from bubbling to the row body',
+ (dataAttr) => {
+ const onRowClick = jest.fn()
+ const { container } = render(
+ // eslint-disable-next-line jsx-a11y/no-static-element-interactions, jsx-a11y/click-events-have-key-events
+ <div onClick={onRowClick}>
+ <SpanRowActions span={span} onViewTrace={jest.fn()} />
+ </div>
+ )
+ fireEvent.click(container.querySelector(`[data-attr="${dataAttr}"]`)!)
+ expect(onRowClick).not.toHaveBeenCalled()
+ }
+ )
+})
diff --git a/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.tsx b/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.tsx
new file mode 100644
index 000000000000..e8a1de3e8410
--- /dev/null
+++ b/products/tracing/frontend/components/VirtualizedSpanList/SpanRowActions.tsx
@@ -0,0 +1,44 @@
+import { IconCopy, IconListTree } from '@posthog/icons'
+import { LemonButton } from '@posthog/lemon-ui'
+
+import { copyToClipboard } from 'lib/utils/copyToClipboard'
+
+import type { Span } from '../../types'
+
+export interface SpanRowActionsProps {
+ span: Span
+ onViewTrace: () => void
+}
+
+// Always-visible row actions. The trace schema is fixed (unlike logs' configurable columns), so a
+// dedicated actions column reads more clearly than a hover affordance.
+export function SpanRowActions({ span, onViewTrace }: SpanRowActionsProps): JSX.Element {
+ return (
+ <div className="flex items-center gap-1">
+ <LemonButton
+ size="xsmall"
+ type="secondary"
+ icon={<IconListTree />}
+ onClick={(e) => {
+ e.stopPropagation()
+ onViewTrace()
+ }}
+ tooltip="View trace waterfall"
+ data-attr="tracing-view-trace"
+ >
+ View trace
+ </LemonButton>
+ <LemonButton
+ size="xsmall"
+ icon={<IconCopy />}
+ onClick={(e) => {
+ e.stopPropagation()
+ void copyToClipboard(span.trace_id, 'trace ID')
+ }}
+ tooltip="Copy trace ID"
+ aria-label="Copy trace ID"
+ data-attr="tracing-copy-trace-id"
+ />
+ </div>
+ )
+}
diff --git a/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx b/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
index 8375b3d71c54..b6176c87244d 100644
--- a/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
+++ b/products/tracing/frontend/components/VirtualizedSpanList/VirtualizedSpanList.tsx
@@ -12,12 +12,10 @@ import { formatDuration } from '../../TraceFlameChart'
import { SPAN_KIND_LABELS, STATUS_CODE_LABELS } from '../../types'
import type { Span } from '../../types'
import { ExpandedSpanContent } from './ExpandedSpanContent'
+import { SpanRowActions } from './SpanRowActions'
const ROW_HEIGHT = 36
const HEADER_HEIGHT = 32
-// Minimum content width so the fixed columns keep a sensible size and the row scrolls
-// horizontally (rather than collapsing the name column) on narrow viewports.
-const MIN_ROW_WIDTH = 932
// Trigger the next page once the bottom of the rendered window is within this many rows of the end.
const LOAD_MORE_THRESHOLD = 10
@@ -30,8 +28,15 @@ const COL_WIDTH = {
duration: 90,
status: 80,
traceId: 140,
+ actions: 130,
} as const
+// Minimum width the flexing name column keeps before the row scrolls horizontally on narrow viewports.
+const NAME_MIN_WIDTH = 160
+// Minimum content width: every fixed column at full width plus a sensible name column. Derived so it
+// can't drift when columns are added or removed.
+const MIN_ROW_WIDTH = Object.values(COL_WIDTH).reduce((sum, width) => sum + width, 0) + NAME_MIN_WIDTH
+
function isRootSpan(span: Span): boolean {
return !span.parent_span_id
}
@@ -83,6 +88,7 @@ function SpanRowHeader(): JSX.Element {
<Cell width={COL_WIDTH.duration}>Duration</Cell>
<Cell width={COL_WIDTH.status}>Status</Cell>
<Cell width={COL_WIDTH.traceId}>Trace ID</Cell>
+ <Cell width={COL_WIDTH.actions}> </Cell>
</div>
)
}
@@ -148,6 +154,9 @@ function SpanRow({
<Cell width={COL_WIDTH.traceId}>
<span className="font-mono">{span.trace_id.substring(0, 16)}...</span>
</Cell>
+ <Cell width={COL_WIDTH.actions}>
+ <SpanRowActions span={span} onViewTrace={onClick} />
+ </Cell>
</div>
)
}
diff --git a/products/tracing/frontend/tracingSceneLogic.ts b/products/tracing/frontend/tracingSceneLogic.ts
index 83e22cd959a5..edac9075b8dc 100644
--- a/products/tracing/frontend/tracingSceneLogic.ts
+++ b/products/tracing/frontend/tracingSceneLogic.ts
@@ -59,8 +59,8 @@ export const tracingSceneLogic = kea<tracingSceneLogicType>([
actions({
toggleExpandSpan: (uuid: string) => ({ uuid }),
- openTraceModal: (traceId: string) => ({ traceId }),
- closeTraceModal: true,
+ openTrace: (traceId: string) => ({ traceId }),
+ closeTrace: true,
openCompareFlame: (spanName: string, serviceName: string) => ({ spanName, serviceName }),
closeCompareFlame: true,
syncUrlAndRunQuery: true,
@@ -87,8 +87,8 @@ export const tracingSceneLogic = kea<tracingSceneLogicType>([
selectedTraceId: [
null as string | null,
{
- openTraceModal: (_, { traceId }) => traceId,
- closeTraceModal: () => null,
+ openTrace: (_, { traceId }) => traceId,
+ closeTrace: () => null,
},
],
compareFlameSpanName: [
@@ -108,7 +108,7 @@ export const tracingSceneLogic = kea<tracingSceneLogicType>([
}),
selectors({
- isTraceModalOpen: [
+ isTraceOpen: [
(s) => [s.selectedTraceId],
(selectedTraceId: string | null): boolean => selectedTraceId !== null,
],
@@ -139,7 +139,7 @@ export const tracingSceneLogic = kea<tracingSceneLogicType>([
}),
listeners(({ actions, values }) => ({
- openTraceModal: ({ traceId }) => {
+ openTrace: ({ traceId }) => {
posthog.capture('tracing trace opened')
const prefetchedSpans = values.spans.filter((s: Span) => s.trace_id === traceId)
if (prefetchedSpans.length >= PREFETCH_SPANS) {
diff --git a/products/tracing/package.json b/products/tracing/package.json
index f54e65c13e68..26d5e1b81f18 100644
--- a/products/tracing/package.json
+++ b/products/tracing/package.json
@@ -14,6 +14,7 @@
},
"peerDependencies": {
"@posthog/icons": "*",
+ "@testing-library/react": "*",
"@types/react": "*",
"clsx": "*",
"fast-deep-equal": "*",