Skip to content

chore(explore): Remove TraceItemAttributeContext provider pattern#108552

Merged
nsdeschenes merged 20 commits intomasterfrom
nd/EXP-727/chore-remove-trace-item-attribute-context
Mar 4, 2026
Merged

chore(explore): Remove TraceItemAttributeContext provider pattern#108552
nsdeschenes merged 20 commits intomasterfrom
nd/EXP-727/chore-remove-trace-item-attribute-context

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Feb 19, 2026

Summary

Migrates all consumers of TraceItemAttributeProvider context to pass config directly to useTraceItemAttributes / 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

@linear
Copy link

linear bot commented Feb 19, 2026

@nsdeschenes
Copy link
Contributor Author

@sentry review

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Feb 19, 2026
@nsdeschenes
Copy link
Contributor Author

@cursor review

@nsdeschenes nsdeschenes force-pushed the nd/EXP-727/chore-remove-trace-item-attribute-context branch from 5a7161c to cb432a9 Compare February 19, 2026 19:52
@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
Copy link
Contributor Author

@cursor review

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@nsdeschenes nsdeschenes marked this pull request as ready for review February 20, 2026 16:54
@nsdeschenes nsdeschenes requested review from a team as code owners February 20, 2026 16:54
Copy link
Contributor

@DominikB2014 DominikB2014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@nsdeschenes
Copy link
Contributor Author

nsdeschenes commented Mar 3, 2026

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

Yes! this is on the books as a follow up!

Feeling like should just get this done with, going to add it in quickly.

@nsdeschenes nsdeschenes force-pushed the nd/EXP-727/chore-remove-trace-item-attribute-context branch from 771e88c to f424567 Compare March 3, 2026 16:46
@nsdeschenes nsdeschenes force-pushed the nd/EXP-727/chore-remove-trace-item-attribute-context branch from 976badd to 8dff894 Compare March 4, 2026 11:43
nsdeschenes and others added 17 commits March 4, 2026 09:49
…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
@nsdeschenes nsdeschenes force-pushed the nd/EXP-727/chore-remove-trace-item-attribute-context branch from 8dff894 to 9268456 Compare March 4, 2026 13:50
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@DominikB2014
Copy link
Contributor

lgtm!

@nsdeschenes nsdeschenes merged commit f8af911 into master Mar 4, 2026
60 checks passed
@nsdeschenes nsdeschenes deleted the nd/EXP-727/chore-remove-trace-item-attribute-context branch March 4, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants