@newrelic/browser-agent 1.313.1-rc.0 → 1.313.1-rc.2
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/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/features/session_replay/aggregate/index.js +15 -6
- package/dist/cjs/features/session_replay/constants.js +1 -1
- package/dist/cjs/features/session_replay/shared/recorder.js +3 -1
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/features/session_replay/aggregate/index.js +15 -6
- package/dist/esm/features/session_replay/constants.js +1 -1
- package/dist/esm/features/session_replay/shared/recorder.js +3 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +1 -11
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts +2 -0
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/session_replay/aggregate/index.js +16 -5
- package/src/features/session_replay/constants.js +1 -1
- package/src/features/session_replay/shared/recorder.js +3 -1
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.313.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.313.1-rc.2";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.313.1-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.313.1-rc.2";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -21,7 +21,7 @@ var _cleanUrl = require("../../../common/url/clean-url");
|
|
|
21
21
|
var _featureGates = require("../../utils/feature-gates");
|
|
22
22
|
var _constants3 = require("../../../loaders/api/constants");
|
|
23
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
|
|
24
|
-
* Copyright 2020-
|
|
24
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
25
25
|
* SPDX-License-Identifier: Apache-2.0
|
|
26
26
|
*/ /**
|
|
27
27
|
* @file Records, aggregates, and harvests session replay data.
|
|
@@ -219,6 +219,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
makeHarvestPayload() {
|
|
222
|
+
if (this.isRetrying) return this.recorder.retryPayload;
|
|
222
223
|
if (this.mode !== _constants2.MODE.FULL || this.blocked) return; // harvests should only be made in FULL mode, and not if the feature is blocked
|
|
223
224
|
if (this.shouldCompress && !this.gzipper) return; // if compression is enabled, but the libraries have not loaded, wait for them to load
|
|
224
225
|
if (!this.recorder || !this.timeKeeper?.ready || !(this.recorder.hasSeenSnapshot && this.recorder.hasSeenMeta)) return; // if the recorder or the timekeeper is not ready, or the recorder has not yet seen a snapshot, do not harvest
|
|
@@ -246,8 +247,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
246
247
|
this.abort(_constants.ABORT_REASONS.TOO_BIG, len);
|
|
247
248
|
return;
|
|
248
249
|
}
|
|
249
|
-
|
|
250
|
-
// TODO -- Gracefully handle the buffer for retries.
|
|
251
250
|
if (!this.agentRef.runtime.session.state.sessionReplaySentFirstChunk) this.syncWithSessionManager({
|
|
252
251
|
sessionReplaySentFirstChunk: true
|
|
253
252
|
});
|
|
@@ -255,6 +254,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
255
254
|
if (!this.agentRef.runtime.session.state.traceHarvestStarted) {
|
|
256
255
|
(0, _console.warn)(59, JSON.stringify(this.agentRef.runtime.session.state));
|
|
257
256
|
}
|
|
257
|
+
this.recorder.retryPayload = payload;
|
|
258
258
|
return payload;
|
|
259
259
|
}
|
|
260
260
|
|
|
@@ -352,9 +352,18 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
352
352
|
};
|
|
353
353
|
}
|
|
354
354
|
postHarvestCleanup(result) {
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
if (result.sent) {
|
|
356
|
+
if (result.retry) {
|
|
357
|
+
(0, _console.warn)(70);
|
|
358
|
+
this.isRetrying = true;
|
|
359
|
+
this.forceStop();
|
|
360
|
+
} else {
|
|
361
|
+
this.recorder.retryPayload = undefined;
|
|
362
|
+
if (this.isRetrying) {
|
|
363
|
+
this.isRetrying = false;
|
|
364
|
+
this.switchToFull();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
358
367
|
}
|
|
359
368
|
}
|
|
360
369
|
|
|
@@ -7,7 +7,7 @@ exports.TRIGGERS = exports.RRWEB_EVENT_TYPES = exports.QUERY_PARAM_PADDING = exp
|
|
|
7
7
|
var _constants = require("../../common/session/constants");
|
|
8
8
|
var _features = require("../../loaders/features/features");
|
|
9
9
|
/**
|
|
10
|
-
* Copyright 2020-
|
|
10
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
11
11
|
* SPDX-License-Identifier: Apache-2.0
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -19,7 +19,7 @@ var _console = require("../../../common/util/console");
|
|
|
19
19
|
var _invoke = require("../../../common/util/invoke");
|
|
20
20
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
21
21
|
/**
|
|
22
|
-
* Copyright 2020-
|
|
22
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
23
23
|
* SPDX-License-Identifier: Apache-2.0
|
|
24
24
|
*/
|
|
25
25
|
|
|
@@ -47,6 +47,8 @@ class Recorder {
|
|
|
47
47
|
this.events = new _recorderEvents.RecorderEvents(this.shouldFix);
|
|
48
48
|
/** Backlog used for a 2-part sliding window to guarantee a 15-30s buffer window */
|
|
49
49
|
this.backloggedEvents = new _recorderEvents.RecorderEvents(this.shouldFix);
|
|
50
|
+
/** Used to hold the harvest contents to facilitate retrying */
|
|
51
|
+
this.retryPayload = undefined;
|
|
50
52
|
/** Only set to true once a snapshot node has been processed. Used to block harvests from sending before we know we have a snapshot */
|
|
51
53
|
this.hasSeenSnapshot = false;
|
|
52
54
|
this.hasSeenMeta = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -215,6 +215,7 @@ export class Aggregate extends AggregateBase {
|
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
makeHarvestPayload() {
|
|
218
|
+
if (this.isRetrying) return this.recorder.retryPayload;
|
|
218
219
|
if (this.mode !== MODE.FULL || this.blocked) return; // harvests should only be made in FULL mode, and not if the feature is blocked
|
|
219
220
|
if (this.shouldCompress && !this.gzipper) return; // if compression is enabled, but the libraries have not loaded, wait for them to load
|
|
220
221
|
if (!this.recorder || !this.timeKeeper?.ready || !(this.recorder.hasSeenSnapshot && this.recorder.hasSeenMeta)) return; // if the recorder or the timekeeper is not ready, or the recorder has not yet seen a snapshot, do not harvest
|
|
@@ -242,8 +243,6 @@ export class Aggregate extends AggregateBase {
|
|
|
242
243
|
this.abort(ABORT_REASONS.TOO_BIG, len);
|
|
243
244
|
return;
|
|
244
245
|
}
|
|
245
|
-
|
|
246
|
-
// TODO -- Gracefully handle the buffer for retries.
|
|
247
246
|
if (!this.agentRef.runtime.session.state.sessionReplaySentFirstChunk) this.syncWithSessionManager({
|
|
248
247
|
sessionReplaySentFirstChunk: true
|
|
249
248
|
});
|
|
@@ -251,6 +250,7 @@ export class Aggregate extends AggregateBase {
|
|
|
251
250
|
if (!this.agentRef.runtime.session.state.traceHarvestStarted) {
|
|
252
251
|
warn(59, JSON.stringify(this.agentRef.runtime.session.state));
|
|
253
252
|
}
|
|
253
|
+
this.recorder.retryPayload = payload;
|
|
254
254
|
return payload;
|
|
255
255
|
}
|
|
256
256
|
|
|
@@ -348,9 +348,18 @@ export class Aggregate extends AggregateBase {
|
|
|
348
348
|
};
|
|
349
349
|
}
|
|
350
350
|
postHarvestCleanup(result) {
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
351
|
+
if (result.sent) {
|
|
352
|
+
if (result.retry) {
|
|
353
|
+
warn(70);
|
|
354
|
+
this.isRetrying = true;
|
|
355
|
+
this.forceStop();
|
|
356
|
+
} else {
|
|
357
|
+
this.recorder.retryPayload = undefined;
|
|
358
|
+
if (this.isRetrying) {
|
|
359
|
+
this.isRetrying = false;
|
|
360
|
+
this.switchToFull();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
354
363
|
}
|
|
355
364
|
}
|
|
356
365
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { record as recorder } from '@newrelic/rrweb';
|
|
@@ -40,6 +40,8 @@ export class Recorder {
|
|
|
40
40
|
this.events = new RecorderEvents(this.shouldFix);
|
|
41
41
|
/** Backlog used for a 2-part sliding window to guarantee a 15-30s buffer window */
|
|
42
42
|
this.backloggedEvents = new RecorderEvents(this.shouldFix);
|
|
43
|
+
/** Used to hold the harvest contents to facilitate retrying */
|
|
44
|
+
this.retryPayload = undefined;
|
|
43
45
|
/** Only set to true once a snapshot node has been processed. Used to block harvests from sending before we know we have a snapshot */
|
|
44
46
|
this.hasSeenSnapshot = false;
|
|
45
47
|
this.hasSeenMeta = false;
|
|
@@ -35,17 +35,7 @@ export class Aggregate extends AggregateBase {
|
|
|
35
35
|
PRELOAD: string;
|
|
36
36
|
}): void;
|
|
37
37
|
prepUtils(): Promise<void>;
|
|
38
|
-
makeHarvestPayload():
|
|
39
|
-
qs: {
|
|
40
|
-
browser_monitoring_key: any;
|
|
41
|
-
type: string;
|
|
42
|
-
app_id: any;
|
|
43
|
-
protocol_version: string;
|
|
44
|
-
timestamp: any;
|
|
45
|
-
attributes: string;
|
|
46
|
-
};
|
|
47
|
-
body: any;
|
|
48
|
-
} | undefined;
|
|
38
|
+
makeHarvestPayload(): any;
|
|
49
39
|
/**
|
|
50
40
|
* returns the timestamps for the earliest and latest nodes in the provided array, even if out of order
|
|
51
41
|
* @param {Object[]} [nodes] - the nodes to evaluate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAyBA;IACE,2BAAiC;IAIjC,sCAyFC;IA5FD,aAAe;IAKb,iFAAiF;IACjF,qBAAwB;IAGxB,2CAA2C;IAC3C,sDAAwB;IACxB,6CAA6C;IAC7C,gDAAmB;IACnB,+DAA+D;IAC/D,wBAA0B;IAE1B,0BAA0B;IAC1B,kBAAqB;IACrB,6CAA6C;IAC7C,gBAA2B;IAE3B,qBAA2B;IAE3B,cAA8C;IAI9C,kCAAqG;IAmEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA8ChB;IAED,2BAUC;IAED
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAyBA;IACE,2BAAiC;IAIjC,sCAyFC;IA5FD,aAAe;IAKb,iFAAiF;IACjF,qBAAwB;IAGxB,2CAA2C;IAC3C,sDAAwB;IACxB,6CAA6C;IAC7C,gDAAmB;IACnB,+DAA+D;IAC/D,wBAA0B;IAE1B,0BAA0B;IAC1B,kBAAqB;IACrB,6CAA6C;IAC7C,gBAA2B;IAE3B,qBAA2B;IAE3B,cAA8C;IAI9C,kCAAqG;IAmEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA8ChB;IAED,2BAUC;IAED,0BA0CC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GACN;QAAE,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,GAAC,SAAS,CAAA;KAAE,CAUzE;IAED;;;;;;;;;;MAsEC;IAED,sCAcC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,+CASC;IAED,yCAIC;CACF;8BAxX6B,4BAA4B"}
|
|
@@ -13,6 +13,8 @@ export class Recorder {
|
|
|
13
13
|
events: RecorderEvents;
|
|
14
14
|
/** Backlog used for a 2-part sliding window to guarantee a 15-30s buffer window */
|
|
15
15
|
backloggedEvents: RecorderEvents;
|
|
16
|
+
/** Used to hold the harvest contents to facilitate retrying */
|
|
17
|
+
retryPayload: any;
|
|
16
18
|
/** Only set to true once a snapshot node has been processed. Used to block harvests from sending before we know we have a snapshot */
|
|
17
19
|
hasSeenSnapshot: boolean;
|
|
18
20
|
hasSeenMeta: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAqBA;IAUE,+
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAqBA;IAUE,+BAoCC;IAtCD,sBAAmB;IAGjB,iDAAiD;IACjD,kBAAgC;IAEhC,QAAyB;IACzB,mBAA6C;IAC7C,cAAqC;IAErC,qBAAwB;IACxB,0FAA0F;IAC1F,eAAkE;IAElE,iHAAiH;IACjH,uBAAgD;IAChD,mFAAmF;IACnF,iCAA0D;IAC1D,+DAA+D;IAC/D,kBAA6B;IAC7B,uIAAuI;IACvI,yBAA4B;IAC5B,qBAAwB;IACxB,kIAAkI;IAClI,kBAAqB;IACrB,uIAAuI;IACvI,0BAAwE;IAc1E,mBAEC;IAED;;;;;;;;;MAWC;IAED,kFAAkF;IAClF,oBAGC;IAED,qDAAqD;IACrD,8CA0CC;IAED;;;;;OAKG;IACH,aAHW,GAAC,cACD,GAAC,QAiCX;IAED,yHAAyH;IACzH,yCAiCC;IAED,0HAA0H;IAC1H,yBAOC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED;;;SAGK;IACL,oCAGC;;CACF;+BAzO8B,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -209,6 +209,7 @@ export class Aggregate extends AggregateBase {
|
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
makeHarvestPayload () {
|
|
212
|
+
if (this.isRetrying) return this.recorder.retryPayload
|
|
212
213
|
if (this.mode !== MODE.FULL || this.blocked) return // harvests should only be made in FULL mode, and not if the feature is blocked
|
|
213
214
|
if (this.shouldCompress && !this.gzipper) return // if compression is enabled, but the libraries have not loaded, wait for them to load
|
|
214
215
|
if (!this.recorder || !this.timeKeeper?.ready || !(this.recorder.hasSeenSnapshot && this.recorder.hasSeenMeta)) return // if the recorder or the timekeeper is not ready, or the recorder has not yet seen a snapshot, do not harvest
|
|
@@ -239,7 +240,6 @@ export class Aggregate extends AggregateBase {
|
|
|
239
240
|
return
|
|
240
241
|
}
|
|
241
242
|
|
|
242
|
-
// TODO -- Gracefully handle the buffer for retries.
|
|
243
243
|
if (!this.agentRef.runtime.session.state.sessionReplaySentFirstChunk) this.syncWithSessionManager({ sessionReplaySentFirstChunk: true })
|
|
244
244
|
this.recorder.clearBuffer()
|
|
245
245
|
|
|
@@ -247,6 +247,8 @@ export class Aggregate extends AggregateBase {
|
|
|
247
247
|
warn(59, JSON.stringify(this.agentRef.runtime.session.state))
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
+
this.recorder.retryPayload = payload
|
|
251
|
+
|
|
250
252
|
return payload
|
|
251
253
|
}
|
|
252
254
|
|
|
@@ -338,9 +340,18 @@ export class Aggregate extends AggregateBase {
|
|
|
338
340
|
}
|
|
339
341
|
|
|
340
342
|
postHarvestCleanup (result) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
if (result.sent) {
|
|
344
|
+
if (result.retry) {
|
|
345
|
+
warn(70)
|
|
346
|
+
this.isRetrying = true
|
|
347
|
+
this.forceStop()
|
|
348
|
+
} else {
|
|
349
|
+
this.recorder.retryPayload = undefined
|
|
350
|
+
if (this.isRetrying) {
|
|
351
|
+
this.isRetrying = false
|
|
352
|
+
this.switchToFull()
|
|
353
|
+
}
|
|
354
|
+
}
|
|
344
355
|
}
|
|
345
356
|
}
|
|
346
357
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2020-
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { record as recorder } from '@newrelic/rrweb'
|
|
@@ -45,6 +45,8 @@ export class Recorder {
|
|
|
45
45
|
this.events = new RecorderEvents(this.shouldFix)
|
|
46
46
|
/** Backlog used for a 2-part sliding window to guarantee a 15-30s buffer window */
|
|
47
47
|
this.backloggedEvents = new RecorderEvents(this.shouldFix)
|
|
48
|
+
/** Used to hold the harvest contents to facilitate retrying */
|
|
49
|
+
this.retryPayload = undefined
|
|
48
50
|
/** Only set to true once a snapshot node has been processed. Used to block harvests from sending before we know we have a snapshot */
|
|
49
51
|
this.hasSeenSnapshot = false
|
|
50
52
|
this.hasSeenMeta = false
|