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(aio): drop the old trace view switch (#128910)

Carlos Marchal2e4cc620dd14
diff --git a/common/storybook/storybook-timings.json b/common/storybook/storybook-timings.json
index 7d993723315f..f659f3726581 100644
--- a/common/storybook/storybook-timings.json
+++ b/common/storybook/storybook-timings.json
@@ -1867,10 +1867,6 @@
"chromium": 48.053,
"webkit": 7.33
},
- "products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.stories.tsx": {
- "chromium": 9.199,
- "webkit": 4.287
- },
"products/ai_observability/frontend/scoreDefinitions/AIObservabilityScorerScene.stories.tsx": {
"chromium": 24.229,
"webkit": 4.535
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 90b03480a2e8..c94162dfa5ef 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -10182,14 +10182,6 @@ snapshots:
hash: v1.k794b7964.c9fc72811b943c115537e635134b80a91c58a47543524d0965c42602bfdfec27.qyngZZkvl7G39BPx-HjBx7Mu-z-FmDtnmpHBAuRhg4s
scenes-app-ai-observability-trace-view-trace-view--timeline-mode--light:
hash: v1.k794b7964.a2443f5ee729993e26c5842b2f139209fcf1723ec5f5adbdfd324481b6813bbd.Saq9FjUVQPXqDnjkFCABEH-NjvGihIRi1G52alnk6_o
- scenes-app-ai-observability-trace-view-trace-view-switch--on-new-view--dark:
- hash: v1.k794b7964.705e0647746424a98de2bbf79737ac43b3f60b57ae45b8f0e5d0cb5f01226aad.vSallcE6n-MHVAkWEOsfs2D1X--pp40NBjawl5otiOk
- scenes-app-ai-observability-trace-view-trace-view-switch--on-new-view--light:
- hash: v1.k794b7964.a0a6aa1d50cf3ba8efab106b863b781ec7963f26b4ac15c081846ef1a5f26be8.FENbz_MteTxpQoOtuabm33w_0L5OXGTEPrn-PnWRpVs
- scenes-app-ai-observability-trace-view-trace-view-switch--on-old-view--dark:
- hash: v1.k794b7964.13ae77563960d8df1279788e5a1b2a17b0f38c4469bb92d3a22f3cc569903681.v3gbz8mdvwkQ2INsmiXInoQZTCBj3KGPrqcynRaxFCU
- scenes-app-ai-observability-trace-view-trace-view-switch--on-old-view--light:
- hash: v1.k794b7964.de72868c75c31f3ba3d9813b5f86064d7dbf37bc1a896b8f13032dc102758876.Xpri2jtS8YkCfKQmwMkmtGGWN8oTE_vfUOaiXtOwJK0
scenes-app-analytics--list--dark:
hash: v1.k794b7964.e692f466abc16179add1bb5dc8a717feeaf04a5b13523b0f716d6b4bb8811679.LQEOSA8cElMG8UsjhfDN9J_IgtUg02T1wq8RClGnENI
scenes-app-analytics--list--light:
diff --git a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx b/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
index fd00982abca5..1c54586a6e16 100644
--- a/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
+++ b/products/ai_observability/frontend/AIObservabilityTraceScene.tsx
@@ -97,9 +97,7 @@ import { LLMInputOutput } from './LLMInputOutput'
import { llmPersonsLazyLoaderLogic } from './llmPersonsLazyLoaderLogic'
import { normalizeMessages } from './messageNormalization'
import { openInPlayground } from './playground/llmPlaygroundPromptsLogic'
-import { TraceViewSwitch } from './redesign/trace/components/TraceViewSwitch'
import { TraceScene } from './redesign/trace/TraceScene'
-import { traceViewPreferenceLogic } from './redesign/trace/traceViewPreferenceLogic'
import { ReviewQueuePickerModal } from './reviewQueues/ReviewQueuePickerModal'
import { reviewQueuesApi } from './reviewQueues/reviewQueuesApi'
import { SearchHighlight } from './SearchHighlight'
@@ -455,19 +453,8 @@ function TraceNavigation(): JSX.Element {
}
function TraceSceneForFlag(): JSX.Element {
- const { activeView } = useValues(traceViewPreferenceLogic)
- const { switchView } = useActions(traceViewPreferenceLogic)
- if (activeView === 'legacy') {
- return <AIObservabilityTraceScene />
- }
- return (
- <>
- <div className="mb-2">
- <TraceViewSwitch view="new" onSwitch={switchView} />
- </div>
- <TraceScene />
- </>
- )
+ const { featureFlags } = useValues(featureFlagLogic)
+ return featureFlags[FEATURE_FLAGS.AI_OBSERVABILITY_TRACE_REDESIGN] ? <TraceScene /> : <AIObservabilityTraceScene />
}
export const scene: SceneExport = {
@@ -546,8 +533,6 @@ function TraceSceneWrapper(): JSX.Element {
? { name: previousQueueTraceId ? 'Previous trace' : 'Reviews', path: backPath, key: 'reviews' }
: { name: 'Traces', path: backPath, key: 'traces' }
const showTraceNavigation = !!featureFlags[FEATURE_FLAGS.LLM_ANALYTICS_TRACE_NAVIGATION]
- const { isSwitchAvailable } = useValues(traceViewPreferenceLogic)
- const { switchView } = useActions(traceViewPreferenceLogic)
return (
<>
@@ -564,12 +549,7 @@ function TraceSceneWrapper(): JSX.Element {
name={trace.id}
resourceType={{ type: 'llm_analytics' }}
forceBackTo={forceBackTo}
- actions={
- <>
- {isSwitchAvailable && <TraceViewSwitch view="legacy" onSwitch={switchView} />}
- {showTraceNavigation && <TraceNavigation />}
- </>
- }
+ actions={showTraceNavigation ? <TraceNavigation /> : undefined}
noBorder
/>
<div className="flex items-start justify-between">
diff --git a/products/ai_observability/frontend/aiObservabilityTraceLogic.test.ts b/products/ai_observability/frontend/aiObservabilityTraceLogic.test.ts
index 5bef1cc2dec4..b85da87ade92 100644
--- a/products/ai_observability/frontend/aiObservabilityTraceLogic.test.ts
+++ b/products/ai_observability/frontend/aiObservabilityTraceLogic.test.ts
@@ -12,7 +12,6 @@ import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
import { DisplayOption, TraceViewMode, aiObservabilityTraceLogic } from './aiObservabilityTraceLogic'
-import { traceViewPreferenceLogic } from './redesign/trace/traceViewPreferenceLogic'
const blankScene = (): any => ({ scene: { component: () => null, logic: null } })
const scenes: any = { AIObservabilityTrace: blankScene }
@@ -81,23 +80,6 @@ describe('aiObservabilityTraceLogic', () => {
expect(router.values.searchParams.filters).toEqual(filters)
})
- it('carries the step selected on the timeline to the new view', async () => {
- const preferenceLogic = traceViewPreferenceLogic()
- preferenceLogic.mount()
- const traceUrl = combineUrl(urls.aiObservabilityTrace('trace-1', { event: 'stale-step' }), {
- back_to: 'traces',
- })
- router.actions.push(addProjectIdIfMissing(traceUrl.url, MOCK_TEAM_ID))
- await expectLogic(logic).toFinishAllListeners()
-
- logic.actions.setEventId('timeline-step')
- preferenceLogic.actions.switchView('new')
- await expectLogic(logic).toFinishAllListeners()
-
- expect(router.values.searchParams).toMatchObject({ event: 'timeline-step', back_to: 'traces' })
- expect(logic.values.eventId).toBe('timeline-step')
- })
-
it('handles trace ID with event and timestamp parameters', async () => {
const traceIdWithColon = 'session-summary:group:16-16:81008d53ff0a708b:da6c0390-409f-485c-aab3-5e910bcf8b33'
const eventId = 'event123'
diff --git a/products/ai_observability/frontend/aiObservabilityTraceLogic.ts b/products/ai_observability/frontend/aiObservabilityTraceLogic.ts
index cec72eed0b3c..575cec5e89ec 100644
--- a/products/ai_observability/frontend/aiObservabilityTraceLogic.ts
+++ b/products/ai_observability/frontend/aiObservabilityTraceLogic.ts
@@ -35,7 +35,6 @@ import type { BranchPRMatchApi } from 'products/engineering_analytics/frontend/g
import type { FeatureFlagsSet } from '../../../frontend/src/lib/logic/featureFlagLogic'
import { aiObservabilitySharedLogic } from './aiObservabilitySharedLogic'
import { buildAiObservabilityStorageConfig } from './preferenceStorage'
-import { traceViewPreferenceLogic } from './redesign/trace/traceViewPreferenceLogic'
export enum DisplayOption {
ExpandAll = 'expand_all',
@@ -172,9 +171,6 @@ export interface aiObservabilityTraceLogicValues {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface aiObservabilityTraceLogicActions {
- switchView: (view: import('./redesign/trace/types').TraceViewChoice) => {
- view: import('./redesign/trace/types').TraceViewChoice
- } // traceViewPreferenceLogic
applySearchResults: (
inputMatches: boolean[],
outputMatches: boolean[]
@@ -383,7 +379,6 @@ export const aiObservabilityTraceLogic = kea<aiObservabilityTraceLogicType>([
aiObservabilitySharedLogic,
['dateFilter', 'propertyFilters', 'shouldFilterTestAccounts', 'shouldFilterSupportTraces'],
],
- actions: [traceViewPreferenceLogic, ['switchView']],
})),
actions({
@@ -843,14 +838,6 @@ export const aiObservabilityTraceLogic = kea<aiObservabilityTraceLogicType>([
url.searchParams.set('line', lineNumber.toString())
copyToClipboard(url.toString(), 'permalink')
},
- switchView: ({ view }) => {
- // The timeline selects a step without writing the URL, and the new view reads its step from the URL.
- const { eventId } = values
- const { pathname, searchParams, hashParams } = router.values.currentLocation
- if (view === 'new' && eventId && searchParams.event !== eventId) {
- router.actions.replace(pathname, { ...searchParams, event: eventId }, hashParams)
- }
- },
})),
subscriptions(({ actions, values }) => ({
diff --git a/products/ai_observability/frontend/redesign/trace/adapter/traceSceneWiring.test.tsx b/products/ai_observability/frontend/redesign/trace/adapter/traceSceneWiring.test.tsx
index 12474b0cda9d..067bb4918008 100644
--- a/products/ai_observability/frontend/redesign/trace/adapter/traceSceneWiring.test.tsx
+++ b/products/ai_observability/frontend/redesign/trace/adapter/traceSceneWiring.test.tsx
@@ -544,20 +544,14 @@ describe('TraceScene', () => {
return render(<TraceRoute />)
}
- it('switches to the old view and back when the flag is on', async () => {
- const { findByText } = await renderTraceRoute(true)
-
- fireEvent.click(await findByText('Switch to the old view'))
- fireEvent.click(await findByText('Switch to the new view'))
-
- expect(await findByText('Switch to the old view')).toBeTruthy()
- })
-
- it('offers no switch on the old view when the flag is off', async () => {
- const { container, queryByText } = await renderTraceRoute(false)
+ it.each([
+ ['new', true, '[data-attr="trace-view-tree-node"]', '.AIObservabilityTraceScene__wrapper'],
+ ['old', false, '.AIObservabilityTraceScene__wrapper', '[data-attr="trace-view-tree-node"]'],
+ ])('renders only the %s view when the flag is %s', async (_view, flagEnabled, shown, hidden) => {
+ const { container } = await renderTraceRoute(flagEnabled)
- await waitFor(() => expect(container.querySelector('.AIObservabilityTraceScene__wrapper')).not.toBeNull())
- expect(queryByText('Switch to the new view')).toBeNull()
+ await waitFor(() => expect(container.querySelector(shown)).not.toBeNull())
+ expect(container.querySelector(hidden)).toBeNull()
})
})
})
diff --git a/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.stories.tsx b/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.stories.tsx
deleted file mode 100644
index 08f2b7be9fd0..000000000000
--- a/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.stories.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import type { Meta, StoryObj } from '@storybook/react'
-
-import { TraceViewSwitch } from './TraceViewSwitch'
-
-const meta: Meta<typeof TraceViewSwitch> = {
- title: 'Scenes-App/AI observability/Trace view/Trace view switch',
- component: TraceViewSwitch,
- args: { onSwitch: () => {} },
-}
-export default meta
-
-type Story = StoryObj<typeof TraceViewSwitch>
-
-export const OnNewView: Story = { args: { view: 'new' } }
-
-export const OnOldView: Story = { args: { view: 'legacy' } }
diff --git a/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.tsx b/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.tsx
deleted file mode 100644
index 9bb3cae783b7..000000000000
--- a/products/ai_observability/frontend/redesign/trace/components/TraceViewSwitch.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-import { Link } from '@posthog/lemon-ui'
-
-import { TraceViewChoice } from '../types'
-
-export interface TraceViewSwitchProps {
- view: TraceViewChoice
- onSwitch: (view: TraceViewChoice) => void
-}
-
-export function TraceViewSwitch({ view, onSwitch }: TraceViewSwitchProps): JSX.Element {
- const isNewView = view === 'new'
- return (
- <div
- className="flex flex-wrap items-center justify-end gap-x-2 text-xs text-secondary"
- data-attr="trace-view-switch"
- >
- <span>{isNewView ? "You're on the new trace view." : "There's a new trace view."}</span>
- <Link
- onClick={() => onSwitch(isNewView ? 'legacy' : 'new')}
- data-attr={isNewView ? 'trace-view-switch-to-legacy' : 'trace-view-switch-to-new'}
- >
- {isNewView ? 'Switch to the old view' : 'Switch to the new view'}
- </Link>
- </div>
- )
-}
diff --git a/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.test.ts b/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.test.ts
index 6325dfbee093..56a255408f96 100644
--- a/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.test.ts
+++ b/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.test.ts
@@ -16,7 +16,6 @@ import { traceDrawerLogic } from './traceDrawerLogic'
import { withoutTraceDrawerParams } from './traceDrawerRows'
import { TraceListRow } from './traceListRows'
import { traceViewHostLogic } from './traceViewHostLogic'
-import { traceViewPreferenceLogic } from './traceViewPreferenceLogic'
jest.mock('lib/utils/product-intents', () => ({
...jest.requireActual('lib/utils/product-intents'),
@@ -354,12 +353,8 @@ describe('traceDrawerLogic', () => {
expect(host.values).toMatchObject({ requestedStepId: null, requestedTraceId: 'b' })
})
- it.each([
- ['the flag is off', (): void => undefined, false],
- ['the person is on the old view', (): void => traceViewPreferenceLogic.actions.switchView('legacy'), true],
- ])('sends a link to the trace page, without tracking, when %s', (_name, prepare, flag) => {
- setUp({ flag })
- prepare()
+ it('sends a link to the trace page, without tracking, when the flag is off', () => {
+ setUp({ flag: false })
logic.unmount()
goTo(`${LIST_PATH}?date_from=-7d&trace=a%2Fb&ts=2026-01-01&step=gen-1`)
diff --git a/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.ts b/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.ts
index f0fced988765..d16674e7599a 100644
--- a/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.ts
+++ b/products/ai_observability/frontend/redesign/trace/traceDrawerLogic.ts
@@ -16,6 +16,8 @@ import { subscriptions } from 'kea-subscriptions'
import posthog from 'posthog-js'
import { SetupTaskId, globalSetupLogic } from 'lib/components/ProductSetup'
+import { FEATURE_FLAGS } from 'lib/constants'
+import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { addProductIntent } from 'lib/utils/product-intents'
import { urls } from 'scenes/urls'
@@ -29,8 +31,6 @@ import { TRACE_DRAWER_LISTS, TraceDrawerListConfig, TraceDrawerListId } from './
import { TRACE_DRAWER_PARAMS, withoutTraceDrawerParams } from './traceDrawerRows'
import { TraceListRow, uniqueTraces } from './traceListRows'
import { traceViewHostLogic } from './traceViewHostLogic'
-import { traceViewPreferenceLogic } from './traceViewPreferenceLogic'
-import type { TraceViewChoice } from './types'
export interface TraceDrawerLogicProps {
listId: TraceDrawerListId
@@ -130,8 +130,8 @@ function trackDrawerClosed(cache: Record<string, any>): void {
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface traceDrawerLogicValues {
+ featureFlags: FeatureFlagsSet // featureFlagLogic
requestedStepId: string | null // traceViewHostLogic
- activeView: TraceViewChoice // traceViewPreferenceLogic
fullPageHref: string | null
hostId: string
isEnabled: boolean
@@ -182,7 +182,7 @@ export interface traceDrawerLogicMeta {
key: TraceDrawerListId
__keaTypeGenInternalSelectorTypes: {
hostId: (listId: TraceDrawerListId) => string
- isEnabled: (activeView: TraceViewChoice) => boolean
+ isEnabled: (featureFlags: FeatureFlagsSet) => boolean
openRef: (
location: {
hash: string
@@ -226,8 +226,8 @@ export const traceDrawerLogic = kea<traceDrawerLogicType>([
values: [
traceViewHostLogic({ hostId: traceDrawerHostId(props.listId) }),
['requestedStepId'],
- traceViewPreferenceLogic,
- ['activeView'],
+ featureFlagLogic,
+ ['featureFlags'],
],
actions: [
traceViewHostLogic({ hostId: traceDrawerHostId(props.listId) }),
@@ -250,7 +250,10 @@ export const traceDrawerLogic = kea<traceDrawerLogicType>([
}),
selectors({
hostId: [(_, p) => [p.listId], (listId: string): string => traceDrawerHostId(listId)],
- isEnabled: [(s) => [s.activeView], (activeView: TraceViewChoice): boolean => activeView === 'new'],
+ isEnabled: [
+ (s) => [s.featureFlags],
+ (featureFlags: FeatureFlagsSet): boolean => !!featureFlags[FEATURE_FLAGS.AI_OBSERVABILITY_TRACE_REDESIGN],
+ ],
openRef: [
(_, p) => [router.selectors.location, p.listId],
(
diff --git a/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.test.ts b/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.test.ts
deleted file mode 100644
index 765e27a4b06c..000000000000
--- a/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.test.ts
+++ /dev/null
@@ -1,63 +0,0 @@
-import { expectLogic } from 'kea-test-utils'
-import posthog from 'posthog-js'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-
-import { initKeaTests } from '~/test/init'
-
-import { traceViewPreferenceLogic } from './traceViewPreferenceLogic'
-import { TraceViewChoice } from './types'
-
-const FLAG = FEATURE_FLAGS.AI_OBSERVABILITY_TRACE_REDESIGN
-
-describe('traceViewPreferenceLogic', () => {
- let logic: ReturnType<typeof traceViewPreferenceLogic.build>
-
- function mountWithFlag(enabled: boolean): void {
- initKeaTests()
- featureFlagLogic.mount()
- featureFlagLogic.actions.setFeatureFlags([FLAG], { [FLAG]: enabled })
- logic = traceViewPreferenceLogic()
- logic.mount()
- }
-
- beforeEach(() => {
- localStorage.clear()
- })
-
- afterEach(() => {
- logic.unmount()
- jest.restoreAllMocks()
- })
-
- it.each<{ flag: boolean; switches: TraceViewChoice[]; activeView: TraceViewChoice; isSwitchAvailable: boolean }>([
- { flag: true, switches: [], activeView: 'new', isSwitchAvailable: true },
- { flag: true, switches: ['legacy'], activeView: 'legacy', isSwitchAvailable: true },
- { flag: true, switches: ['legacy', 'new'], activeView: 'new', isSwitchAvailable: true },
- { flag: false, switches: [], activeView: 'legacy', isSwitchAvailable: false },
- ])(
- 'shows the $activeView view when the flag is $flag after switches $switches',
- ({ flag, switches, activeView, isSwitchAvailable }) => {
- mountWithFlag(flag)
- switches.forEach((view) => logic.actions.switchView(view))
- expectLogic(logic).toMatchValues({ activeView, isSwitchAvailable })
- }
- )
-
- it('keeps the chosen view after a reload', () => {
- mountWithFlag(true)
- logic.actions.switchView('legacy')
-
- logic.unmount()
- mountWithFlag(true)
- expectLogic(logic).toMatchValues({ activeView: 'legacy' })
- })
-
- it('reports each switch with the view it switched to', () => {
- const capture = jest.spyOn(posthog, 'capture')
- mountWithFlag(true)
- logic.actions.switchView('legacy')
- expect(capture).toHaveBeenCalledWith('llma trace view switched', { to: 'legacy' })
- })
-})
diff --git a/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.ts b/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.ts
deleted file mode 100644
index a4820219de6f..000000000000
--- a/products/ai_observability/frontend/redesign/trace/traceViewPreferenceLogic.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
-import posthog from 'posthog-js'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
-
-import { TraceViewChoice } from './types'
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface traceViewPreferenceLogicValues {
- featureFlags: FeatureFlagsSet // featureFlagLogic
- activeView: TraceViewChoice
- isSwitchAvailable: boolean
- preferredView: TraceViewChoice
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface traceViewPreferenceLogicActions {
- switchView: (view: TraceViewChoice) => {
- view: TraceViewChoice
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface traceViewPreferenceLogicMeta {
- __keaTypeGenInternalSelectorTypes: {
- isSwitchAvailable: (featureFlags: FeatureFlagsSet) => boolean
- activeView: (isSwitchAvailable: boolean, preferredView: TraceViewChoice) => TraceViewChoice
- }
-}
-
-export type traceViewPreferenceLogicType = MakeLogicType<
- traceViewPreferenceLogicValues,
- traceViewPreferenceLogicActions,
- Record<string, any>,
- traceViewPreferenceLogicMeta
->
-
-export const traceViewPreferenceLogic = kea<traceViewPreferenceLogicType>([
- path(['products', 'ai_observability', 'frontend', 'redesign', 'trace', 'traceViewPreferenceLogic']),
- connect(() => ({ values: [featureFlagLogic, ['featureFlags']] })),
- actions({
- switchView: (view: TraceViewChoice) => ({ view }),
- }),
- reducers({
- preferredView: [
- 'new' as TraceViewChoice,
- // The key is fixed so that moving this logic does not reset the stored choice.
- { persist: true, storageKey: 'ai_observability.trace_view_choice' },
- {
- switchView: (_, { view }) => view,
- },
- ],
- }),
- selectors({
- isSwitchAvailable: [
- (s) => [s.featureFlags],
- (featureFlags: FeatureFlagsSet): boolean => !!featureFlags[FEATURE_FLAGS.AI_OBSERVABILITY_TRACE_REDESIGN],
- ],
- activeView: [
- (s) => [s.isSwitchAvailable, s.preferredView],
- (isSwitchAvailable: boolean, preferredView: TraceViewChoice): TraceViewChoice =>
- isSwitchAvailable ? preferredView : 'legacy',
- ],
- }),
- listeners(() => ({
- switchView: ({ view }) => {
- // A rename of this event or of the `to` property breaks every insight that filters on them.
- posthog.capture('llma trace view switched', { to: view })
- },
- })),
-])
diff --git a/products/ai_observability/frontend/redesign/trace/types.ts b/products/ai_observability/frontend/redesign/trace/types.ts
index bb60a3e3434b..5ab5119c6e41 100644
--- a/products/ai_observability/frontend/redesign/trace/types.ts
+++ b/products/ai_observability/frontend/redesign/trace/types.ts
@@ -15,8 +15,6 @@ export type TraceNodeKind = TraceNodeApi['kind']
export type TraceMode = 'spans' | 'thread' | 'timeline' | 'summary' | 'feedback'
export type TraceOpeningMode = 'summary' | null
-export type TraceViewChoice = 'new' | 'legacy'
-
export type NodeDetailTab = 'messages' | 'details' | 'evals' | 'raw'
export type LoadFailure = 'not_found' | 'failed'