@newrelic/browser-agent 1.296.0-rc.5 → 1.296.0-rc.7
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/instrument/index.js +3 -2
- package/dist/cjs/features/utils/aggregate-base.js +6 -5
- 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/instrument/index.js +4 -3
- package/dist/esm/features/utils/aggregate-base.js +6 -5
- package/dist/types/features/utils/aggregate-base.d.ts +2 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/session_replay/instrument/index.js +4 -4
- package/src/features/utils/aggregate-base.js +6 -4
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.296.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.296.0-rc.7";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.296.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.296.0-rc.7";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -70,7 +70,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
70
70
|
/**
|
|
71
71
|
* This func is use for early pre-load recording prior to replay feature (agg) being loaded onto the page. It should only setup once, including if already called and in-progress.
|
|
72
72
|
*/
|
|
73
|
-
async #preloadStartRecording() {
|
|
73
|
+
async #preloadStartRecording(trigger) {
|
|
74
74
|
if (this.#alreadyStarted) return;
|
|
75
75
|
this.#alreadyStarted = true;
|
|
76
76
|
try {
|
|
@@ -84,6 +84,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
84
84
|
...this,
|
|
85
85
|
mode: this.#mode,
|
|
86
86
|
agentRef: this.#agentRef,
|
|
87
|
+
trigger,
|
|
87
88
|
timeKeeper: this.#agentRef.runtime.timeKeeper
|
|
88
89
|
}); // if TK exists due to deferred state, pass it
|
|
89
90
|
this.recorder.startRecording();
|
|
@@ -107,7 +108,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
107
108
|
} else {
|
|
108
109
|
// pre-load
|
|
109
110
|
this.#mode = _constants.MODE.FULL;
|
|
110
|
-
this.#preloadStartRecording();
|
|
111
|
+
this.#preloadStartRecording(_constants2.TRIGGERS.API);
|
|
111
112
|
// There's a race here wherein either:
|
|
112
113
|
// a. Recorder has not been initialized, and we've set the enforced mode, so we're good, or;
|
|
113
114
|
// b. Record has been initialized, possibly with the "wrong" mode, so we have to correct that + restart.
|
|
@@ -41,8 +41,9 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
41
41
|
/** @type {Boolean} indicates if custom attributes are combined in each event payload for size estimation purposes. this is set to true in derived classes that need to evaluate custom attributes separately from the event payload */
|
|
42
42
|
this.customAttributesAreSeparate = false;
|
|
43
43
|
/** @type {Boolean} indicates if the feature can harvest early. This is set to false in derived classes that need to block early harvests, like ajax under certain conditions */
|
|
44
|
-
this.canHarvestEarly = true;
|
|
45
|
-
|
|
44
|
+
this.canHarvestEarly = true;
|
|
45
|
+
/** @type {Boolean} indicates if the feature is actively in a retry deferral period */
|
|
46
|
+
this.isRetrying = false;
|
|
46
47
|
this.harvestOpts = {}; // features aggregate classes can define custom opts for when their harvest is called
|
|
47
48
|
|
|
48
49
|
const agentEntityGuid = this.agentRef?.runtime?.appMetadata?.agents?.[0]?.entityGuid;
|
|
@@ -90,7 +91,7 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
90
91
|
* @returns void
|
|
91
92
|
*/
|
|
92
93
|
decideEarlyHarvest() {
|
|
93
|
-
if (!this.canHarvestEarly) return;
|
|
94
|
+
if (!this.canHarvestEarly || this.blocked || this.isRetrying) return;
|
|
94
95
|
const estimatedSize = this.events.byteSize() + (this.customAttributesAreSeparate ? this.agentRef.runtime.jsAttributesMetadata.bytes : 0);
|
|
95
96
|
if (estimatedSize > _agentConstants.IDEAL_PAYLOAD_SIZE) {
|
|
96
97
|
this.agentRef.runtime.harvester.triggerHarvestFor(this);
|
|
@@ -179,8 +180,8 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
179
180
|
* @param {boolean=} result.retry - whether the harvest should be retried
|
|
180
181
|
*/
|
|
181
182
|
postHarvestCleanup(result = {}) {
|
|
182
|
-
|
|
183
|
-
if (
|
|
183
|
+
this.isRetrying = result.sent && result.retry;
|
|
184
|
+
if (this.isRetrying) this.events.reloadSave(this.harvestOpts, result.targetApp?.entityGuid);
|
|
184
185
|
this.events.clearSave(this.harvestOpts, result.targetApp?.entityGuid);
|
|
185
186
|
}
|
|
186
187
|
|
|
@@ -10,7 +10,7 @@ import { handle } from '../../../common/event-emitter/handle';
|
|
|
10
10
|
import { DEFAULT_KEY, MODE, PREFIX } from '../../../common/session/constants';
|
|
11
11
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
12
12
|
import { hasReplayPrerequisite, isPreloadAllowed } from '../shared/utils';
|
|
13
|
-
import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES } from '../constants';
|
|
13
|
+
import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES, TRIGGERS } from '../constants';
|
|
14
14
|
import { setupRecordReplayAPI } from '../../../loaders/api/recordReplay';
|
|
15
15
|
import { setupPauseReplayAPI } from '../../../loaders/api/pauseReplay';
|
|
16
16
|
export class Instrument extends InstrumentBase {
|
|
@@ -65,7 +65,7 @@ export class Instrument extends InstrumentBase {
|
|
|
65
65
|
/**
|
|
66
66
|
* This func is use for early pre-load recording prior to replay feature (agg) being loaded onto the page. It should only setup once, including if already called and in-progress.
|
|
67
67
|
*/
|
|
68
|
-
async #preloadStartRecording() {
|
|
68
|
+
async #preloadStartRecording(trigger) {
|
|
69
69
|
if (this.#alreadyStarted) return;
|
|
70
70
|
this.#alreadyStarted = true;
|
|
71
71
|
try {
|
|
@@ -79,6 +79,7 @@ export class Instrument extends InstrumentBase {
|
|
|
79
79
|
...this,
|
|
80
80
|
mode: this.#mode,
|
|
81
81
|
agentRef: this.#agentRef,
|
|
82
|
+
trigger,
|
|
82
83
|
timeKeeper: this.#agentRef.runtime.timeKeeper
|
|
83
84
|
}); // if TK exists due to deferred state, pass it
|
|
84
85
|
this.recorder.startRecording();
|
|
@@ -102,7 +103,7 @@ export class Instrument extends InstrumentBase {
|
|
|
102
103
|
} else {
|
|
103
104
|
// pre-load
|
|
104
105
|
this.#mode = MODE.FULL;
|
|
105
|
-
this.#preloadStartRecording();
|
|
106
|
+
this.#preloadStartRecording(TRIGGERS.API);
|
|
106
107
|
// There's a race here wherein either:
|
|
107
108
|
// a. Recorder has not been initialized, and we've set the enforced mode, so we're good, or;
|
|
108
109
|
// b. Record has been initialized, possibly with the "wrong" mode, so we have to correct that + restart.
|
|
@@ -34,8 +34,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
34
34
|
/** @type {Boolean} indicates if custom attributes are combined in each event payload for size estimation purposes. this is set to true in derived classes that need to evaluate custom attributes separately from the event payload */
|
|
35
35
|
this.customAttributesAreSeparate = false;
|
|
36
36
|
/** @type {Boolean} indicates if the feature can harvest early. This is set to false in derived classes that need to block early harvests, like ajax under certain conditions */
|
|
37
|
-
this.canHarvestEarly = true;
|
|
38
|
-
|
|
37
|
+
this.canHarvestEarly = true;
|
|
38
|
+
/** @type {Boolean} indicates if the feature is actively in a retry deferral period */
|
|
39
|
+
this.isRetrying = false;
|
|
39
40
|
this.harvestOpts = {}; // features aggregate classes can define custom opts for when their harvest is called
|
|
40
41
|
|
|
41
42
|
const agentEntityGuid = this.agentRef?.runtime?.appMetadata?.agents?.[0]?.entityGuid;
|
|
@@ -83,7 +84,7 @@ export class AggregateBase extends FeatureBase {
|
|
|
83
84
|
* @returns void
|
|
84
85
|
*/
|
|
85
86
|
decideEarlyHarvest() {
|
|
86
|
-
if (!this.canHarvestEarly) return;
|
|
87
|
+
if (!this.canHarvestEarly || this.blocked || this.isRetrying) return;
|
|
87
88
|
const estimatedSize = this.events.byteSize() + (this.customAttributesAreSeparate ? this.agentRef.runtime.jsAttributesMetadata.bytes : 0);
|
|
88
89
|
if (estimatedSize > IDEAL_PAYLOAD_SIZE) {
|
|
89
90
|
this.agentRef.runtime.harvester.triggerHarvestFor(this);
|
|
@@ -172,8 +173,8 @@ export class AggregateBase extends FeatureBase {
|
|
|
172
173
|
* @param {boolean=} result.retry - whether the harvest should be retried
|
|
173
174
|
*/
|
|
174
175
|
postHarvestCleanup(result = {}) {
|
|
175
|
-
|
|
176
|
-
if (
|
|
176
|
+
this.isRetrying = result.sent && result.retry;
|
|
177
|
+
if (this.isRetrying) this.events.reloadSave(this.harvestOpts, result.targetApp?.entityGuid);
|
|
177
178
|
this.events.clearSave(this.harvestOpts, result.targetApp?.entityGuid);
|
|
178
179
|
}
|
|
179
180
|
|
|
@@ -10,6 +10,8 @@ export class AggregateBase extends FeatureBase {
|
|
|
10
10
|
customAttributesAreSeparate: boolean;
|
|
11
11
|
/** @type {Boolean} indicates if the feature can harvest early. This is set to false in derived classes that need to block early harvests, like ajax under certain conditions */
|
|
12
12
|
canHarvestEarly: boolean;
|
|
13
|
+
/** @type {Boolean} indicates if the feature is actively in a retry deferral period */
|
|
14
|
+
isRetrying: boolean;
|
|
13
15
|
harvestOpts: {};
|
|
14
16
|
events: any;
|
|
15
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAsBA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,
|
|
1
|
+
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAsBA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EA2BhB;IAvBC,iBAAwB;IAIxB,uOAAuO;IACvO,qCAAwC;IACxC,gLAAgL;IAChL,yBAA2B;IAC3B,sFAAsF;IACtF,oBAAuB;IAEvB,gBAAqB;IA4BjB,YAAwJ;IAW9J;;;;OAIG;IACH,2BAOC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAwBlB;IAED;;OAEG;IACH,cAGC;IADC,6BAAmB;IAGrB,qCAEC;IAED;;;;;;OAMG;IACH,uDAJW,MAAM,GAAC,SAAS,SAyB1B;IAED;;;;;;;OAOG;IACH,4BALG;QAAwB,SAAS,GAAzB,MAAM,YAAC;KACf,QAQF;IAED;;;OAGG;IACH,6CAsBC;IAED;;;OAGG;IACH,2CAOC;IALC,gBAA6C;IAO/C;;;;OAIG;IACH,uCAHW,GAAC,UACD,GAAC,QAIX;;CACF;4BA/N2B,gBAAgB"}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { handle } from '../../../common/event-emitter/handle'
|
|
|
10
10
|
import { DEFAULT_KEY, MODE, PREFIX } from '../../../common/session/constants'
|
|
11
11
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
12
12
|
import { hasReplayPrerequisite, isPreloadAllowed } from '../shared/utils'
|
|
13
|
-
import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES } from '../constants'
|
|
13
|
+
import { FEATURE_NAME, SR_EVENT_EMITTER_TYPES, TRIGGERS } from '../constants'
|
|
14
14
|
import { setupRecordReplayAPI } from '../../../loaders/api/recordReplay'
|
|
15
15
|
import { setupPauseReplayAPI } from '../../../loaders/api/pauseReplay'
|
|
16
16
|
|
|
@@ -69,7 +69,7 @@ export class Instrument extends InstrumentBase {
|
|
|
69
69
|
/**
|
|
70
70
|
* This func is use for early pre-load recording prior to replay feature (agg) being loaded onto the page. It should only setup once, including if already called and in-progress.
|
|
71
71
|
*/
|
|
72
|
-
async #preloadStartRecording () {
|
|
72
|
+
async #preloadStartRecording (trigger) {
|
|
73
73
|
if (this.#alreadyStarted) return
|
|
74
74
|
this.#alreadyStarted = true
|
|
75
75
|
|
|
@@ -78,7 +78,7 @@ export class Instrument extends InstrumentBase {
|
|
|
78
78
|
|
|
79
79
|
// If startReplay() has been used by this point, we must record in full mode regardless of session preload:
|
|
80
80
|
// Note: recorder starts here with w/e the mode is at this time, but this may be changed later (see #apiStartOrRestartReplay else-case)
|
|
81
|
-
this.recorder ??= new Recorder({ ...this, mode: this.#mode, agentRef: this.#agentRef, timeKeeper: this.#agentRef.runtime.timeKeeper }) // if TK exists due to deferred state, pass it
|
|
81
|
+
this.recorder ??= new Recorder({ ...this, mode: this.#mode, agentRef: this.#agentRef, trigger, timeKeeper: this.#agentRef.runtime.timeKeeper }) // if TK exists due to deferred state, pass it
|
|
82
82
|
this.recorder.startRecording()
|
|
83
83
|
this.abortHandler = this.recorder.stopRecording
|
|
84
84
|
} catch (err) {
|
|
@@ -95,7 +95,7 @@ export class Instrument extends InstrumentBase {
|
|
|
95
95
|
if (this.featAggregate.mode !== MODE.FULL) this.featAggregate.initializeRecording(MODE.FULL, true)
|
|
96
96
|
} else { // pre-load
|
|
97
97
|
this.#mode = MODE.FULL
|
|
98
|
-
this.#preloadStartRecording()
|
|
98
|
+
this.#preloadStartRecording(TRIGGERS.API)
|
|
99
99
|
// There's a race here wherein either:
|
|
100
100
|
// a. Recorder has not been initialized, and we've set the enforced mode, so we're good, or;
|
|
101
101
|
// b. Record has been initialized, possibly with the "wrong" mode, so we have to correct that + restart.
|
|
@@ -35,7 +35,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
35
35
|
/** @type {Boolean} indicates if custom attributes are combined in each event payload for size estimation purposes. this is set to true in derived classes that need to evaluate custom attributes separately from the event payload */
|
|
36
36
|
this.customAttributesAreSeparate = false
|
|
37
37
|
/** @type {Boolean} indicates if the feature can harvest early. This is set to false in derived classes that need to block early harvests, like ajax under certain conditions */
|
|
38
|
-
this.canHarvestEarly = true
|
|
38
|
+
this.canHarvestEarly = true
|
|
39
|
+
/** @type {Boolean} indicates if the feature is actively in a retry deferral period */
|
|
40
|
+
this.isRetrying = false
|
|
39
41
|
|
|
40
42
|
this.harvestOpts = {} // features aggregate classes can define custom opts for when their harvest is called
|
|
41
43
|
|
|
@@ -82,7 +84,7 @@ export class AggregateBase extends FeatureBase {
|
|
|
82
84
|
* @returns void
|
|
83
85
|
*/
|
|
84
86
|
decideEarlyHarvest () {
|
|
85
|
-
if (!this.canHarvestEarly) return
|
|
87
|
+
if (!this.canHarvestEarly || this.blocked || this.isRetrying) return
|
|
86
88
|
const estimatedSize = this.events.byteSize() + (this.customAttributesAreSeparate ? this.agentRef.runtime.jsAttributesMetadata.bytes : 0)
|
|
87
89
|
if (estimatedSize > IDEAL_PAYLOAD_SIZE) {
|
|
88
90
|
this.agentRef.runtime.harvester.triggerHarvestFor(this)
|
|
@@ -169,8 +171,8 @@ export class AggregateBase extends FeatureBase {
|
|
|
169
171
|
* @param {boolean=} result.retry - whether the harvest should be retried
|
|
170
172
|
*/
|
|
171
173
|
postHarvestCleanup (result = {}) {
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
+
this.isRetrying = result.sent && result.retry
|
|
175
|
+
if (this.isRetrying) this.events.reloadSave(this.harvestOpts, result.targetApp?.entityGuid)
|
|
174
176
|
this.events.clearSave(this.harvestOpts, result.targetApp?.entityGuid)
|
|
175
177
|
}
|
|
176
178
|
|