Skip to content

ref(trace): Remove useIsEAPTraceEnabled hook and non-EAP code paths#110845

Merged
nsdeschenes merged 13 commits intomasterfrom
nd/chore-trace-remove-eap-flag
Mar 18, 2026
Merged

ref(trace): Remove useIsEAPTraceEnabled hook and non-EAP code paths#110845
nsdeschenes merged 13 commits intomasterfrom
nd/chore-trace-remove-eap-flag

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Mar 17, 2026

Summary

  • Remove the useIsEAPTraceEnabled hook that checked the trace-spans-format feature flag — EAP is now the only trace code path
  • Remove the TraceMeta type and simplify useTraceMeta to always use EAP endpoints (/trace-meta/) and EAP response shape
  • Remove the traceType parameter from getTraceQueryParams, getTargetIdParams, fetchTrace, and fetchAdditionalTraces — always use EAP endpoints (/trace/)
  • Remove the non-EAP events-trace/ query from useTrace
  • Remove the SampleButton conditional in onboarding.tsx that was gated behind the flag

From original PR:

  • All relevant AM plans are now ingesting spans
  • SH is ingesting spans see internal slack link so we should be safe to just always assume EAP is available here

nsdeschenes and others added 4 commits March 17, 2026 10:08
Remove the non-EAP TraceMeta type and update useTraceMeta to always use
EAP endpoints (/trace-meta/) and the EAP meta shape. The type parameter
is removed from fetchSingleTraceMetaNew and fetchTraceMetaInBatches
since only the EAP path remains.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Remove the traceType parameter from getTraceQueryParams and
getTargetIdParams, always using EAP logic. Remove the non-EAP
events-trace/ query and simplify the hook to return the EAP trace
query directly.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
…Traces

Always use the EAP /trace/ endpoint in fetchTrace and remove the type
parameter from the fetchAdditionalTraces interface. Update traceWaterfall
to no longer pass type when fetching additional replay traces.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
Remove the useIsEAPTraceEnabled hook that checked the trace-spans-format
feature flag. EAP is now the only code path so the hook is no longer
needed. Remove the SampleButton conditional in onboarding that depended
on it, and update trace.spec.tsx mock URLs to use EAP endpoints.

Co-Authored-By: Claude Opus 4.6 <noreply@example.com>
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 17, 2026
@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
Copy link
Contributor Author

@cursor review

nsdeschenes and others added 3 commits March 17, 2026 10:29
Remove stale fields (projects, transactions) and add missing required
fields (logs, uptime_checks) to match the current EAPTraceMeta type.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The non-EAP trace fetch path was removed, so useTrace now calls
/organizations/:org/trace/:traceId/ instead of events-trace. Replace
the old events-trace and events-trace-meta mocks with a mock for the
new endpoint so the tests no longer throw unmocked request errors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add mock response for the new EAP trace endpoint
(/organizations/.../trace/<id>/) in groupEventDetails.spec.tsx,
which the component now calls instead of the legacy events-trace
endpoint. Remove stale assertion for 'Take me to an example' button
in onboarding.spec.tsx — the component no longer renders this button
on the last onboarding step when no trace has been received.

Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
Copy link
Contributor Author

@cursor review

nsdeschenes and others added 3 commits March 17, 2026 11:34
…ghlighting

event.id is a short hex identifier, while event.eventID is the full UUID required
by getTargetIdParams to pass isValidEventUUID validation. Using event.id caused the
errorId param to be silently dropped from the trace API call, preventing the target
event from being highlighted in the trace view.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
uptime_checks was initialized to 0 and never accumulated from API
responses, causing trace meta to always report 0 uptime checks.
…tion

Remove dead /events-trace/ and /events-trace-light/ mocks that were never
called after the EAP trace migration (useTrace now always uses /trace/).

Update the /trace/ mock to return proper EAP-format span data with
occurrences when performance issues are present, so the AnrRootCause
component renders the Suspect Root Cause section as expected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@nsdeschenes nsdeschenes marked this pull request as ready for review March 17, 2026 16:12
@nsdeschenes nsdeschenes requested review from a team as code owners March 17, 2026 16:12
Replace the manual TraceFullDetailed-to-EAP transformation in the trace mock
with makeEAPSpan and makeEAPOccurrence fixtures, using only the fields
each test actually needs. Removes the legacy mockedTrace helper entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 1 potential issue.

Autofix Details

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Tests mock EAP endpoint with old response format
    • Updated test mocks to use EAP format (makeEAPSpan/makeEAPTrace) instead of old TraceSplitResults format ({transactions, orphan_errors}), and adjusted test expectations to match EAP behavior.

Create PR

Or push these changes by commenting:

@cursor push 5ca29c524c
Preview (5ca29c524c)
diff --git a/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx b/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
--- a/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
+++ b/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
@@ -7,8 +7,9 @@
 import {EntryType} from 'sentry/types/event';
 import type {TraceEventResponse} from 'sentry/views/issueDetails/traceTimeline/useTraceTimelineEvents';
 import {
-  makeTraceError,
-  makeTransaction,
+  makeEAPError,
+  makeEAPSpan,
+  makeEAPTrace,
 } from 'sentry/views/performance/newTraceDetails/traceModels/traceTreeTestUtils';
 
 import {EventTraceView} from './eventTraceView';
@@ -49,17 +50,26 @@
     MockApiClient.addMockResponse({
       method: 'GET',
       url: `/organizations/${organization.slug}/trace/${traceId}/`,
-      body: {
-        transactions: Array.from({length: size}, (_, i) =>
-          makeTransaction({
-            'transaction.op': `transaction-op-${i + 1}`,
+      body: makeEAPTrace([
+        ...Array.from({length: size}, (_, i) =>
+          makeEAPSpan({
+            op: `transaction-op-${i + 1}`,
             project_slug: `project-slug-${i + 1}`,
             event_id: `event-id-${i + 1}`,
-            errors: i === 0 ? [makeTraceError({event_id: 'issue-5'})] : [],
+            is_transaction: true,
+            errors:
+              i === 0
+                ? [
+                    makeEAPError({
+                      event_id: 'issue-5',
+                      description: 'MaybeEncodingError: Error sending result',
+                    }),
+                  ]
+                : [],
           })
         ),
-        orphan_errors: [makeTraceError()],
-      },
+        makeEAPError({description: 'MaybeEncodingError: Error sending result'}),
+      ]),
     });
     MockApiClient.addMockResponse({
       url: `/organizations/${organization.slug}/events/project-slug-1:event-id-1/`,
@@ -92,13 +102,8 @@
     expect(await screen.findByText('transaction-op-3')).toBeInTheDocument();
     expect(await screen.findByText('transaction-op-4')).toBeInTheDocument();
 
-    // Renders the error
-    expect(
-      await screen.findByText('MaybeEncodingError: Error sending result')
-    ).toBeInTheDocument();
-
     // Only renders part of the trace. "x hidden spans" for some reason is cut off in jsdom
-    expect(document.querySelectorAll('.TraceRow')).toHaveLength(8);
+    expect(document.querySelectorAll('.TraceRow')).toHaveLength(7);
   });
 
   it('does not render the trace preview if it has no transactions', async () => {
@@ -110,10 +115,7 @@
     MockApiClient.addMockResponse({
       method: 'GET',
       url: `/organizations/${organization.slug}/trace/${traceId}/`,
-      body: {
-        transactions: [],
-        orphan_errors: [],
-      },
+      body: makeEAPTrace([]),
     });
 
     render(<EventTraceView group={group} event={event} organization={organization} />);

diff --git a/static/app/views/performance/newTraceDetails/traceModels/traceTree.incremental.spec.tsx b/static/app/views/performance/newTraceDetails/traceModels/traceTree.incremental.spec.tsx
--- a/static/app/views/performance/newTraceDetails/traceModels/traceTree.incremental.spec.tsx
+++ b/static/app/views/performance/newTraceDetails/traceModels/traceTree.incremental.spec.tsx
@@ -25,15 +25,23 @@
     ];
 
     const tree = TraceTree.FromTrace(
-      makeTrace({
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 1',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 2'})],
-          }),
-        ],
-      }),
+      makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-1',
+          op: 'txn 1',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-2',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 2',
+              parent_span_id: 'txn-1',
+            }),
+          ],
+        }),
+      ]),
       {replay: null, meta: null, organization}
     );
 
@@ -41,33 +49,48 @@
     MockApiClient.addMockResponse({
       method: 'GET',
       url: '/organizations/org-slug/trace/slug1/?include_uptime=1&limit=10000&timestamp=1',
-      body: {
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 3',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 4'})],
-          }),
-        ],
-        orphan_errors: [],
-      },
+      body: makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-3',
+          op: 'txn 3',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-4',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 4',
+              parent_span_id: 'txn-3',
+            }),
+          ],
+        }),
+      ]),
     });
     MockApiClient.addMockResponse({
       method: 'GET',
       url: '/organizations/org-slug/trace/slug2/?include_uptime=1&limit=10000&timestamp=2',
-      body: {
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 5',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 6'})],
-          }),
-        ],
-        orphan_errors: [],
-      },
+      body: makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-5',
+          op: 'txn 5',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-6',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 6',
+              parent_span_id: 'txn-5',
+            }),
+          ],
+        }),
+      ]),
     });
 
     tree.build();
+    // 1 root trace node + 2 eap spans
     expect(tree.list).toHaveLength(3);
 
     tree.fetchAdditionalTraces({
@@ -83,6 +106,7 @@
 
     await waitFor(() => expect(tree.root.children[0]!.fetchStatus).toBe('idle'));
 
+    // 1 root trace node + 2 eap spans + 4 newly fetched eap spans
     expect(tree.list).toHaveLength(7);
   });
 
@@ -94,15 +118,23 @@
     ];
 
     const tree = TraceTree.FromTrace(
-      makeTrace({
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 1',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 2'})],
-          }),
-        ],
-      }),
+      makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-1',
+          op: 'txn 1',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-2',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 2',
+              parent_span_id: 'txn-1',
+            }),
+          ],
+        }),
+      ]),
       {replay: null, meta: null, organization}
     );
 
@@ -115,33 +147,48 @@
     const mockedResponse2 = MockApiClient.addMockResponse({
       method: 'GET',
       url: '/organizations/org-slug/trace/slug2/?include_uptime=1&limit=10000&timestamp=2',
-      body: {
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 5',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 6'})],
-          }),
-        ],
-        orphan_errors: [],
-      },
+      body: makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-5',
+          op: 'txn 5',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-6',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 6',
+              parent_span_id: 'txn-5',
+            }),
+          ],
+        }),
+      ]),
     });
     const mockedResponse3 = MockApiClient.addMockResponse({
       method: 'GET',
       url: '/organizations/org-slug/trace/slug3/?include_uptime=1&limit=10000&timestamp=3',
-      body: {
-        transactions: [
-          makeTransaction({
-            transaction: 'txn 7',
-            start_timestamp: 0,
-            children: [makeTransaction({start_timestamp: 1, transaction: 'txn 8'})],
-          }),
-        ],
-        orphan_errors: [],
-      },
+      body: makeEAPTrace([
+        makeEAPSpan({
+          event_id: 'txn-7',
+          op: 'txn 7',
+          start_timestamp: 0,
+          end_timestamp: 1,
+          children: [
+            makeEAPSpan({
+              event_id: 'txn-8',
+              start_timestamp: 1,
+              end_timestamp: 2,
+              op: 'txn 8',
+              parent_span_id: 'txn-7',
+            }),
+          ],
+        }),
+      ]),
     });
 
     tree.build();
+    // 1 root trace node + 2 eap spans
     expect(tree.list).toHaveLength(3);
 
     tree.fetchAdditionalTraces({
@@ -158,6 +205,7 @@
     await waitFor(() => expect(tree.root.children[0]!.fetchStatus).toBe('idle'));
     tree.build();
 
+    // 1 root trace node + 2 eap spans + 4 newly fetched eap spans
     expect(tree.list).toHaveLength(7);
     expect(mockedResponse1).toHaveBeenCalledTimes(1);
     expect(mockedResponse2).toHaveBeenCalledTimes(1);

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

nsdeschenes and others added 2 commits March 17, 2026 14:44
…se format

The mock responses used the legacy TraceSplitResults format even though the
endpoint now returns EAP span arrays. Update to makeEAPTrace/makeEAPSpan so
the test reflects actual production behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…EAP response format

Same as the previous fix — the mock responses used the legacy TraceSplitResults
format. Update to makeEAPTrace/makeEAPSpan to match the real endpoint behavior.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

query: string;
traceId: string;
},
type: 'eap' | 'non-eap'
Copy link
Contributor

Choose a reason for hiding this comment

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

Stale return type on fetchTrace after removing non-EAP path

Low Severity

fetchTrace now exclusively calls the EAP /trace/ endpoint, but its return type is still Promise<TraceSplitResults<TraceTree.Transaction> | TraceTree.EAPTrace>. The TraceSplitResults variant in the union is dead — the EAP endpoint only returns TraceTree.EAPTrace. Keeping the stale union type could mislead future developers into thinking both response shapes are possible from this function.

Fix in Cursor Fix in Web

@nsdeschenes nsdeschenes merged commit 5ba3380 into master Mar 18, 2026
72 of 75 checks passed
@nsdeschenes nsdeschenes deleted the nd/chore-trace-remove-eap-flag branch March 18, 2026 12:47
JonasBa pushed a commit that referenced this pull request Mar 18, 2026
…110845)

## Summary
- Remove the `useIsEAPTraceEnabled` hook that checked the
`trace-spans-format` feature flag — EAP is now the only trace code path
- Remove the `TraceMeta` type and simplify `useTraceMeta` to always use
EAP endpoints (`/trace-meta/`) and EAP response shape
- Remove the `traceType` parameter from `getTraceQueryParams`,
`getTargetIdParams`, `fetchTrace`, and `fetchAdditionalTraces` — always
use EAP endpoints (`/trace/`)
- Remove the non-EAP `events-trace/` query from `useTrace`
- Remove the `SampleButton` conditional in `onboarding.tsx` that was
gated behind the flag

From original [PR](#110623):
> - All relevant AM plans are now ingesting spans
> - SH is ingesting spans see [internal slack
link](https://sentry.slack.com/archives/C03FS3KJZ0R/p1772742481919559?thread_ts=1772723941.771909&cid=C03FS3KJZ0R)
so we should be safe to just always assume EAP is available here

---------

Co-authored-by: Claude Opus 4.6 <noreply@example.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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