@newrelic/browser-agent 1.259.0 → 1.260.0
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 +13 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/session/session-entity.js +8 -1
- package/dist/cjs/common/timing/time-keeper.js +9 -30
- package/dist/cjs/features/jserrors/aggregate/index.js +1 -2
- package/dist/cjs/features/jserrors/instrument/index.js +3 -4
- package/dist/cjs/features/page_view_event/aggregate/index.js +7 -5
- package/dist/cjs/features/session_replay/shared/recorder.js +8 -1
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/session/session-entity.js +8 -1
- package/dist/esm/common/timing/time-keeper.js +9 -30
- package/dist/esm/features/jserrors/aggregate/index.js +1 -2
- package/dist/esm/features/jserrors/instrument/index.js +3 -4
- package/dist/esm/features/page_view_event/aggregate/index.js +7 -5
- package/dist/esm/features/session_replay/shared/recorder.js +8 -1
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +2 -0
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/session/session-entity.js +3 -1
- package/src/common/timing/time-keeper.js +9 -30
- package/src/features/jserrors/aggregate/index.js +1 -2
- package/src/features/jserrors/instrument/index.js +3 -4
- package/src/features/page_view_event/aggregate/index.js +8 -4
- package/src/features/session_replay/shared/recorder.js +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.260.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.259.0...v1.260.0) (2024-05-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Improve time stamping of page view events ([#1026](https://github.com/newrelic/newrelic-browser-agent/issues/1026)) ([67a658d](https://github.com/newrelic/newrelic-browser-agent/commit/67a658d2645b680a479175dff06a4fd95bd6086a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* Add internal error handler to session replay recorder ([#1029](https://github.com/newrelic/newrelic-browser-agent/issues/1029)) ([84c101c](https://github.com/newrelic/newrelic-browser-agent/commit/84c101ccbff8da207bdf215714f49b7d49941388))
|
|
17
|
+
* Adjust session entity to not race between tabs ([#1032](https://github.com/newrelic/newrelic-browser-agent/issues/1032)) ([d86becf](https://github.com/newrelic/newrelic-browser-agent/commit/d86becf2fc02aa133430332aa4e4c2bc26297750))
|
|
18
|
+
|
|
6
19
|
## [1.259.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.258.2...v1.259.0) (2024-05-08)
|
|
7
20
|
|
|
8
21
|
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.260.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.260.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -74,8 +74,15 @@ class SessionEntity {
|
|
|
74
74
|
expiresMs = _constants.DEFAULT_EXPIRES_MS,
|
|
75
75
|
inactiveMs = _constants.DEFAULT_INACTIVE_MS
|
|
76
76
|
} = _ref;
|
|
77
|
+
/** Ensure that certain properties are preserved across a reset if already set */
|
|
78
|
+
const persistentAttributes = {
|
|
79
|
+
serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff
|
|
80
|
+
};
|
|
77
81
|
this.state = {};
|
|
78
|
-
this.sync(
|
|
82
|
+
this.sync({
|
|
83
|
+
...model,
|
|
84
|
+
...persistentAttributes
|
|
85
|
+
});
|
|
79
86
|
|
|
80
87
|
// value is intended to act as the primary value of the k=v pair
|
|
81
88
|
this.state.value = value;
|
|
@@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.TimeKeeper = void 0;
|
|
7
7
|
var _runtime = require("../constants/runtime");
|
|
8
|
-
var _contextualEe = require("../event-emitter/contextual-ee");
|
|
9
8
|
var _config = require("../config/config");
|
|
10
|
-
var _constants = require("../session/constants");
|
|
11
9
|
/**
|
|
12
10
|
* Class used to adjust the timestamp of harvested data to New Relic server time. This
|
|
13
11
|
* is done by tracking the performance timings of the RUM call and applying a calculation
|
|
@@ -41,18 +39,7 @@ class TimeKeeper {
|
|
|
41
39
|
#ready = false;
|
|
42
40
|
constructor(agentIdentifier) {
|
|
43
41
|
this.#session = (0, _config.getRuntime)(agentIdentifier)?.session;
|
|
44
|
-
|
|
45
|
-
const ee = _contextualEe.ee.get(agentIdentifier);
|
|
46
|
-
ee.on(_constants.SESSION_EVENTS.UPDATE, this.#processSessionUpdate.bind(this));
|
|
47
|
-
ee.on(_constants.SESSION_EVENTS.STARTED, () => {
|
|
48
|
-
if (this.#ready) {
|
|
49
|
-
this.#session.write({
|
|
50
|
-
serverTimeDiff: this.#localTimeDiff
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
this.#processSessionUpdate(null, this.#session.read());
|
|
55
|
-
}
|
|
42
|
+
this.processStoredDiff();
|
|
56
43
|
}
|
|
57
44
|
get ready() {
|
|
58
45
|
return this.#ready;
|
|
@@ -68,8 +55,8 @@ class TimeKeeper {
|
|
|
68
55
|
* @param endTime {number} The end time of the RUM request
|
|
69
56
|
*/
|
|
70
57
|
processRumRequest(rumRequest, startTime, endTime) {
|
|
58
|
+
this.processStoredDiff();
|
|
71
59
|
if (this.#ready) return; // Server time calculated from session entity
|
|
72
|
-
|
|
73
60
|
const responseDateHeader = rumRequest.getResponseHeader('Date');
|
|
74
61
|
if (!responseDateHeader) {
|
|
75
62
|
throw new Error('Missing date header on rum response.');
|
|
@@ -80,10 +67,10 @@ class TimeKeeper {
|
|
|
80
67
|
// Corrected page origin time
|
|
81
68
|
this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
|
|
82
69
|
this.#localTimeDiff = _runtime.originTime - this.#correctedOriginTime;
|
|
83
|
-
if (
|
|
70
|
+
if (isNaN(this.#correctedOriginTime)) {
|
|
84
71
|
throw new Error('Date header invalid format.');
|
|
85
72
|
}
|
|
86
|
-
|
|
73
|
+
this.#session?.write({
|
|
87
74
|
serverTimeDiff: this.#localTimeDiff
|
|
88
75
|
});
|
|
89
76
|
this.#ready = true;
|
|
@@ -108,19 +95,11 @@ class TimeKeeper {
|
|
|
108
95
|
return Math.floor(timestamp - this.#localTimeDiff);
|
|
109
96
|
}
|
|
110
97
|
|
|
111
|
-
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
#processSessionUpdate(type, data) {
|
|
117
|
-
if (typeof data?.serverTimeDiff !== 'number') return;
|
|
118
|
-
if (!type && !this.#ready ||
|
|
119
|
-
// This captures the initial read from the session entity when the timekeeper first initializes
|
|
120
|
-
type === _constants.SESSION_EVENT_TYPES.CROSS_TAB // This captures any cross-tab write of the session entity
|
|
121
|
-
) {
|
|
122
|
-
// This captures the initial read from the session entity when the timekeeper first initializes
|
|
123
|
-
this.#localTimeDiff = data.serverTimeDiff;
|
|
98
|
+
/** Process the session entity and use the info to set the main time calculations if present */
|
|
99
|
+
processStoredDiff() {
|
|
100
|
+
const storedServerTimeDiff = this.#session?.read()?.serverTimeDiff;
|
|
101
|
+
if (typeof storedServerTimeDiff === 'number' && !isNaN(storedServerTimeDiff)) {
|
|
102
|
+
this.#localTimeDiff = storedServerTimeDiff;
|
|
124
103
|
this.#correctedOriginTime = _runtime.originTime - this.#localTimeDiff;
|
|
125
104
|
this.#ready = true;
|
|
126
105
|
}
|
|
@@ -198,8 +198,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
198
198
|
time
|
|
199
199
|
};
|
|
200
200
|
|
|
201
|
-
//
|
|
202
|
-
// and spa annotates the error with interaction info
|
|
201
|
+
// Trace sends the error in its payload, and both trace & replay simply listens for any error to occur.
|
|
203
202
|
const jsErrorEvent = [type, bucketHash, params, newMetrics, customAttributes];
|
|
204
203
|
(0, _handle.handle)('trace-jserror', jsErrorEvent, undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
|
|
205
204
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
@@ -7,7 +7,6 @@ exports.Instrument = void 0;
|
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
8
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
9
9
|
var _constants = require("../constants");
|
|
10
|
-
var _features = require("../../../loaders/features/features");
|
|
11
10
|
var _runtime = require("../../../common/constants/runtime");
|
|
12
11
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
13
12
|
var _now = require("../../../common/timing/now");
|
|
@@ -30,7 +29,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
30
29
|
} catch (e) {}
|
|
31
30
|
this.ee.on('internal-error', error => {
|
|
32
31
|
if (!this.abortHandler) return;
|
|
33
|
-
(0, _handle.handle)('ierr', [(0, _castError.castError)(error), (0, _now.now)(), true, {}, this.#replayRunning], undefined,
|
|
32
|
+
(0, _handle.handle)('ierr', [(0, _castError.castError)(error), (0, _now.now)(), true, {}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
34
33
|
});
|
|
35
34
|
this.ee.on(_constants2.SR_EVENT_EMITTER_TYPES.REPLAY_RUNNING, isRunning => {
|
|
36
35
|
this.#replayRunning = isRunning;
|
|
@@ -39,11 +38,11 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
39
38
|
if (!this.abortHandler) return;
|
|
40
39
|
(0, _handle.handle)('err', [(0, _castError.castPromiseRejectionEvent)(promiseRejectionEvent), (0, _now.now)(), false, {
|
|
41
40
|
unhandledPromiseRejection: 1
|
|
42
|
-
}, this.#replayRunning], undefined,
|
|
41
|
+
}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
43
42
|
}, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
|
|
44
43
|
_runtime.globalScope.addEventListener('error', errorEvent => {
|
|
45
44
|
if (!this.abortHandler) return;
|
|
46
|
-
(0, _handle.handle)('err', [(0, _castError.castErrorEvent)(errorEvent), (0, _now.now)(), false, {}, this.#replayRunning], undefined,
|
|
45
|
+
(0, _handle.handle)('err', [(0, _castError.castErrorEvent)(errorEvent), (0, _now.now)(), false, {}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
47
46
|
}, (0, _eventListenerOpts.eventListenerOpts)(false, this.removeOnAbort?.signal));
|
|
48
47
|
this.abortHandler = this.#abort; // we also use this as a flag to denote that the feature is active or on and handling errors
|
|
49
48
|
this.importAggregator();
|
|
@@ -32,7 +32,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
32
32
|
this.timeToFirstByte = 0;
|
|
33
33
|
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
34
34
|
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
35
|
-
|
|
35
|
+
this.timeKeeper = new _timeKeeper.TimeKeeper(this.agentIdentifier);
|
|
36
36
|
if (_runtime.isBrowserScope) {
|
|
37
37
|
_timeToFirstByte.timeToFirstByte.subscribe(_ref => {
|
|
38
38
|
let {
|
|
@@ -118,6 +118,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
118
118
|
}
|
|
119
119
|
queryParameters.fp = _firstPaint.firstPaint.current.value;
|
|
120
120
|
queryParameters.fcp = _firstContentfulPaint.firstContentfulPaint.current.value;
|
|
121
|
+
if (this.timeKeeper?.ready) {
|
|
122
|
+
queryParameters.timestamp = this.timeKeeper.convertRelativeTimestamp((0, _now.now)());
|
|
123
|
+
}
|
|
121
124
|
const rumStartTime = (0, _now.now)();
|
|
122
125
|
harvester.send({
|
|
123
126
|
endpoint: 'rum',
|
|
@@ -142,10 +145,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
142
145
|
return;
|
|
143
146
|
}
|
|
144
147
|
try {
|
|
145
|
-
|
|
146
|
-
timeKeeper.
|
|
147
|
-
|
|
148
|
-
agentRuntime.timeKeeper = timeKeeper;
|
|
148
|
+
this.timeKeeper.processRumRequest(xhr, rumStartTime, rumEndTime);
|
|
149
|
+
if (!this.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
150
|
+
agentRuntime.timeKeeper = this.timeKeeper;
|
|
149
151
|
} catch (error) {
|
|
150
152
|
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/Failed'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
151
153
|
(0, _drain.drain)(this.agentIdentifier, _features.FEATURE_NAMES.metrics, true);
|
|
@@ -101,7 +101,14 @@ class Recorder {
|
|
|
101
101
|
inlineStylesheet: inline_stylesheet,
|
|
102
102
|
inlineImages: inline_images,
|
|
103
103
|
collectFonts: collect_fonts,
|
|
104
|
-
checkoutEveryNms: _constants.CHECKOUT_MS[this.parent.mode]
|
|
104
|
+
checkoutEveryNms: _constants.CHECKOUT_MS[this.parent.mode],
|
|
105
|
+
/** Emits errors thrown by rrweb directly before bubbling them up to the window */
|
|
106
|
+
errorHandler: err => {
|
|
107
|
+
/** capture rrweb errors as "internal" errors only */
|
|
108
|
+
this.parent.ee.emit('internal-error', [err]);
|
|
109
|
+
/** returning true informs rrweb to swallow the error instead of throwing it to the window */
|
|
110
|
+
return true;
|
|
111
|
+
}
|
|
105
112
|
});
|
|
106
113
|
this.stopRecording = () => {
|
|
107
114
|
this.recording = false;
|
|
@@ -69,8 +69,15 @@ export class SessionEntity {
|
|
|
69
69
|
expiresMs = DEFAULT_EXPIRES_MS,
|
|
70
70
|
inactiveMs = DEFAULT_INACTIVE_MS
|
|
71
71
|
} = _ref;
|
|
72
|
+
/** Ensure that certain properties are preserved across a reset if already set */
|
|
73
|
+
const persistentAttributes = {
|
|
74
|
+
serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff
|
|
75
|
+
};
|
|
72
76
|
this.state = {};
|
|
73
|
-
this.sync(
|
|
77
|
+
this.sync({
|
|
78
|
+
...model,
|
|
79
|
+
...persistentAttributes
|
|
80
|
+
});
|
|
74
81
|
|
|
75
82
|
// value is intended to act as the primary value of the k=v pair
|
|
76
83
|
this.state.value = value;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { originTime } from '../constants/runtime';
|
|
2
|
-
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
3
2
|
import { getRuntime } from '../config/config';
|
|
4
|
-
import { SESSION_EVENT_TYPES, SESSION_EVENTS } from '../session/constants';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Class used to adjust the timestamp of harvested data to New Relic server time. This
|
|
@@ -36,18 +34,7 @@ export class TimeKeeper {
|
|
|
36
34
|
#ready = false;
|
|
37
35
|
constructor(agentIdentifier) {
|
|
38
36
|
this.#session = getRuntime(agentIdentifier)?.session;
|
|
39
|
-
|
|
40
|
-
const ee = baseEE.get(agentIdentifier);
|
|
41
|
-
ee.on(SESSION_EVENTS.UPDATE, this.#processSessionUpdate.bind(this));
|
|
42
|
-
ee.on(SESSION_EVENTS.STARTED, () => {
|
|
43
|
-
if (this.#ready) {
|
|
44
|
-
this.#session.write({
|
|
45
|
-
serverTimeDiff: this.#localTimeDiff
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
this.#processSessionUpdate(null, this.#session.read());
|
|
50
|
-
}
|
|
37
|
+
this.processStoredDiff();
|
|
51
38
|
}
|
|
52
39
|
get ready() {
|
|
53
40
|
return this.#ready;
|
|
@@ -63,8 +50,8 @@ export class TimeKeeper {
|
|
|
63
50
|
* @param endTime {number} The end time of the RUM request
|
|
64
51
|
*/
|
|
65
52
|
processRumRequest(rumRequest, startTime, endTime) {
|
|
53
|
+
this.processStoredDiff();
|
|
66
54
|
if (this.#ready) return; // Server time calculated from session entity
|
|
67
|
-
|
|
68
55
|
const responseDateHeader = rumRequest.getResponseHeader('Date');
|
|
69
56
|
if (!responseDateHeader) {
|
|
70
57
|
throw new Error('Missing date header on rum response.');
|
|
@@ -75,10 +62,10 @@ export class TimeKeeper {
|
|
|
75
62
|
// Corrected page origin time
|
|
76
63
|
this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
|
|
77
64
|
this.#localTimeDiff = originTime - this.#correctedOriginTime;
|
|
78
|
-
if (
|
|
65
|
+
if (isNaN(this.#correctedOriginTime)) {
|
|
79
66
|
throw new Error('Date header invalid format.');
|
|
80
67
|
}
|
|
81
|
-
|
|
68
|
+
this.#session?.write({
|
|
82
69
|
serverTimeDiff: this.#localTimeDiff
|
|
83
70
|
});
|
|
84
71
|
this.#ready = true;
|
|
@@ -103,19 +90,11 @@ export class TimeKeeper {
|
|
|
103
90
|
return Math.floor(timestamp - this.#localTimeDiff);
|
|
104
91
|
}
|
|
105
92
|
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
#processSessionUpdate(type, data) {
|
|
112
|
-
if (typeof data?.serverTimeDiff !== 'number') return;
|
|
113
|
-
if (!type && !this.#ready ||
|
|
114
|
-
// This captures the initial read from the session entity when the timekeeper first initializes
|
|
115
|
-
type === SESSION_EVENT_TYPES.CROSS_TAB // This captures any cross-tab write of the session entity
|
|
116
|
-
) {
|
|
117
|
-
// This captures the initial read from the session entity when the timekeeper first initializes
|
|
118
|
-
this.#localTimeDiff = data.serverTimeDiff;
|
|
93
|
+
/** Process the session entity and use the info to set the main time calculations if present */
|
|
94
|
+
processStoredDiff() {
|
|
95
|
+
const storedServerTimeDiff = this.#session?.read()?.serverTimeDiff;
|
|
96
|
+
if (typeof storedServerTimeDiff === 'number' && !isNaN(storedServerTimeDiff)) {
|
|
97
|
+
this.#localTimeDiff = storedServerTimeDiff;
|
|
119
98
|
this.#correctedOriginTime = originTime - this.#localTimeDiff;
|
|
120
99
|
this.#ready = true;
|
|
121
100
|
}
|
|
@@ -193,8 +193,7 @@ export class Aggregate extends AggregateBase {
|
|
|
193
193
|
time
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
//
|
|
197
|
-
// and spa annotates the error with interaction info
|
|
196
|
+
// Trace sends the error in its payload, and both trace & replay simply listens for any error to occur.
|
|
198
197
|
const jsErrorEvent = [type, bucketHash, params, newMetrics, customAttributes];
|
|
199
198
|
handle('trace-jserror', jsErrorEvent, undefined, FEATURE_NAMES.sessionTrace, this.ee);
|
|
200
199
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { handle } from '../../../common/event-emitter/handle';
|
|
7
7
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
8
8
|
import { FEATURE_NAME } from '../constants';
|
|
9
|
-
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
10
9
|
import { globalScope } from '../../../common/constants/runtime';
|
|
11
10
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
|
|
12
11
|
import { now } from '../../../common/timing/now';
|
|
@@ -24,7 +23,7 @@ export class Instrument extends InstrumentBase {
|
|
|
24
23
|
} catch (e) {}
|
|
25
24
|
this.ee.on('internal-error', error => {
|
|
26
25
|
if (!this.abortHandler) return;
|
|
27
|
-
handle('ierr', [castError(error), now(), true, {}, this.#replayRunning], undefined,
|
|
26
|
+
handle('ierr', [castError(error), now(), true, {}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
28
27
|
});
|
|
29
28
|
this.ee.on(SR_EVENT_EMITTER_TYPES.REPLAY_RUNNING, isRunning => {
|
|
30
29
|
this.#replayRunning = isRunning;
|
|
@@ -33,11 +32,11 @@ export class Instrument extends InstrumentBase {
|
|
|
33
32
|
if (!this.abortHandler) return;
|
|
34
33
|
handle('err', [castPromiseRejectionEvent(promiseRejectionEvent), now(), false, {
|
|
35
34
|
unhandledPromiseRejection: 1
|
|
36
|
-
}, this.#replayRunning], undefined,
|
|
35
|
+
}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
37
36
|
}, eventListenerOpts(false, this.removeOnAbort?.signal));
|
|
38
37
|
globalScope.addEventListener('error', errorEvent => {
|
|
39
38
|
if (!this.abortHandler) return;
|
|
40
|
-
handle('err', [castErrorEvent(errorEvent), now(), false, {}, this.#replayRunning], undefined,
|
|
39
|
+
handle('err', [castErrorEvent(errorEvent), now(), false, {}, this.#replayRunning], undefined, this.featureName, this.ee);
|
|
41
40
|
}, eventListenerOpts(false, this.removeOnAbort?.signal));
|
|
42
41
|
this.abortHandler = this.#abort; // we also use this as a flag to denote that the feature is active or on and handling errors
|
|
43
42
|
this.importAggregator();
|
|
@@ -24,7 +24,7 @@ export class Aggregate extends AggregateBase {
|
|
|
24
24
|
this.timeToFirstByte = 0;
|
|
25
25
|
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
26
26
|
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
27
|
-
|
|
27
|
+
this.timeKeeper = new TimeKeeper(this.agentIdentifier);
|
|
28
28
|
if (isBrowserScope) {
|
|
29
29
|
timeToFirstByte.subscribe(_ref => {
|
|
30
30
|
let {
|
|
@@ -110,6 +110,9 @@ export class Aggregate extends AggregateBase {
|
|
|
110
110
|
}
|
|
111
111
|
queryParameters.fp = firstPaint.current.value;
|
|
112
112
|
queryParameters.fcp = firstContentfulPaint.current.value;
|
|
113
|
+
if (this.timeKeeper?.ready) {
|
|
114
|
+
queryParameters.timestamp = this.timeKeeper.convertRelativeTimestamp(now());
|
|
115
|
+
}
|
|
113
116
|
const rumStartTime = now();
|
|
114
117
|
harvester.send({
|
|
115
118
|
endpoint: 'rum',
|
|
@@ -134,10 +137,9 @@ export class Aggregate extends AggregateBase {
|
|
|
134
137
|
return;
|
|
135
138
|
}
|
|
136
139
|
try {
|
|
137
|
-
|
|
138
|
-
timeKeeper.
|
|
139
|
-
|
|
140
|
-
agentRuntime.timeKeeper = timeKeeper;
|
|
140
|
+
this.timeKeeper.processRumRequest(xhr, rumStartTime, rumEndTime);
|
|
141
|
+
if (!this.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
142
|
+
agentRuntime.timeKeeper = this.timeKeeper;
|
|
141
143
|
} catch (error) {
|
|
142
144
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/Failed'], undefined, FEATURE_NAMES.metrics, this.ee);
|
|
143
145
|
drain(this.agentIdentifier, FEATURE_NAMES.metrics, true);
|
|
@@ -95,7 +95,14 @@ export class Recorder {
|
|
|
95
95
|
inlineStylesheet: inline_stylesheet,
|
|
96
96
|
inlineImages: inline_images,
|
|
97
97
|
collectFonts: collect_fonts,
|
|
98
|
-
checkoutEveryNms: CHECKOUT_MS[this.parent.mode]
|
|
98
|
+
checkoutEveryNms: CHECKOUT_MS[this.parent.mode],
|
|
99
|
+
/** Emits errors thrown by rrweb directly before bubbling them up to the window */
|
|
100
|
+
errorHandler: err => {
|
|
101
|
+
/** capture rrweb errors as "internal" errors only */
|
|
102
|
+
this.parent.ee.emit('internal-error', [err]);
|
|
103
|
+
/** returning true informs rrweb to swallow the error instead of throwing it to the window */
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
99
106
|
});
|
|
100
107
|
this.stopRecording = () => {
|
|
101
108
|
this.recording = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AA8BA;IACE;;;;;OAKG;IACH,uBA0BC;IApBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAenC;;;;
|
|
1
|
+
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":"AA8BA;IACE;;;;;OAKG;IACH,uBA0BC;IApBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAenC;;;;aA4EC;IAnEC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAkBsC;IAexC,iCAAuB;IAKzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAkBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAUC;IAED,6DAIC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBAzSqB,gBAAgB;iCAGL,4BAA4B"}
|
|
@@ -27,6 +27,8 @@ export class TimeKeeper {
|
|
|
27
27
|
* @return {number} Corrected unix/epoch timestamp
|
|
28
28
|
*/
|
|
29
29
|
correctAbsoluteTimestamp(timestamp: number): number;
|
|
30
|
+
/** Process the session entity and use the info to set the main time calculations if present */
|
|
31
|
+
processStoredDiff(): void;
|
|
30
32
|
#private;
|
|
31
33
|
}
|
|
32
34
|
//# sourceMappingURL=time-keeper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-keeper.d.ts","sourceRoot":"","sources":["../../../../src/common/timing/time-keeper.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"time-keeper.d.ts","sourceRoot":"","sources":["../../../../src/common/timing/time-keeper.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH;IA2BE,kCAGC;IAED,oBAEC;IAED,kCAEC;IAED;;;;;OAKG;IACH,8BAJsB,cAAc,aACf,MAAM,WACR,MAAM,QAuBxB;IAED;;;;;OAKG;IACH,uCAHwB,MAAM,GACjB,MAAM,CAIlB;IAED;;;;OAIG;IACH,oCAHqB,MAAM,GACf,MAAM,CAIjB;IAED,+FAA+F;IAC/F,0BAOC;;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"AAyBA;;GAEG;AAEH;IACE,2BAAiC;IACjC,mDAgCC;IA7BC,kBAAuB;IACvB,eAAoB;IACpB,qBAA0B;IAC1B,2BAAgC;IAChC,mCAA4B;IAC5B,qBAAwB;IA0B1B;;;MAwBC;IAED,qCAWC;IAED,8BAEC;IAED,oEAMC;IAED;;;;;;OAMG;IACH,qCAHW,SAAS,GACP,MAAM,CAgBlB;IAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"AAyBA;;GAEG;AAEH;IACE,2BAAiC;IACjC,mDAgCC;IA7BC,kBAAuB;IACvB,eAAoB;IACpB,qBAA0B;IAC1B,2BAAgC;IAChC,mCAA4B;IAC5B,qBAAwB;IA0B1B;;;MAwBC;IAED,qCAWC;IAED,8BAEC;IAED,oEAMC;IAED;;;;;;OAMG;IACH,qCAHW,SAAS,GACP,MAAM,CAgBlB;IAED,4FA4FC;IA4BD,yDA6BC;IAED,qFAOC;;CAwBF;wBAvSY,OAAO,0BAA0B,EAAE,SAAS;8BAN3B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/instrument/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/instrument/index.js"],"names":[],"mappings":"AAcA;IACE,2BAAiC;IAIjC,mEA6BC;IAxBG,2CAA0C;IAsB5C,yBAA+B;;CASlC;+BAjD8B,6BAA6B"}
|
|
@@ -4,7 +4,9 @@ export class Aggregate extends AggregateBase {
|
|
|
4
4
|
timeToFirstByte: number;
|
|
5
5
|
firstByteToWindowLoad: number;
|
|
6
6
|
firstByteToDomContent: number;
|
|
7
|
+
timeKeeper: TimeKeeper;
|
|
7
8
|
sendRum(): void;
|
|
8
9
|
}
|
|
9
10
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
11
|
+
import { TimeKeeper } from '../../../common/timing/time-keeper';
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAA2C;IAC3C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAA2C;IAC3C,mDAqBC;IAlBC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IAC9B,uBAAsD;IAiBxD,gBAsGC;CACF;8BA3I6B,4BAA4B;2BAS/B,oCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAYA;IAUE,yBAkBC;IAdC,iEAAiE;IACjE,mBAAsB;IACtB,6DAA6D;IAC7D,oCAAuC;IACvC,kIAAkI;IAClI,kBAAqB;IACrB,sDAAsD;IACtD,YAAoB;IACpB,oEAAoE;IACpE,6BAAqH;IACrH,0FAA0F;IAC1F,eAA6C;IAC7C,uIAAuI;IACvI,0BAAyE;IAG3E;;;;;;;;;MAYC;IAED,mFAAmF;IACnF,oBAKC;IAED,qDAAqD;IACrD,
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAYA;IAUE,yBAkBC;IAdC,iEAAiE;IACjE,mBAAsB;IACtB,6DAA6D;IAC7D,oCAAuC;IACvC,kIAAkI;IAClI,kBAAqB;IACrB,sDAAsD;IACtD,YAAoB;IACpB,oEAAoE;IACpE,6BAAqH;IACrH,0FAA0F;IAC1F,eAA6C;IAC7C,uIAAuI;IACvI,0BAAyE;IAG3E;;;;;;;;;MAYC;IAED,mFAAmF;IACnF,oBAKC;IAED,qDAAqD;IACrD,uBAsCC;IAED;;;;;OAKG;IACH,yCA0BC;IAED,0HAA0H;IAC1H,yCAqDC;IA3CG,8BAAoB;IA6CxB,0HAA0H;IAC1H,yBAOC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED;;;SAGK;IACL,oCAGC;;CACF;+BA3N8B,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -64,8 +64,10 @@ export class SessionEntity {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
setup ({ value = generateRandomHexString(16), expiresMs = DEFAULT_EXPIRES_MS, inactiveMs = DEFAULT_INACTIVE_MS }) {
|
|
67
|
+
/** Ensure that certain properties are preserved across a reset if already set */
|
|
68
|
+
const persistentAttributes = { serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff }
|
|
67
69
|
this.state = {}
|
|
68
|
-
this.sync(model)
|
|
70
|
+
this.sync({ ...model, ...persistentAttributes })
|
|
69
71
|
|
|
70
72
|
// value is intended to act as the primary value of the k=v pair
|
|
71
73
|
this.state.value = value
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { originTime } from '../constants/runtime'
|
|
2
|
-
import { ee as baseEE } from '../event-emitter/contextual-ee'
|
|
3
2
|
import { getRuntime } from '../config/config'
|
|
4
|
-
import { SESSION_EVENT_TYPES, SESSION_EVENTS } from '../session/constants'
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
* Class used to adjust the timestamp of harvested data to New Relic server time. This
|
|
@@ -37,17 +35,7 @@ export class TimeKeeper {
|
|
|
37
35
|
|
|
38
36
|
constructor (agentIdentifier) {
|
|
39
37
|
this.#session = getRuntime(agentIdentifier)?.session
|
|
40
|
-
|
|
41
|
-
if (this.#session) {
|
|
42
|
-
const ee = baseEE.get(agentIdentifier)
|
|
43
|
-
ee.on(SESSION_EVENTS.UPDATE, this.#processSessionUpdate.bind(this))
|
|
44
|
-
ee.on(SESSION_EVENTS.STARTED, () => {
|
|
45
|
-
if (this.#ready) {
|
|
46
|
-
this.#session.write({ serverTimeDiff: this.#localTimeDiff })
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
this.#processSessionUpdate(null, this.#session.read())
|
|
50
|
-
}
|
|
38
|
+
this.processStoredDiff()
|
|
51
39
|
}
|
|
52
40
|
|
|
53
41
|
get ready () {
|
|
@@ -65,8 +53,8 @@ export class TimeKeeper {
|
|
|
65
53
|
* @param endTime {number} The end time of the RUM request
|
|
66
54
|
*/
|
|
67
55
|
processRumRequest (rumRequest, startTime, endTime) {
|
|
56
|
+
this.processStoredDiff()
|
|
68
57
|
if (this.#ready) return // Server time calculated from session entity
|
|
69
|
-
|
|
70
58
|
const responseDateHeader = rumRequest.getResponseHeader('Date')
|
|
71
59
|
if (!responseDateHeader) {
|
|
72
60
|
throw new Error('Missing date header on rum response.')
|
|
@@ -79,11 +67,11 @@ export class TimeKeeper {
|
|
|
79
67
|
this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset)
|
|
80
68
|
this.#localTimeDiff = originTime - this.#correctedOriginTime
|
|
81
69
|
|
|
82
|
-
if (
|
|
70
|
+
if (isNaN(this.#correctedOriginTime)) {
|
|
83
71
|
throw new Error('Date header invalid format.')
|
|
84
72
|
}
|
|
85
73
|
|
|
86
|
-
|
|
74
|
+
this.#session?.write({ serverTimeDiff: this.#localTimeDiff })
|
|
87
75
|
this.#ready = true
|
|
88
76
|
}
|
|
89
77
|
|
|
@@ -106,20 +94,11 @@ export class TimeKeeper {
|
|
|
106
94
|
return Math.floor(timestamp - this.#localTimeDiff)
|
|
107
95
|
}
|
|
108
96
|
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
#processSessionUpdate (type, data) {
|
|
115
|
-
if (typeof data?.serverTimeDiff !== 'number') return
|
|
116
|
-
|
|
117
|
-
if (
|
|
118
|
-
(!type && !this.#ready) || // This captures the initial read from the session entity when the timekeeper first initializes
|
|
119
|
-
type === SESSION_EVENT_TYPES.CROSS_TAB // This captures any cross-tab write of the session entity
|
|
120
|
-
) {
|
|
121
|
-
// This captures the initial read from the session entity when the timekeeper first initializes
|
|
122
|
-
this.#localTimeDiff = data.serverTimeDiff
|
|
97
|
+
/** Process the session entity and use the info to set the main time calculations if present */
|
|
98
|
+
processStoredDiff () {
|
|
99
|
+
const storedServerTimeDiff = this.#session?.read()?.serverTimeDiff
|
|
100
|
+
if (typeof storedServerTimeDiff === 'number' && !isNaN(storedServerTimeDiff)) {
|
|
101
|
+
this.#localTimeDiff = storedServerTimeDiff
|
|
123
102
|
this.#correctedOriginTime = originTime - this.#localTimeDiff
|
|
124
103
|
this.#ready = true
|
|
125
104
|
}
|
|
@@ -201,8 +201,7 @@ export class Aggregate extends AggregateBase {
|
|
|
201
201
|
var type = internal ? 'ierr' : 'err'
|
|
202
202
|
var newMetrics = { time }
|
|
203
203
|
|
|
204
|
-
//
|
|
205
|
-
// and spa annotates the error with interaction info
|
|
204
|
+
// Trace sends the error in its payload, and both trace & replay simply listens for any error to occur.
|
|
206
205
|
const jsErrorEvent = [type, bucketHash, params, newMetrics, customAttributes]
|
|
207
206
|
handle('trace-jserror', jsErrorEvent, undefined, FEATURE_NAMES.sessionTrace, this.ee)
|
|
208
207
|
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { handle } from '../../../common/event-emitter/handle'
|
|
7
7
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
8
8
|
import { FEATURE_NAME } from '../constants'
|
|
9
|
-
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
10
9
|
import { globalScope } from '../../../common/constants/runtime'
|
|
11
10
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts'
|
|
12
11
|
import { now } from '../../../common/timing/now'
|
|
@@ -28,7 +27,7 @@ export class Instrument extends InstrumentBase {
|
|
|
28
27
|
|
|
29
28
|
this.ee.on('internal-error', (error) => {
|
|
30
29
|
if (!this.abortHandler) return
|
|
31
|
-
handle('ierr', [castError(error), now(), true, {}, this.#replayRunning], undefined,
|
|
30
|
+
handle('ierr', [castError(error), now(), true, {}, this.#replayRunning], undefined, this.featureName, this.ee)
|
|
32
31
|
})
|
|
33
32
|
|
|
34
33
|
this.ee.on(SR_EVENT_EMITTER_TYPES.REPLAY_RUNNING, (isRunning) => {
|
|
@@ -37,12 +36,12 @@ export class Instrument extends InstrumentBase {
|
|
|
37
36
|
|
|
38
37
|
globalScope.addEventListener('unhandledrejection', (promiseRejectionEvent) => {
|
|
39
38
|
if (!this.abortHandler) return
|
|
40
|
-
handle('err', [castPromiseRejectionEvent(promiseRejectionEvent), now(), false, { unhandledPromiseRejection: 1 }, this.#replayRunning], undefined,
|
|
39
|
+
handle('err', [castPromiseRejectionEvent(promiseRejectionEvent), now(), false, { unhandledPromiseRejection: 1 }, this.#replayRunning], undefined, this.featureName, this.ee)
|
|
41
40
|
}, eventListenerOpts(false, this.removeOnAbort?.signal))
|
|
42
41
|
|
|
43
42
|
globalScope.addEventListener('error', (errorEvent) => {
|
|
44
43
|
if (!this.abortHandler) return
|
|
45
|
-
handle('err', [castErrorEvent(errorEvent), now(), false, {}, this.#replayRunning], undefined,
|
|
44
|
+
handle('err', [castErrorEvent(errorEvent), now(), false, {}, this.#replayRunning], undefined, this.featureName, this.ee)
|
|
46
45
|
}, eventListenerOpts(false, this.removeOnAbort?.signal))
|
|
47
46
|
|
|
48
47
|
this.abortHandler = this.#abort // we also use this as a flag to denote that the feature is active or on and handling errors
|
|
@@ -26,6 +26,7 @@ export class Aggregate extends AggregateBase {
|
|
|
26
26
|
this.timeToFirstByte = 0
|
|
27
27
|
this.firstByteToWindowLoad = 0 // our "frontend" duration
|
|
28
28
|
this.firstByteToDomContent = 0 // our "dom processing" duration
|
|
29
|
+
this.timeKeeper = new TimeKeeper(this.agentIdentifier)
|
|
29
30
|
|
|
30
31
|
if (isBrowserScope) {
|
|
31
32
|
timeToFirstByte.subscribe(({ value, attrs }) => {
|
|
@@ -102,6 +103,10 @@ export class Aggregate extends AggregateBase {
|
|
|
102
103
|
queryParameters.fp = firstPaint.current.value
|
|
103
104
|
queryParameters.fcp = firstContentfulPaint.current.value
|
|
104
105
|
|
|
106
|
+
if (this.timeKeeper?.ready) {
|
|
107
|
+
queryParameters.timestamp = this.timeKeeper.convertRelativeTimestamp(now())
|
|
108
|
+
}
|
|
109
|
+
|
|
105
110
|
const rumStartTime = now()
|
|
106
111
|
harvester.send({
|
|
107
112
|
endpoint: 'rum',
|
|
@@ -117,11 +122,10 @@ export class Aggregate extends AggregateBase {
|
|
|
117
122
|
}
|
|
118
123
|
|
|
119
124
|
try {
|
|
120
|
-
|
|
121
|
-
timeKeeper.
|
|
122
|
-
if (!timeKeeper.ready) throw new Error('TimeKeeper not ready')
|
|
125
|
+
this.timeKeeper.processRumRequest(xhr, rumStartTime, rumEndTime)
|
|
126
|
+
if (!this.timeKeeper.ready) throw new Error('TimeKeeper not ready')
|
|
123
127
|
|
|
124
|
-
agentRuntime.timeKeeper = timeKeeper
|
|
128
|
+
agentRuntime.timeKeeper = this.timeKeeper
|
|
125
129
|
} catch (error) {
|
|
126
130
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/Failed'], undefined, FEATURE_NAMES.metrics, this.ee)
|
|
127
131
|
drain(this.agentIdentifier, FEATURE_NAMES.metrics, true)
|
|
@@ -86,7 +86,14 @@ export class Recorder {
|
|
|
86
86
|
inlineStylesheet: inline_stylesheet,
|
|
87
87
|
inlineImages: inline_images,
|
|
88
88
|
collectFonts: collect_fonts,
|
|
89
|
-
checkoutEveryNms: CHECKOUT_MS[this.parent.mode]
|
|
89
|
+
checkoutEveryNms: CHECKOUT_MS[this.parent.mode],
|
|
90
|
+
/** Emits errors thrown by rrweb directly before bubbling them up to the window */
|
|
91
|
+
errorHandler: (err) => {
|
|
92
|
+
/** capture rrweb errors as "internal" errors only */
|
|
93
|
+
this.parent.ee.emit('internal-error', [err])
|
|
94
|
+
/** returning true informs rrweb to swallow the error instead of throwing it to the window */
|
|
95
|
+
return true
|
|
96
|
+
}
|
|
90
97
|
})
|
|
91
98
|
|
|
92
99
|
this.stopRecording = () => {
|