: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(tracing): add include/exclude filter buttons to span attributes (#83808)
Frank Hamand9d49ea0a74bd
diff --git a/products/tracing/frontend/TracingFilterBar.tsx b/products/tracing/frontend/TracingFilterBar.tsxindex e32e8f750795..bcb5051d12aa 100644--- a/products/tracing/frontend/TracingFilterBar.tsx+++ b/products/tracing/frontend/TracingFilterBar.tsx@@ -191,6 +191,7 @@ function TracingFilterSearch(): JSX.Element {function FilterGroupValues({ allowInitiallyOpen }: { allowInitiallyOpen: boolean }): JSX.Element | null {const { filterGroup } = useValues(universalFiltersLogic)+ const { suppressAutoOpenFilter } = useValues(tracingFiltersLogic)const { replaceGroupValue, removeGroupValue } = useActions(universalFiltersLogic)if (filterGroup.values.length === 0) {@@ -211,7 +212,11 @@ function FilterGroupValues({ allowInitiallyOpen }: { allowInitiallyOpen: booleanfilter={filterOrGroup}onRemove={() => removeGroupValue(index)}onChange={(value) => replaceGroupValue(index, value)}- initiallyOpen={allowInitiallyOpen && filterOrGroup.type != PropertyFilterType.HogQL}+ initiallyOpen={+ allowInitiallyOpen &&+ filterOrGroup.type != PropertyFilterType.HogQL &&+ filterOrGroup !== suppressAutoOpenFilter+ }/>)})}diff --git a/products/tracing/frontend/components/FacetRail/facetRailLogic.ts b/products/tracing/frontend/components/FacetRail/facetRailLogic.tsindex 26475ec30de7..f69b681893c8 100644--- a/products/tracing/frontend/components/FacetRail/facetRailLogic.ts+++ b/products/tracing/frontend/components/FacetRail/facetRailLogic.ts@@ -26,8 +26,12 @@ export interface facetRailLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface facetRailLogicActions {- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ skipQuery?: boolean | undefined+ ) => {filterGroup: UniversalFiltersGroup+ skipQuery: boolean} // tracingFiltersLogicsetServiceNames: (serviceNames: string[]) => {serviceNames: string[]diff --git a/products/tracing/frontend/components/VirtualizedSpanList/ExpandedSpanContent.tsx b/products/tracing/frontend/components/VirtualizedSpanList/ExpandedSpanContent.tsxindex 57fe6bc97a16..e968ec1773f5 100644--- a/products/tracing/frontend/components/VirtualizedSpanList/ExpandedSpanContent.tsx+++ b/products/tracing/frontend/components/VirtualizedSpanList/ExpandedSpanContent.tsx@@ -1,3 +1,5 @@+import { PropertyFilterType } from '~/types'+import { formatDuration } from '../../TraceWaterfallView'import { SPAN_KIND_LABELS, STATUS_CODE_LABELS } from '../../types'import type { Span } from '../../types'@@ -33,7 +35,12 @@ export function ExpandedSpanContent({ span, showDetails = true }: ExpandedSpanCoreturn (<div className="flex flex-col gap-2 p-2 bg-primary border-t border-border">- <SpanAttributes title="Attributes" attributes={attributes} emptyLabel="No attributes set on this span" />+ <SpanAttributes+ title="Attributes"+ attributes={attributes}+ emptyLabel="No attributes set on this span"+ propertyType={PropertyFilterType.SpanAttribute}+ />{/* Sibling section after the span attributes — same split the logs detail view uses.Often absent (non-k8s / no resource attrs), so hidden when empty to avoid noise. */}{Object.keys(span.resource_attributes ?? {}).length > 0 && (@@ -41,9 +48,10 @@ export function ExpandedSpanContent({ span, showDetails = true }: ExpandedSpanCotitle="Resource attributes"attributes={span.resource_attributes}emptyLabel="No resource attributes on this span"+ propertyType={PropertyFilterType.SpanResourceAttribute}/>)}- {showDetails && <SpanAttributes title="Span details" attributes={details} />}+ {showDetails && <SpanAttributes title="Span details" attributes={details} showFilterActions={false} />}</div>)}diff --git a/products/tracing/frontend/components/VirtualizedSpanList/SpanAttributes.tsx b/products/tracing/frontend/components/VirtualizedSpanList/SpanAttributes.tsxindex f951511de899..adcd9537249b 100644--- a/products/tracing/frontend/components/VirtualizedSpanList/SpanAttributes.tsx+++ b/products/tracing/frontend/components/VirtualizedSpanList/SpanAttributes.tsx@@ -1,26 +1,112 @@-import { LemonTable } from '@posthog/lemon-ui'+import { useActions } from 'kea'+import { useEffect, useRef, useState } from 'react'++import { IconCheck, IconMinusSquare, IconPlusSquare } from '@posthog/icons'+import { LemonButton, LemonTable } from '@posthog/lemon-ui'import { CopyToClipboardInline } from 'lib/components/CopyToClipboard'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'+import { PropertyFilterType, PropertyOperator } from '~/types'++import { tracingFiltersLogic } from 'products/tracing/frontend/tracingFiltersLogic'++const APPLIED_INDICATOR_MS = 2000+interface AttributeRow {key: stringvalue: string}+type FilterDirection = 'include' | 'exclude'+export interface SpanAttributesProps {attributes: Record<string, string>title: stringemptyLabel?: string+ /** @default true */+ showFilterActions?: boolean+ /** Required when `showFilterActions` is true. */+ propertyType?: PropertyFilterType.SpanAttribute | PropertyFilterType.SpanResourceAttribute}-// Key-value list rendering for span attributes, mirroring the Logs attribute KVP list-// (products/logs/.../LogsViewer/LogAttributes). Kept presentational for now — the filter,-// breakdown, and add-as-column actions from the logs version depend on logs-only infra.-export function SpanAttributes({ attributes, title, emptyLabel = 'No attributes' }: SpanAttributesProps): JSX.Element {+export function SpanAttributes({+ attributes,+ title,+ emptyLabel = 'No attributes',+ showFilterActions = true,+ propertyType,+}: SpanAttributesProps): JSX.Element {+ const { addFilter } = useActions(tracingFiltersLogic)+ const [appliedFilter, setAppliedFilter] = useState<{ key: string; direction: FilterDirection } | null>(null)+ const appliedFilterTimeoutRef = useRef<number | null>(null)++ useEffect(+ () => () => {+ if (appliedFilterTimeoutRef.current !== null) {+ window.clearTimeout(appliedFilterTimeoutRef.current)+ }+ },+ []+ )++ const showApplied = (key: string, direction: FilterDirection): void => {+ if (appliedFilterTimeoutRef.current !== null) {+ window.clearTimeout(appliedFilterTimeoutRef.current)+ }+ setAppliedFilter({ key, direction })+ appliedFilterTimeoutRef.current = window.setTimeout(() => setAppliedFilter(null), APPLIED_INDICATOR_MS)+ }+const rows: AttributeRow[] = Object.entries(attributes).map(([key, value]) => ({ key, value }))const columns: LemonTableColumns<AttributeRow> = [+ ...(showFilterActions+ ? [+ {+ key: 'actions',+ width: 0,+ render: (_: unknown, record: AttributeRow) => (+ <div className="flex gap-x-0">+ {appliedFilter?.key === record.key && appliedFilter.direction === 'include' ? (+ <LemonButton size="xsmall" tooltip="Filter added">+ <IconCheck className="text-success" />+ </LemonButton>+ ) : (+ <LemonButton+ tooltip="Add as filter"+ size="xsmall"+ onClick={(e) => {+ e.stopPropagation()+ addFilter(record.key, record.value, PropertyOperator.Exact, propertyType)+ showApplied(record.key, 'include')+ }}+ >+ <IconPlusSquare />+ </LemonButton>+ )}+ {appliedFilter?.key === record.key && appliedFilter.direction === 'exclude' ? (+ <LemonButton size="xsmall" tooltip="Filter added">+ <IconCheck className="text-success" />+ </LemonButton>+ ) : (+ <LemonButton+ tooltip="Exclude as filter"+ size="xsmall"+ onClick={(e) => {+ e.stopPropagation()+ addFilter(record.key, record.value, PropertyOperator.IsNot, propertyType)+ showApplied(record.key, 'exclude')+ }}+ >+ <IconMinusSquare />+ </LemonButton>+ )}+ </div>+ ),+ },+ ]+ : []),{title: 'Key',key: 'key',diff --git a/products/tracing/frontend/tracingDataLogic.test.ts b/products/tracing/frontend/tracingDataLogic.test.tsindex dfc5c1815435..e930b4c81df0 100644--- a/products/tracing/frontend/tracingDataLogic.test.ts+++ b/products/tracing/frontend/tracingDataLogic.test.ts@@ -424,4 +424,33 @@ describe('tracingDataLogic', () => {}})})++ describe('deferred filter refresh', () => {+ // The trace drawer's attribute buttons call addFilter, which sets skipQuery so the list+ // doesn't reload behind the open drawer. Losing that gate means every attribute click+ // would trigger a background re-query the user can't see.+ it('does not run the query when addFilter defers it', async () => {+ logic = mountWithSpans()+ const listSpansSpy = jest.spyOn(api.tracing, 'listSpans').mockResolvedValue({ results: [], hasMore: false })++ await expectLogic(logic, () => {+ tracingFiltersLogic().actions.addFilter('http.method', 'GET')+ }).toNotHaveDispatchedActions(['handleFilterChange', 'runQuery'])+ expect(listSpansSpy).not.toHaveBeenCalled()++ listSpansSpy.mockRestore()+ })++ it('runs the query once refreshDeferredFilters fires', async () => {+ logic = mountWithSpans()+ const listSpansSpy = jest.spyOn(api.tracing, 'listSpans').mockResolvedValue({ results: [], hasMore: false })++ await expectLogic(logic, () => {+ tracingFiltersLogic().actions.refreshDeferredFilters()+ }).toDispatchActions(['handleFilterChange', 'runQuery', 'fetchSpansSuccess'])+ expect(listSpansSpy).toHaveBeenCalled()++ listSpansSpy.mockRestore()+ })+ })})diff --git a/products/tracing/frontend/tracingDataLogic.ts b/products/tracing/frontend/tracingDataLogic.tsindex 89727d9d88c8..7f01b44a00a1 100644--- a/products/tracing/frontend/tracingDataLogic.ts+++ b/products/tracing/frontend/tracingDataLogic.ts@@ -206,6 +206,9 @@ export interface tracingDataLogicActions {flags: string[]variants: Record<string, boolean | string>} // featureFlagLogic+ refreshDeferredFilters: () => {+ value: true+ } // tracingFiltersLogicsetChartType: (chartType: import('./tracingFiltersLogic').TracingChartType) => {chartType: import('./tracingFiltersLogic').TracingChartType} // tracingFiltersLogic@@ -215,8 +218,12 @@ export interface tracingDataLogicActions {setDateRange: (dateRange: DateRange) => {dateRange: DateRange} // tracingFiltersLogic- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ skipQuery?: boolean | undefined+ ) => {filterGroup: UniversalFiltersGroup+ skipQuery: boolean} // tracingFiltersLogicsetFilters: (filters: Partial<TracingFilters>) => {filters: Partial<TracingFilters>@@ -658,6 +665,7 @@ export const tracingDataLogic = kea<tracingDataLogicType>(['setComparison','updateComparisonWindows','setFilters',+ 'refreshDeferredFilters',],featureFlagLogic,['setFeatureFlags'],@@ -1397,7 +1405,14 @@ export const tracingDataLogic = kea<tracingDataLogicType>([},setDateRange: () => actions.handleFilterChange('date_range'),setServiceNames: () => actions.handleFilterChange('service_names'),- setFilterGroup: () => actions.handleFilterChange('filter_group'),+ // skipQuery: the trace drawer's attribute buttons update the filter chips immediately but+ // queue the actual re-query for when the drawer closes — see refreshDeferredFilters.+ setFilterGroup: ({ skipQuery }) => {+ if (!skipQuery) {+ actions.handleFilterChange('filter_group')+ }+ },+ refreshDeferredFilters: () => actions.handleFilterChange('filter_group'),setSort: ({ orderBy, orderDirection }) =>actions.handleFilterChange('sort', { column: orderBy, direction: orderDirection }),setViewMode: ({ viewMode }) => actions.handleFilterChange('view_mode', { mode: viewMode }),diff --git a/products/tracing/frontend/tracingFiltersLogic.test.ts b/products/tracing/frontend/tracingFiltersLogic.test.tsindex aea8159dfbef..95d39e347f5c 100644--- a/products/tracing/frontend/tracingFiltersLogic.test.ts+++ b/products/tracing/frontend/tracingFiltersLogic.test.ts@@ -158,4 +158,51 @@ describe('tracingFiltersLogic', () => {}})})++ describe('addFilter', () => {+ it.each([+ [PropertyOperator.Exact, PropertyFilterType.SpanAttribute],+ [PropertyOperator.IsNot, PropertyFilterType.SpanResourceAttribute],+ ])('appends a %s filter of type %s to the editable filterGroup', (operator, propertyType) => {+ logic.actions.addFilter('http.method', 'GET', operator, propertyType)++ const inner = logic.values.filterGroup.values[0] as UniversalFiltersGroup+ expect(inner.values).toContainEqual({+ key: 'http.method',+ value: ['GET'],+ operator,+ type: propertyType,+ })+ })++ // The attribute buttons live inside the trace drawer — re-querying immediately would+ // reload data the drawer is covering. tracingDataLogic gates its query off this flag.+ it('marks a filter refresh as deferred instead of running the query inline', () => {+ expect(logic.values.hasDeferredFilterRefresh).toBe(false)++ logic.actions.addFilter('http.method', 'GET')++ expect(logic.values.hasDeferredFilterRefresh).toBe(true)+ })++ it('marks the newly added filter so its editor popover does not auto-open', () => {+ expect(logic.values.suppressAutoOpenFilter).toBeNull()++ logic.actions.addFilter('http.method', 'GET')++ const inner = logic.values.filterGroup.values[0] as UniversalFiltersGroup+ expect(logic.values.suppressAutoOpenFilter).toBe(inner.values[inner.values.length - 1])+ })+ })++ describe('refreshDeferredFilters', () => {+ it('clears the deferred-refresh flag set by addFilter', () => {+ logic.actions.addFilter('http.method', 'GET')+ expect(logic.values.hasDeferredFilterRefresh).toBe(true)++ logic.actions.refreshDeferredFilters()++ expect(logic.values.hasDeferredFilterRefresh).toBe(false)+ })+ })})diff --git a/products/tracing/frontend/tracingFiltersLogic.ts b/products/tracing/frontend/tracingFiltersLogic.tsindex 7659faa29cad..82dd940a5502 100644--- a/products/tracing/frontend/tracingFiltersLogic.ts+++ b/products/tracing/frontend/tracingFiltersLogic.ts@@ -1,11 +1,29 @@import { deepEqual as equal } from 'fast-equals'-import { MakeLogicType, actions, afterMount, kea, key, path, props, propsChanged, reducers, selectors } from 'kea'+import {+ MakeLogicType,+ actions,+ afterMount,+ kea,+ key,+ listeners,+ path,+ props,+ propsChanged,+ reducers,+ selectors,+} from 'kea'import { DEFAULT_UNIVERSAL_GROUP_FILTER } from 'lib/components/UniversalFilters/constants'import { dayjs } from 'lib/dayjs'import { DateRange } from '~/queries/schema/schema-general'-import { FilterLogicalOperator, UniversalFiltersGroup } from '~/types'+import {+ FilterLogicalOperator,+ PropertyFilterType,+ PropertyOperator,+ UniversalFiltersGroup,+ UniversalFiltersGroupValue,+} from '~/types'export const DEFAULT_DATE_RANGE: DateRange = { date_from: '-1h', date_to: null }export const DEFAULT_TIMEZONE: string = 'UTC'@@ -160,6 +178,7 @@ export interface tracingFiltersLogicValues {dateRange: DateRangefilterGroup: UniversalFiltersGroupfilters: TracingFilters+ hasDeferredFilterRefresh: booleanorderBy: TracingOrderByorderDirection: TracingOrderDirectionpinnedFilters: UniversalFiltersGroup | undefined@@ -167,6 +186,7 @@ export interface tracingFiltersLogicValues {queryFilterGroup: UniversalFiltersGroupserviceNames: string[]sparklineWindowMs: OverlayWindow+ suppressAutoOpenFilter: UniversalFiltersGroupValue | nulltimeComparison: TimeComparison | nulltimezone: stringutcDateRange: {@@ -178,6 +198,20 @@ export interface tracingFiltersLogicValues {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface tracingFiltersLogicActions {+ addFilter: (+ key: string,+ value: string,+ operator?: PropertyOperator,+ propertyType?: PropertyFilterType+ ) => {+ key: string+ operator: PropertyOperator+ propertyType: PropertyFilterType+ value: string+ }+ refreshDeferredFilters: () => {+ value: true+ }setChartType: (chartType: TracingChartType) => {chartType: TracingChartType}@@ -187,8 +221,12 @@ export interface tracingFiltersLogicActions {setDateRange: (dateRange: DateRange) => {dateRange: DateRange}- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ skipQuery?: boolean+ ) => {filterGroup: UniversalFiltersGroup+ skipQuery: boolean}setFilters: (filters: Partial<TracingFilters>) => {filters: Partial<TracingFilters>@@ -212,6 +250,9 @@ export interface tracingFiltersLogicActions {setViewMode: (viewMode: TracingViewMode) => {viewMode: TracingViewMode}+ suppressAutoOpenForFilter: (filter: UniversalFiltersGroupValue) => {+ filter: UniversalFiltersGroupValue+ }updateComparisonWindows: (current: OverlayWindow,previous: OverlayWindow@@ -271,7 +312,10 @@ export const tracingFiltersLogic = kea<tracingFiltersLogicType>([setDateRange: (dateRange: DateRange) => ({ dateRange }),setTimezone: (timezone: string) => ({ timezone }),setServiceNames: (serviceNames: string[]) => ({ serviceNames }),- setFilterGroup: (filterGroup: UniversalFiltersGroup) => ({ filterGroup }),+ setFilterGroup: (filterGroup: UniversalFiltersGroup, skipQuery: boolean = false) => ({+ filterGroup,+ skipQuery,+ }),setSort: (orderBy: TracingOrderBy, orderDirection: TracingOrderDirection) => ({ orderBy, orderDirection }),setViewMode: (viewMode: TracingViewMode) => ({ viewMode }),setChartType: (chartType: TracingChartType) => ({ chartType }),@@ -286,6 +330,18 @@ export const tracingFiltersLogic = kea<tracingFiltersLogicType>([// useValues without going through the kea selector input-prop machinery// (which doesn't accept optional props).setPinnedFilters: (pinnedFilters: UniversalFiltersGroup | undefined) => ({ pinnedFilters }),+ addFilter: (+ key: string,+ value: string,+ operator: PropertyOperator = PropertyOperator.Exact,+ propertyType: PropertyFilterType = PropertyFilterType.SpanAttribute+ ) => ({ key, value, operator, propertyType }),+ // The attribute row buttons insert a filter with a value already set (unlike the manual+ // "add filter" search flow, which inserts a bare property and expects its popover to stay+ // open for editing) — the UI marks that exact filter so its popover doesn't auto-open.+ suppressAutoOpenForFilter: (filter: UniversalFiltersGroupValue) => ({ filter }),+ // Fired once the trace drawer closes, if a filter was added while it was open.+ refreshDeferredFilters: true,}),reducers({@@ -372,6 +428,21 @@ export const tracingFiltersLogic = kea<tracingFiltersLogicType>([setPinnedFilters: (_, { pinnedFilters }) => pinnedFilters,},],+ suppressAutoOpenFilter: [+ null as UniversalFiltersGroupValue | null,+ {+ suppressAutoOpenForFilter: (_, { filter }) => filter,+ },+ ],+ // Set when a filter is added while the trace drawer is open (so its query is deferred);+ // cleared once that deferred query has actually run.+ hasDeferredFilterRefresh: [+ false,+ {+ addFilter: () => true,+ refreshDeferredFilters: () => false,+ },+ ],}),selectors({@@ -480,6 +551,23 @@ export const tracingFiltersLogic = kea<tracingFiltersLogicType>([],}),+ listeners(({ actions, values }) => ({+ addFilter: ({ key, value, operator, propertyType }) => {+ const currentGroup = values.filterGroup.values[0] as UniversalFiltersGroup+ const newFilterValue = { key, value: [value], operator, type: propertyType } as UniversalFiltersGroupValue++ const newGroup: UniversalFiltersGroup = {+ ...currentGroup,+ values: [...currentGroup.values, newFilterValue],+ }++ actions.suppressAutoOpenForFilter(newFilterValue)+ // Update the chips immediately, but defer the actual query — added from inside the+ // trace drawer, so re-querying now would only change data the drawer is covering.+ actions.setFilterGroup({ ...values.filterGroup, values: [newGroup] }, true)+ },+ })),+propsChanged(({ actions, props: logicProps }, oldProps) => {if (!equal(logicProps.pinnedFilters, oldProps.pinnedFilters)) {actions.setPinnedFilters(logicProps.pinnedFilters)diff --git a/products/tracing/frontend/tracingSceneLogic.ts b/products/tracing/frontend/tracingSceneLogic.tsindex bea1252d873f..2f196d47e229 100644--- a/products/tracing/frontend/tracingSceneLogic.ts+++ b/products/tracing/frontend/tracingSceneLogic.ts@@ -159,8 +159,12 @@ export interface tracingSceneLogicActions {setDateRange: (dateRange: DateRange) => {dateRange: DateRange} // tracingFiltersLogic- setFilterGroup: (filterGroup: UniversalFiltersGroup) => {+ setFilterGroup: (+ filterGroup: UniversalFiltersGroup,+ skipQuery?: boolean | undefined+ ) => {filterGroup: UniversalFiltersGroup+ skipQuery: boolean} // tracingFiltersLogicsetFilters: (filters: Partial<TracingFilters>) => {filters: Partial<TracingFilters>diff --git a/products/tracing/frontend/tracingViewerLogic.test.ts b/products/tracing/frontend/tracingViewerLogic.test.tsindex ba0b667d4f73..38fa04793f52 100644--- a/products/tracing/frontend/tracingViewerLogic.test.ts+++ b/products/tracing/frontend/tracingViewerLogic.test.ts@@ -1,8 +1,11 @@+import { expectLogic } from 'kea-test-utils'+import api from 'lib/api'import { initKeaTests } from '~/test/init'import { PREFETCH_SPANS, tracingDataLogic } from './tracingDataLogic'+import { tracingFiltersLogic } from './tracingFiltersLogic'import { tracingViewerLogic } from './tracingViewerLogic'import type { Span } from './types'@@ -59,4 +62,25 @@ describe('tracingViewerLogic', () => {expect(logic.values.selectedTraceId).toBe('trace-x')expect(getTraceSpy.mock.calls.length > 0).toBe(shouldFetch)})++ describe('closeTrace', () => {+ // The attribute buttons in the drawer queue their query for when the drawer closes.+ // Without this, closing the drawer would silently drop the filter the user just added.+ it('flushes a filter refresh queued by the drawer buttons', async () => {+ tracingFiltersLogic().actions.addFilter('http.method', 'GET')+ expect(tracingFiltersLogic().values.hasDeferredFilterRefresh).toBe(true)++ await expectLogic(logic, () => {+ logic.actions.closeTrace()+ }).toDispatchActions(['refreshDeferredFilters'])+ })++ it('does not dispatch a refresh when no filter was queued', async () => {+ expect(tracingFiltersLogic().values.hasDeferredFilterRefresh).toBe(false)++ await expectLogic(logic, () => {+ logic.actions.closeTrace()+ }).toNotHaveDispatchedActions(['refreshDeferredFilters'])+ })+ })})diff --git a/products/tracing/frontend/tracingViewerLogic.ts b/products/tracing/frontend/tracingViewerLogic.tsindex 60966264746b..181b74fec5aa 100644--- a/products/tracing/frontend/tracingViewerLogic.ts+++ b/products/tracing/frontend/tracingViewerLogic.ts@@ -17,6 +17,7 @@ export interface tracingViewerLogicValues {traceSpansHasMore: boolean // tracingDataLogictraceSpansLoading: boolean // tracingDataLogictraceSpansLoadingMore: boolean // tracingDataLogic+ hasDeferredFilterRefresh: boolean // tracingFiltersLogiccanLoadMoreTraceSpans: booleancompareFlameServiceName: string | nullcompareFlameSpanName: string | null@@ -48,6 +49,9 @@ export interface tracingViewerLogicActions {traceId: stringts?: string | null} // tracingDataLogic+ refreshDeferredFilters: () => {+ value: true+ } // tracingFiltersLogicupdateComparisonWindows: (current: OverlayWindow,previous: OverlayWindow@@ -118,12 +122,14 @@ export const tracingViewerLogic = kea<tracingViewerLogicType>([values: [tracingDataLogic({ id }),['spans', 'traceSpans', 'traceSpansLoading', 'traceSpansLoadingMore', 'traceSpansHasMore'],+ tracingFiltersLogic({ id }),+ ['hasDeferredFilterRefresh'],],actions: [tracingDataLogic({ id }),['loadTraceSpans', 'fetchSpanTree', 'fetchAggregation'],tracingFiltersLogic({ id }),- ['updateComparisonWindows'],+ ['updateComparisonWindows', 'refreshDeferredFilters'],],})),@@ -217,6 +223,13 @@ export const tracingViewerLogic = kea<tracingViewerLogicType>([}),listeners(({ actions, values }) => ({+ closeTrace: () => {+ // The attribute buttons in the drawer defer their query so the list doesn't reload+ // behind it — run it now that the drawer is closing.+ if (values.hasDeferredFilterRefresh) {+ actions.refreshDeferredFilters()+ }+ },openTrace: ({ traceId, ts }) => {posthog.capture('tracing trace opened')const prefetchedSpans = values.spans.filter((s: Span) => s.trace_id === traceId)