@sentry/replay 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -0
- package/README.md +8 -2
- package/dist/config/types/jest.setup.d.ts +1 -1
- package/dist/config/types/src/api/captureReplayEvent.d.ts +1 -1
- package/dist/config/types/src/coreHandlers/getBreadcrumbHandler.d.ts +1 -1
- package/dist/config/types/src/coreHandlers/getSpanHandler.d.ts +1 -1
- package/dist/config/types/src/coreHandlers/handleFetch.d.ts +1 -1
- package/dist/config/types/src/coreHandlers/handleHistory.d.ts +1 -1
- package/dist/config/types/src/coreHandlers/handleXhr.d.ts +1 -1
- package/dist/config/types/src/util/captureInternalException.d.ts +4 -0
- package/dist/config/types/src/util/createPayload.d.ts +1 -1
- package/dist/config/types/src/util/isSessionExpired.d.ts +1 -1
- package/dist/config/types/src/util/logger.d.ts +1 -1
- package/dist/config/types/test/mocks/mockRrweb.d.ts +1 -1
- package/dist/config/types/test/mocks/mockSdk.d.ts +2 -2
- package/dist/index.es.js +14 -4
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/types/src/api/captureReplayEvent.d.ts +1 -1
- package/dist/types/src/coreHandlers/getBreadcrumbHandler.d.ts +1 -1
- package/dist/types/src/coreHandlers/getSpanHandler.d.ts +1 -1
- package/dist/types/src/coreHandlers/handleFetch.d.ts +1 -1
- package/dist/types/src/coreHandlers/handleHistory.d.ts +1 -1
- package/dist/types/src/coreHandlers/handleXhr.d.ts +1 -1
- package/dist/types/src/util/captureInternalException.d.ts +4 -0
- package/dist/types/src/util/createPayload.d.ts +1 -1
- package/dist/types/src/util/isSessionExpired.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
File without changes
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Note: Session Replay is currently in alpha.
|
|
|
4
4
|
|
|
5
5
|
## Pre-requisites
|
|
6
6
|
|
|
7
|
-
For the sentry-replay integration to work, you must have the [Sentry browser SDK package](https://www.npmjs.com/package/@sentry/browser) (or an equivalent framework SDK e.g. [@sentry/react](https://www.npmjs.com/package/@sentry/react)) installed.
|
|
7
|
+
For the sentry-replay integration to work, you must have the [Sentry browser SDK package](https://www.npmjs.com/package/@sentry/browser) (minimum version `7.x`), or an equivalent framework SDK (e.g. [@sentry/react](https://www.npmjs.com/package/@sentry/react)) installed.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -31,7 +31,13 @@ import { Replay } from '@sentry/replay';
|
|
|
31
31
|
|
|
32
32
|
Sentry.init({
|
|
33
33
|
dsn: '__DSN__',
|
|
34
|
-
integrations: [
|
|
34
|
+
integrations: [
|
|
35
|
+
new Replay({
|
|
36
|
+
// This sets the sample rate to be 10%. You may want this to be 100% while
|
|
37
|
+
// in development and sample at a lower rate in production
|
|
38
|
+
replaysSamplingRate: 0.1,
|
|
39
|
+
})
|
|
40
|
+
],
|
|
35
41
|
// ...
|
|
36
42
|
});
|
|
37
43
|
```
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ReplayPerformanceEntry } from '
|
|
1
|
+
import { ReplayPerformanceEntry } from '../createPerformanceEntry';
|
|
2
2
|
declare type XHRSendInput = null | Blob | BufferSource | FormData | URLSearchParams | string;
|
|
3
3
|
interface SentryWrappedXMLHttpRequest extends XMLHttpRequest {
|
|
4
4
|
[key: string]: unknown;
|
|
@@ -4,8 +4,8 @@ declare const logger: {
|
|
|
4
4
|
log: (...args: any[]) => any;
|
|
5
5
|
disable(): void;
|
|
6
6
|
enable(): void;
|
|
7
|
-
info: (...args: unknown[]) => void;
|
|
8
7
|
debug: (...args: unknown[]) => void;
|
|
8
|
+
info: (...args: unknown[]) => void;
|
|
9
9
|
assert: (...args: unknown[]) => void;
|
|
10
10
|
trace: (...args: unknown[]) => void;
|
|
11
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BrowserOptions } from '@sentry/browser';
|
|
2
|
-
import { Replay } from '
|
|
3
|
-
import { ReplayConfiguration } from '
|
|
2
|
+
import { Replay } from '../../src';
|
|
3
|
+
import { ReplayConfiguration } from '../../src/types';
|
|
4
4
|
interface MockSdkParams {
|
|
5
5
|
replayOptions?: ReplayConfiguration;
|
|
6
6
|
sentryOptions?: BrowserOptions;
|
package/dist/index.es.js
CHANGED
|
@@ -123,7 +123,7 @@ function captureReplayEvent(_a) {
|
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
125
|
withScope(function (scope) {
|
|
126
|
-
scope.setTag('replay_sdk_version', "0.6.
|
|
126
|
+
scope.setTag('replay_sdk_version', "0.6.3");
|
|
127
127
|
captureEvent(__assign(__assign({
|
|
128
128
|
// @ts-expect-error replay_event is a new event type
|
|
129
129
|
type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
@@ -499,6 +499,16 @@ function getSession(_a) {
|
|
|
499
499
|
return { type: 'new', session: newSession };
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
+
/**
|
|
503
|
+
* Captures exceptions to Sentry only when it occurs on sentry.io
|
|
504
|
+
*/
|
|
505
|
+
function captureInternalException(err) {
|
|
506
|
+
if (!isInternal()) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
captureException(err);
|
|
510
|
+
}
|
|
511
|
+
|
|
502
512
|
function createPayload(_a) {
|
|
503
513
|
var events = _a.events, headers = _a.headers;
|
|
504
514
|
var payloadWithSequence;
|
|
@@ -1657,7 +1667,7 @@ var Replay = /** @class */ (function () {
|
|
|
1657
1667
|
return [3 /*break*/, 7];
|
|
1658
1668
|
case 6:
|
|
1659
1669
|
err_2 = _d.sent();
|
|
1660
|
-
|
|
1670
|
+
captureInternalException(err_2);
|
|
1661
1671
|
console.error(err_2);
|
|
1662
1672
|
return [3 /*break*/, 7];
|
|
1663
1673
|
case 7: return [2 /*return*/];
|
|
@@ -1687,7 +1697,7 @@ var Replay = /** @class */ (function () {
|
|
|
1687
1697
|
sent_at: new Date().toISOString(),
|
|
1688
1698
|
sdk: {
|
|
1689
1699
|
name: 'sentry.javascript.integration.replay',
|
|
1690
|
-
version: "0.6.
|
|
1700
|
+
version: "0.6.3",
|
|
1691
1701
|
},
|
|
1692
1702
|
}, [
|
|
1693
1703
|
[
|
|
@@ -1765,7 +1775,7 @@ var Replay = /** @class */ (function () {
|
|
|
1765
1775
|
setContext('Replays', {
|
|
1766
1776
|
retryCount: this.retryCount,
|
|
1767
1777
|
});
|
|
1768
|
-
|
|
1778
|
+
captureInternalException(new Error(UNABLE_TO_SEND_REPLAY));
|
|
1769
1779
|
// If an error happened here, it's likely that uploading the attachment
|
|
1770
1780
|
// failed, we'll can retry with the same events payload
|
|
1771
1781
|
if (this.retryCount >= MAX_RETRY_COUNT) {
|
package/dist/index.js
CHANGED
|
@@ -131,7 +131,7 @@ function captureReplayEvent(_a) {
|
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
core.withScope(function (scope) {
|
|
134
|
-
scope.setTag('replay_sdk_version', "0.6.
|
|
134
|
+
scope.setTag('replay_sdk_version', "0.6.3");
|
|
135
135
|
core.captureEvent(__assign(__assign({
|
|
136
136
|
// @ts-expect-error replay_event is a new event type
|
|
137
137
|
type: REPLAY_EVENT_NAME }, (includeReplayStartTimestamp
|
|
@@ -507,6 +507,16 @@ function getSession(_a) {
|
|
|
507
507
|
return { type: 'new', session: newSession };
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Captures exceptions to Sentry only when it occurs on sentry.io
|
|
512
|
+
*/
|
|
513
|
+
function captureInternalException(err) {
|
|
514
|
+
if (!isInternal()) {
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
517
|
+
core.captureException(err);
|
|
518
|
+
}
|
|
519
|
+
|
|
510
520
|
function createPayload(_a) {
|
|
511
521
|
var events = _a.events, headers = _a.headers;
|
|
512
522
|
var payloadWithSequence;
|
|
@@ -1665,7 +1675,7 @@ var Replay = /** @class */ (function () {
|
|
|
1665
1675
|
return [3 /*break*/, 7];
|
|
1666
1676
|
case 6:
|
|
1667
1677
|
err_2 = _d.sent();
|
|
1668
|
-
|
|
1678
|
+
captureInternalException(err_2);
|
|
1669
1679
|
console.error(err_2);
|
|
1670
1680
|
return [3 /*break*/, 7];
|
|
1671
1681
|
case 7: return [2 /*return*/];
|
|
@@ -1695,7 +1705,7 @@ var Replay = /** @class */ (function () {
|
|
|
1695
1705
|
sent_at: new Date().toISOString(),
|
|
1696
1706
|
sdk: {
|
|
1697
1707
|
name: 'sentry.javascript.integration.replay',
|
|
1698
|
-
version: "0.6.
|
|
1708
|
+
version: "0.6.3",
|
|
1699
1709
|
},
|
|
1700
1710
|
}, [
|
|
1701
1711
|
[
|
|
@@ -1773,7 +1783,7 @@ var Replay = /** @class */ (function () {
|
|
|
1773
1783
|
core.setContext('Replays', {
|
|
1774
1784
|
retryCount: this.retryCount,
|
|
1775
1785
|
});
|
|
1776
|
-
|
|
1786
|
+
captureInternalException(new Error(UNABLE_TO_SEND_REPLAY));
|
|
1777
1787
|
// If an error happened here, it's likely that uploading the attachment
|
|
1778
1788
|
// failed, we'll can retry with the same events payload
|
|
1779
1789
|
if (this.retryCount >= MAX_RETRY_COUNT) {
|