Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@ jobs:
run: yarn test:ci:browser
if: github.event_name != 'pull_request'

- name: Parse and Upload Coverage
if: cancelled() == false
continue-on-error: true
uses: getsentry/codecov-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}

job_bun_unit_tests:
name: Bun Unit Tests
needs: [job_get_metadata, job_build]
Expand Down Expand Up @@ -549,7 +556,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24, 26]
node: [18, 20, 22, 24]
steps:
- name: Check out base commit (${{ github.event.pull_request.base.sha }})
uses: actions/checkout@v6
Expand Down Expand Up @@ -581,6 +588,14 @@ jobs:
env:
NODE_VERSION: ${{ matrix.node }}

- name: Parse and Upload Coverage
if: cancelled() == false
continue-on-error: true
uses: getsentry/codecov-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.node }}

job_browser_playwright_tests:
name:
Playwright ${{ matrix.bundle }}${{ matrix.project && matrix.project != 'chromium' && format(' {0}',
Expand Down Expand Up @@ -680,6 +695,18 @@ jobs:
overwrite: true
retention-days: 7

- name: Parse and Upload Coverage
if: cancelled() == false
continue-on-error: true
uses: getsentry/codecov-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
directory: dev-packages/browser-integration-tests
enable-coverage: false
name:
browser-playwright-${{ matrix.bundle }}-${{ matrix.project }}${{ matrix.shard && format('-{0}',
matrix.shard) || '' }}

job_browser_loader_tests:
name: PW ${{ matrix.bundle }} Tests
needs: [job_get_metadata, job_build, job_build_bundles]
Expand Down Expand Up @@ -739,6 +766,16 @@ jobs:
overwrite: true
retention-days: 7

- name: Parse and Upload Coverage
uses: getsentry/codecov-action@main
if: cancelled() == false
continue-on-error: true
with:
token: ${{ secrets.GITHUB_TOKEN }}
directory: dev-packages/browser-integration-tests
enable-coverage: false
name: browser-loader-${{ matrix.bundle }}

job_check_for_faulty_dts:
name: Check for faulty .d.ts files
needs: [job_get_metadata, job_build]
Expand Down Expand Up @@ -775,7 +812,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24, 26]
node: [18, 20, 22, 24]
typescript:
- false
include:
Expand Down Expand Up @@ -816,7 +853,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24, 26]
node: [18, 20, 22, 24]
typescript:
- false
include:
Expand Down Expand Up @@ -906,7 +943,7 @@ jobs:
strategy:
fail-fast: false
matrix:
node: [18, 20, 22, 24, 26]
node: [18, 20, 22, 24]
steps:
- name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }})
uses: actions/checkout@v6
Expand All @@ -929,8 +966,9 @@ jobs:
- name: Run integration tests
env:
NODE_VERSION: ${{ matrix.node }}
working-directory: packages/remix
run: yarn test:integration
run: |
cd packages/remix
yarn test:integration:ci

job_build_tarballs:
name: Build tarballs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import Resolver from 'ember-resolver';
import config from './config/environment';

Sentry.init({
dsn: config.sentryDsn,
tracesSampleRate: 1,
replaysSessionSampleRate: 1,
replaysOnErrorSampleRate: 1,
tracePropagationTargets: ['localhost', 'doesntexist.example'],
Comment thread
cursor[bot] marked this conversation as resolved.
tunnel: `http://localhost:3031/`, // proxy server
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare const config: {
podModulePrefix: string;
locationType: 'history' | 'hash' | 'none' | 'auto';
rootURL: string;
sentryDsn: string;
APP: Record<string, unknown>;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type ApplicationInstance from '@ember/application/instance';
import { instrumentAppInstancePerformance } from '@sentry/ember';

export function initialize(appInstance: ApplicationInstance): void {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey, I am taking another look over this as we are getting closer to planning the next major, where this could go in.

Ideally, we'd align this more closely with how we handle sentry init in other places as well - which would be, to keep things centralized in Sentry.init(). Is there a way we can make this work reliably? I am thinking of something like this:

// app.ts
export default class App extends Application {
  modulePrefix = config.modulePrefix;
  podModulePrefix = config.podModulePrefix;
  Resolver = Resolver;
}

Sentry.init({
  // ...
  integrations: [
    Sentry.browserTracingIntegration({ emberApp: App })
  ]
});

and somehow derive/wrap the necessary thing inside of this? That would be the ideal solution IMHO, or something along these lines. then we can also get rid of all the async import and special options for performance etc. and just pass this directly to the (ember-specific) browser tracing integration 🤔

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or alternatively, if this cannot be made to work nicely, we could also do this in the initializer, which would be more "sentry native":

import * as Sentry from '@sentry/ember';

export function initialize(appInstance) {
  Sentry.addIntegration(Sentry.browserTracingIntegration({ 
    appInstance,
    // other options here
  }); 
}

this would possibly loose tiny bits of timing info but should overall be likely OK...

Then, we need to export a custom browserTracingIntegration from the ember package here, similar to e.g. the vue browserTracingIntegration, where we can run the actual logic.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I will look into PRing into this PR some changes for this!

instrumentAppInstancePerformance(appInstance, {
minimumRunloopQueueDuration: 0,
minimumComponentRenderDuration: 0,
});
}
Comment thread
aklkv marked this conversation as resolved.

export default {
initialize,
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,7 @@ module.exports = function (environment) {
},
};

ENV['@sentry/ember'] = {
sentry: {
tracesSampleRate: 1,
dsn: process.env.E2E_TEST_DSN,
tracePropagationTargets: ['localhost', 'doesntexist.example'],
browserTracingOptions: {
_experiments: {
// This lead to some flaky tests, as that is sometimes logged
enableLongTask: false,
},
},
},
ignoreEmberOnErrorWarning: true,
minimumRunloopQueueDuration: 0,
minimumComponentRenderDuration: 0,
};
ENV.sentryDsn = process.env.E2E_TEST_DSN;

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('sends an error', async ({ page }) => {

test('assigns the correct transaction value after a navigation', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const errorPromise = waitForError('ember-classic', async errorEvent => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { waitForTransaction } from '@sentry-internal/test-utils';

test('sends a pageload transaction with a parameterized URL', async ({ page }) => {
const transactionPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

await page.goto(`/`);
Expand All @@ -26,11 +26,11 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =

test('sends a navigation transaction with a parameterized URL', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/`);
Expand All @@ -54,11 +54,11 @@ test('sends a navigation transaction with a parameterized URL', async ({ page })

test('sends a navigation transaction even if the pageload span is still active', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/`);
Expand Down Expand Up @@ -99,11 +99,11 @@ test('sends a navigation transaction even if the pageload span is still active',

test('captures correct spans for navigation', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-classic', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/tracing`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import loadInitializers from 'ember-load-initializers';
import Resolver from 'ember-resolver';

Sentry.init({
dsn: config.sentryDsn,
tracesSampleRate: 1,
replaysSessionSampleRate: 1,
replaysOnErrorSampleRate: 1,
tracePropagationTargets: ['localhost', 'doesntexist.example'],
tunnel: `http://localhost:3031/`, // proxy server
});
export default class App extends Application {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ declare const config: {
podModulePrefix: string;
locationType: 'history' | 'hash' | 'none' | 'auto';
rootURL: string;
sentryDsn: string;
APP: Record<string, unknown>;
};

Expand Down
Comment thread
aklkv marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type ApplicationInstance from '@ember/application/instance';
import { instrumentAppInstancePerformance } from '@sentry/ember';

export function initialize(appInstance: ApplicationInstance): void {
instrumentAppInstancePerformance(appInstance, {
minimumRunloopQueueDuration: 0,
minimumComponentRenderDuration: 0,
});
}

export default {
initialize,
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,7 @@ module.exports = function (environment) {
},
};

ENV['@sentry/ember'] = {
sentry: {
tracesSampleRate: 1,
dsn: process.env.E2E_TEST_DSN,
tracePropagationTargets: ['localhost', 'doesntexist.example'],
browserTracingOptions: {
_experiments: {
// This lead to some flaky tests, as that is sometimes logged
enableLongTask: false,
},
},
},
ignoreEmberOnErrorWarning: true,
minimumRunloopQueueDuration: 0,
minimumComponentRenderDuration: 0,
};
ENV.sentryDsn = process.env.E2E_TEST_DSN;

if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test('sends an error', async ({ page }) => {

test('assigns the correct transaction value after a navigation', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const errorPromise = waitForError('ember-embroider', async errorEvent => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { waitForTransaction } from '@sentry-internal/test-utils';

test('sends a pageload transaction with a parameterized URL', async ({ page }) => {
const transactionPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

await page.goto(`/`);
Expand All @@ -26,11 +26,11 @@ test('sends a pageload transaction with a parameterized URL', async ({ page }) =

test('sends a navigation transaction with a parameterized URL', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/`);
Expand All @@ -54,11 +54,11 @@ test('sends a navigation transaction with a parameterized URL', async ({ page })

test('sends a navigation transaction even if the pageload span is still active', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/`);
Expand Down Expand Up @@ -99,11 +99,11 @@ test('sends a navigation transaction even if the pageload span is still active',

test('captures correct spans for navigation', async ({ page }) => {
const pageloadTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'pageload';
});

const navigationTxnPromise = waitForTransaction('ember-embroider', async transactionEvent => {
return !!transactionEvent?.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
return !!transactionEvent.transaction && transactionEvent.contexts?.trace?.op === 'navigation';
});

await page.goto(`/tracing`);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/test-results
/dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* This babel config is used for local tests in the e2e app.
*/
const { buildMacros } = require('@embroider/macros/babel');

const macros = buildMacros();

module.exports = {
plugins: [
[
'@babel/plugin-transform-typescript',
{
allExtensions: true,
allowDeclareFields: true,
onlyRemoveTypeImports: true,
},
],
[
'babel-plugin-ember-template-compilation',
{
transforms: [...macros.templateMacros],
},
],
[
'module:decorator-transforms',
{
runtime: {
import: require.resolve('decorator-transforms/runtime-esm'),
},
},
],
...macros.babelMacros,
],
generatorOpts: {
compact: false,
},
};
Loading
Loading