chore(explore): Remove TraceItemAttributeContext provider pattern#108552
chore(explore): Remove TraceItemAttributeContext provider pattern#108552nsdeschenes merged 20 commits intomasterfrom
Conversation
|
@sentry review |
|
@cursor review |
5a7161c to
cb432a9
Compare
|
@sentry review |
|
@cursor review |
There was a problem hiding this comment.
lgtm! One small nit
there's a bunch of duplicate attribute configs, any thoughts if we just create a hook per trace item type i.e useLogsTraceItemAttributes({enabled: boolean = true, type: 'number' | 'string', ..., we could keep the generic one too for any dynamic use case if needed
Feeling like should just get this done with, going to add it in quickly. |
771e88c to
f424567
Compare
static/app/views/dashboards/widgetBuilder/components/newWidgetBuilder.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/components/newWidgetBuilder.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/components/newWidgetBuilder.tsx
Outdated
Show resolved
Hide resolved
static/app/views/dashboards/widgetBuilder/hooks/useWidgetBuilderTraceItemConfig.ts
Show resolved
Hide resolved
976badd to
8dff894
Compare
static/app/views/dashboards/widgetBuilder/hooks/useWidgetBuilderTraceItemConfig.ts
Show resolved
Hide resolved
…eItemAttributes Rename deprecated useTraceItemAttributesWithConfig calls to useTraceItemAttributes in all consumers and remove the deprecated export. These callers already pass config objects directly.
… directly Migrate callers that relied on TraceItemAttributeProvider context to pass TraceItemAttributeConfig directly. Move search state into toolbar components. Remove provider wrappers that only existed to serve these callers.
…plore callers Update spanTagsContext's useTraceItemTags to accept a TraceItemAttributeConfig as the first argument. Migrate all explore callers to pass config directly instead of relying on the context provider. Key changes: - spanTagsContext.tsx: require config param, pass through to useTraceItemAttributes - useSortByFields.tsx: accept config param, callers pass it - toolbar components (visualize, groupBy): move search state into component, remove TraceItemAttributeProvider wrapper - spansTabSearchSection.tsx: pass config to all useTraceItemTags calls, remove provider wrapper for cross-event search bars - tables, multiquery, and other explore callers: pass spansConfig
Create useWidgetBuilderTraceItemConfig helper hook that extracts the dataset → TraceItemAttributeConfig mapping logic from TraceItemAttributeProviderFromDataset. Migrate all widget builder consumers (visualize, groupBySelector, sortBySelector, xAxisSelector, exploreArithmeticBuilder) to use the new hook and pass config to useTraceItemTags.
…ecated code All consumers have been migrated to pass config directly. This commit: - Removes TraceItemAttributeProvider, TraceItemAttributeContext, and overload resolution helpers from traceItemAttributeContext.tsx - Simplifies useTraceItemAttributes to only accept (config, type?, hiddenKeys?) - Removes provider wrappers from spans/content.tsx, logs/content.tsx, multiQueryMode/content.tsx, newWidgetBuilder.tsx - Deletes InsightsSpanTagProvider and removes it from 6 insights consumers - Removes provider wrappers from 8 additional insights pages and metricsSection.tsx
…ppers Remove TraceItemAttributeProvider from test wrappers across all spec files. Tests already mock the /trace-items/attributes/ API endpoint, so the components' internal useTraceItemAttributes calls with config will hit those mocks directly. Also update useTraceItemTags mock signatures to match the new (config, type?, hiddenKeys?) signature.
- Add back TraceItemDataset import to logsTab.tsx (needed for config) - Add config param to useSortByFields.spec.tsx test calls
Pass the selected alert project into EAPField and include it in trace item attribute config so aggregate options stay scoped to the alert project. Also remove the now-unnecessary EAPField wrapper export. Co-authored-by: Cursor <cursoragent@cursor.com>
Clean up unnecessary React Fragment wrappers in metric rule conditions and multi-query mode tests to simplify render trees without behavior changes. Co-authored-by: Cursor <cursoragent@cursor.com>
Move dataset-specific trace item wrappers into a single context and remove spanTagsContext to cut duplicate hook layers. Migrate core dashboards, alerts, and explore callsites to wrapper hooks so trace item config boilerplate is no longer repeated. Co-Authored-By: Claude <noreply@anthropic.com> Made-with: Cursor
Replace direct useTraceItemAttributes config usage in remaining explore, logs, insights, replay, and widget builder callsites with dataset-specific wrapper hooks or useTraceItemDatasetAttributes where the dataset is dynamic. Co-Authored-By: Claude <noreply@anthropic.com> Made-with: Cursor
Update widget builder and explore specs to mock the new attribute wrapper hooks and return attribute-shaped results. This keeps tests aligned with the migrated hook APIs and removes legacy tag-hook assumptions. Co-Authored-By: Claude <noreply@anthropic.com> Made-with: Cursor
8dff894 to
9268456
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
lgtm! |
Summary
Migrates all consumers of
TraceItemAttributeProvidercontext to pass config directly touseTraceItemAttributes/useTraceItemTags, then removes the deprecated provider infrastructure entirely.This is the follow-up to #108019 (EXP-726) which added config-based overloads. This PR (EXP-727) completes the migration.
Highly recommend review with whitespace hidden.
Ticket: EXP-727