ref(trace): Remove useIsEAPTraceEnabled hook and non-EAP code paths#110845
ref(trace): Remove useIsEAPTraceEnabled hook and non-EAP code paths#110845nsdeschenes merged 13 commits intomasterfrom
Conversation
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>
|
@sentry review |
|
@cursor review |
static/app/views/performance/newTraceDetails/traceModels/traceTree.incremental.spec.tsx
Show resolved
Hide resolved
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>
|
@sentry review |
|
@cursor review |
…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>
static/app/views/issueDetails/groupEventDetails/groupEventDetails.spec.tsx
Outdated
Show resolved
Hide resolved
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>
There was a problem hiding this comment.
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.
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×tamp=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×tamp=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×tamp=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×tamp=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.
static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
Show resolved
Hide resolved
…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>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
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' |
There was a problem hiding this comment.
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.
…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>



Summary
useIsEAPTraceEnabledhook that checked thetrace-spans-formatfeature flag — EAP is now the only trace code pathTraceMetatype and simplifyuseTraceMetato always use EAP endpoints (/trace-meta/) and EAP response shapetraceTypeparameter fromgetTraceQueryParams,getTargetIdParams,fetchTrace, andfetchAdditionalTraces— always use EAP endpoints (/trace/)events-trace/query fromuseTraceSampleButtonconditional inonboarding.tsxthat was gated behind the flagFrom original PR: