Skip to content

Commit 2cbd6b1

Browse files
committed
feat(loader): Add SENTRY_SDK_SOURCE to track loader stats
1 parent c51ed56 commit 2cbd6b1

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

packages/browser/src/loader.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
_window[_onerror] = _oldOnerror;
7171
_window[_onunhandledrejection] = _oldOnunhandledrejection;
7272

73+
// Add loader as SDK source
74+
_window.SENTRY_SDK_SOURCE = 'loader';
75+
7376
var SDK = _window[_namespace];
7477

7578
var oldInit = SDK.init;

packages/browser/test/integration/suites/loader.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,21 @@ if (IS_LOADER) {
4949
assert.equal(summary.events[0].breadcrumbs[0].message, 'testing loader');
5050
});
5151
});
52+
53+
it('should set SENTRY_SDK_SOURCE value', () => {
54+
return runInSandbox(sandbox, function () {
55+
Sentry.onLoad(function () {
56+
Sentry.init({ debug: true });
57+
});
58+
setTimeout(function () {
59+
Sentry.captureMessage('test');
60+
});
61+
undefinedMethod(); // trigger error
62+
}).then(function (summary) {
63+
if (IS_LOADER) {
64+
assert.equal(summary.events[0].sdk.packages[0].name, 'loader:@sentry/browser');
65+
}
66+
});
67+
});
5268
});
5369
}

0 commit comments

Comments
 (0)