Skip to content

Commit d8752db

Browse files
Lms24claude
andcommitted
feat(ember): Give component definition lookups their own span op
Ember spans that resolve a component definition were using the `function` op, which infers a span description of "Function execution" and loses the component name. They now use `ui.resolve`, a new op proposed in getsentry/sentry-conventions#633. The op is hard-coded with a TODO until that lands and we can import the const. Route hook spans keep the route as `sentry.description` and are named after the hook when span streaming is on, so the name matches `code.function.name` (the `function` op's name template) in both trace lifecycles. Also converts the `ember-classic` E2E app to span streaming and turns on `enableComponentDefinitions` there, so `ui.resolve` gets covered. That flag was off in every app, so the code path had never run in CI. `ember-embroider` and `ember-vite` still cover the static lifecycle. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 1edada7 commit d8752db

11 files changed

Lines changed: 417 additions & 317 deletions

File tree

‎dev-packages/e2e-tests/test-applications/ember-classic/app/app.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import config from './config/environment';
77

88
Sentry.init({
99
dsn: config.sentryDsn,
10-
traceLifecycle: 'static',
1110
tracesSampleRate: 1,
1211
replaysSessionSampleRate: 1,
1312
replaysOnErrorSampleRate: 1,

‎dev-packages/e2e-tests/test-applications/ember-classic/app/instance-initializers/sentry-performance.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export function initialize(appInstance: ApplicationInstance): void {
55
instrumentAppInstancePerformance(appInstance, {
66
minimumRunloopQueueDuration: 0,
77
minimumComponentRenderDuration: 0,
8+
// Opt in so the E2E suite covers the `ui.resolve` spans, which are off by default.
9+
enableComponentDefinitions: true,
810
});
911
}
1012

‎dev-packages/e2e-tests/test-applications/ember-classic/tests/errors.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from '@playwright/test';
2-
import { waitForError, waitForTransaction } from '@sentry-internal/test-utils';
2+
import { getSpanOp, waitForError, waitForStreamedSpan } from '@sentry-internal/test-utils';
33

44
test('sends an error', async ({ page }) => {
55
const errorPromise = waitForError('ember-classic', async errorEvent => {
@@ -30,16 +30,17 @@ test('sends an error', async ({ page }) => {
3030
});
3131

3232
test('assigns the correct transaction value after a navigation', async ({ page }) => {
33-
const pageloadTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
34-
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
35-
});
33+
const pageloadSpanPromise = waitForStreamedSpan(
34+
'ember-classic',
35+
span => span.is_segment && getSpanOp(span) === 'pageload',
36+
);
3637

3738
const errorPromise = waitForError('ember-classic', async errorEvent => {
3839
return !errorEvent.type;
3940
});
4041

4142
await page.goto(`/tracing`);
42-
await pageloadTxnPromise;
43+
await pageloadSpanPromise;
4344

4445
await page.getByText('Errors').click();
4546

0 commit comments

Comments
 (0)