@newrelic/browser-agent 1.284.1 → 1.286.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 +29 -0
- package/README.md +6 -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/dom/selector-path.js +1 -1
- package/dist/cjs/common/harvest/harvester.js +29 -2
- package/dist/cjs/common/util/feature-flags.js +8 -2
- package/dist/cjs/features/logging/aggregate/index.js +1 -1
- package/dist/cjs/features/session_replay/shared/recorder.js +8 -10
- package/dist/cjs/features/session_replay/shared/utils.js +12 -0
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +3 -2
- package/dist/cjs/features/utils/aggregate-base.js +4 -6
- package/dist/cjs/features/utils/event-store-manager.js +15 -1
- package/dist/cjs/features/utils/nr1-debugger.js +1 -1
- package/dist/cjs/loaders/agent-base.js +1 -1
- package/dist/cjs/loaders/agent.js +3 -1
- package/dist/cjs/loaders/api/api.js +68 -59
- package/dist/cjs/loaders/api/apiAsync.js +19 -22
- package/dist/cjs/loaders/configure/configure.js +20 -7
- package/dist/cjs/loaders/features/features.js +4 -3
- package/dist/cjs/loaders/micro-agent-base.js +1 -1
- package/dist/cjs/loaders/micro-agent.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/common/dom/selector-path.js +1 -1
- package/dist/esm/common/harvest/harvester.js +30 -3
- package/dist/esm/common/util/feature-flags.js +8 -2
- package/dist/esm/features/logging/aggregate/index.js +1 -1
- package/dist/esm/features/session_replay/shared/recorder.js +7 -9
- package/dist/esm/features/session_replay/shared/utils.js +11 -0
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +3 -2
- package/dist/esm/features/utils/aggregate-base.js +4 -6
- package/dist/esm/features/utils/event-store-manager.js +15 -1
- package/dist/esm/features/utils/nr1-debugger.js +1 -1
- package/dist/esm/loaders/agent-base.js +1 -1
- package/dist/esm/loaders/agent.js +3 -1
- package/dist/esm/loaders/api/api.js +67 -58
- package/dist/esm/loaders/api/apiAsync.js +14 -17
- package/dist/esm/loaders/configure/configure.js +21 -8
- package/dist/esm/loaders/features/features.js +3 -2
- package/dist/esm/loaders/micro-agent-base.js +1 -1
- package/dist/esm/loaders/micro-agent.js +3 -1
- package/dist/types/common/dom/selector-path.d.ts.map +1 -1
- package/dist/types/common/harvest/harvester.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +0 -1
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/utils.d.ts +1 -0
- package/dist/types/features/session_replay/shared/utils.d.ts.map +1 -1
- package/dist/types/features/utils/event-store-manager.d.ts +5 -1
- package/dist/types/features/utils/event-store-manager.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts +1 -0
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +1 -20
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts +1 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +2 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts +1 -0
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/dom/selector-path.js +1 -3
- package/src/common/harvest/harvester.js +33 -3
- package/src/common/util/feature-flags.js +10 -2
- package/src/features/logging/aggregate/index.js +2 -2
- package/src/features/session_replay/shared/recorder.js +7 -9
- package/src/features/session_replay/shared/utils.js +12 -0
- package/src/features/session_trace/aggregate/trace/storage.js +2 -2
- package/src/features/utils/aggregate-base.js +4 -4
- package/src/features/utils/event-store-manager.js +15 -1
- package/src/features/utils/nr1-debugger.js +1 -1
- package/src/loaders/agent-base.js +2 -2
- package/src/loaders/agent.js +4 -1
- package/src/loaders/api/api.js +64 -58
- package/src/loaders/api/apiAsync.js +14 -18
- package/src/loaders/configure/configure.js +21 -8
- package/src/loaders/features/features.js +3 -2
- package/src/loaders/micro-agent-base.js +2 -2
- package/src/loaders/micro-agent.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,35 @@
|
|
|
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.286.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.285.0...v1.286.0) (2025-04-01)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Erase .api property on agent instance ([#1425](https://github.com/newrelic/newrelic-browser-agent/issues/1425)) ([44786ae](https://github.com/newrelic/newrelic-browser-agent/commit/44786ae60d761b40a28f6df4b7b835c1791dda5f))
|
|
12
|
+
* Handle duplicate agent APIs ([#1418](https://github.com/newrelic/newrelic-browser-agent/issues/1418)) ([f808447](https://github.com/newrelic/newrelic-browser-agent/commit/f8084474ea1a567a90d0615cdfeb13a8a2c1f110))
|
|
13
|
+
* Reduce noise from `mousemove` events ([#1424](https://github.com/newrelic/newrelic-browser-agent/issues/1424)) ([7c02a02](https://github.com/newrelic/newrelic-browser-agent/commit/7c02a02763abdd2697e9ed1d5a89d81c251dcf67))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* Get string className for SVG elements ([#1423](https://github.com/newrelic/newrelic-browser-agent/issues/1423)) ([0c1ce6c](https://github.com/newrelic/newrelic-browser-agent/commit/0c1ce6ca82bce15da12fe84fd91a7d6be8b4da44))
|
|
19
|
+
* Patch `newrelic` event detail ([#1428](https://github.com/newrelic/newrelic-browser-agent/issues/1428)) ([8601424](https://github.com/newrelic/newrelic-browser-agent/commit/86014247ed45520adbbb053d94b6f11de48e239f))
|
|
20
|
+
|
|
21
|
+
## [1.285.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.284.1...v1.285.0) (2025-03-18)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* Decorate harvest requests with ht (hasTrace) param ([#1409](https://github.com/newrelic/newrelic-browser-agent/issues/1409)) ([b8ed2b0](https://github.com/newrelic/newrelic-browser-agent/commit/b8ed2b0aeef8b8db651ddb8001171f28785c7673))
|
|
27
|
+
* Inspection events ([#1413](https://github.com/newrelic/newrelic-browser-agent/issues/1413)) ([1832562](https://github.com/newrelic/newrelic-browser-agent/commit/1832562f52c1e2e26c49c2855ad1996d6251b803))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Bug Fixes
|
|
31
|
+
|
|
32
|
+
* Logging mode on session update ([#1417](https://github.com/newrelic/newrelic-browser-agent/issues/1417)) ([3f59afe](https://github.com/newrelic/newrelic-browser-agent/commit/3f59afef8a53848d80f7f32d28302b6b0bcf7d2f))
|
|
33
|
+
* Session Replay text masking for whitespace ([#1416](https://github.com/newrelic/newrelic-browser-agent/issues/1416)) ([97bf326](https://github.com/newrelic/newrelic-browser-agent/commit/97bf32655d6e608ea7248acc680d983b1d1e0eea))
|
|
34
|
+
|
|
6
35
|
## [1.284.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.284.0...v1.284.1) (2025-03-11)
|
|
7
36
|
|
|
8
37
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
<a href="https://opensource.newrelic.com/oss-category/#community-plus"><picture><source media="(prefers-color-scheme: dark)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/dark/Community_Plus.png"><source media="(prefers-color-scheme: light)" srcset="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"><img alt="New Relic Open Source community plus project banner." src="https://github.com/newrelic/opensource-website/raw/main/src/images/categories/Community_Plus.png"></picture></a>
|
|
2
2
|
|
|
3
|
+
### **Deployment status:**
|
|
4
|
+
<img src="https://img.shields.io/endpoint?style=plastic&url=https%3A%2F%2Fnewrelic.github.io%2Fnewrelic-browser-agent-release%2Fbadges%2Fcurrent-version-production.json">
|
|
5
|
+
<img src="https://img.shields.io/endpoint?style=plastic&url=https%3A%2F%2Fnewrelic.github.io%2Fnewrelic-browser-agent-release%2Fbadges%2Fcopy-paste-version-production.json">
|
|
6
|
+
<img src="https://img.shields.io/endpoint?style=plastic&url=https%3A%2F%2Fnewrelic.github.io%2Fnewrelic-browser-agent-release%2Fbadges%2Fgeneric-deploy-percent-production.json">
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
# New Relic Browser Agent
|
|
4
10
|
|
|
5
11
|
The New Relic browser agent instruments your web application or site and provides observability into performance, errors, and other behaviors.
|
|
@@ -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.
|
|
20
|
+
const VERSION = exports.VERSION = "1.286.0";
|
|
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.
|
|
20
|
+
const VERSION = exports.VERSION = "1.286.0";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -46,7 +46,7 @@ const generateSelectorPath = (elem, targetFields = []) => {
|
|
|
46
46
|
localName
|
|
47
47
|
} = elem;
|
|
48
48
|
targetFields.forEach(field => {
|
|
49
|
-
nearestFields[nearestAttrName(field)] ||= elem[field];
|
|
49
|
+
nearestFields[nearestAttrName(field)] ||= elem[field]?.baseVal || elem[field];
|
|
50
50
|
});
|
|
51
51
|
const selector = [localName, id ? "#".concat(id) : '', pathSelector ? ">".concat(pathSelector) : ''].join('');
|
|
52
52
|
pathSelector = selector;
|
|
@@ -18,6 +18,8 @@ var _encode = require("../url/encode");
|
|
|
18
18
|
var _console = require("../util/console");
|
|
19
19
|
var _stringify = require("../util/stringify");
|
|
20
20
|
var _submitData = require("../util/submit-data");
|
|
21
|
+
var _featureFlags = require("../util/feature-flags");
|
|
22
|
+
var _globalEvent = require("../dispatch/global-event");
|
|
21
23
|
/**
|
|
22
24
|
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
23
25
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -88,7 +90,8 @@ class Harvester {
|
|
|
88
90
|
localOpts,
|
|
89
91
|
submitMethod,
|
|
90
92
|
cbFinished,
|
|
91
|
-
raw: aggregateInst.harvestOpts.raw
|
|
93
|
+
raw: aggregateInst.harvestOpts.raw,
|
|
94
|
+
featureName: aggregateInst.featureName
|
|
92
95
|
});
|
|
93
96
|
ranSend = true;
|
|
94
97
|
});
|
|
@@ -130,7 +133,8 @@ function send(agentRef, {
|
|
|
130
133
|
localOpts = {},
|
|
131
134
|
submitMethod,
|
|
132
135
|
cbFinished,
|
|
133
|
-
raw
|
|
136
|
+
raw,
|
|
137
|
+
featureName
|
|
134
138
|
}) {
|
|
135
139
|
if (!agentRef.info.errorBeacon) return false;
|
|
136
140
|
let {
|
|
@@ -211,6 +215,22 @@ function send(agentRef, {
|
|
|
211
215
|
});
|
|
212
216
|
}
|
|
213
217
|
}
|
|
218
|
+
(0, _globalEvent.dispatchGlobalEvent)({
|
|
219
|
+
agentIdentifier: agentRef.agentIdentifier,
|
|
220
|
+
drained: !!_featureFlags.activatedFeatures?.[agentRef.agentIdentifier],
|
|
221
|
+
type: 'data',
|
|
222
|
+
name: 'harvest',
|
|
223
|
+
feature: featureName,
|
|
224
|
+
data: {
|
|
225
|
+
endpoint,
|
|
226
|
+
headers,
|
|
227
|
+
targetApp,
|
|
228
|
+
payload,
|
|
229
|
+
submitMethod: getSubmitMethodName(),
|
|
230
|
+
raw,
|
|
231
|
+
synchronousXhr: !!(localOpts.isFinalHarvest && _runtime.isWorkerScope)
|
|
232
|
+
}
|
|
233
|
+
});
|
|
214
234
|
return true;
|
|
215
235
|
function shouldRetry(status) {
|
|
216
236
|
switch (status) {
|
|
@@ -221,6 +241,11 @@ function send(agentRef, {
|
|
|
221
241
|
}
|
|
222
242
|
return status >= 502 && status <= 504 || status >= 512 && status <= 530;
|
|
223
243
|
}
|
|
244
|
+
function getSubmitMethodName() {
|
|
245
|
+
if (submitMethod === _submitData.xhr) return 'xhr';
|
|
246
|
+
if (submitMethod === _submitData.xhrFetch) return 'fetch';
|
|
247
|
+
return 'beacon';
|
|
248
|
+
}
|
|
224
249
|
}
|
|
225
250
|
|
|
226
251
|
/**
|
|
@@ -252,12 +277,14 @@ function cleanPayload(payload = {}) {
|
|
|
252
277
|
function baseQueryString(agentRef, qs, endpoint, applicationID) {
|
|
253
278
|
const ref = agentRef.runtime.obfuscator.obfuscateString((0, _cleanUrl.cleanURL)('' + _runtime.globalScope.location));
|
|
254
279
|
const hr = agentRef.runtime.session?.state.sessionReplayMode === 1 && endpoint !== _features.JSERRORS;
|
|
280
|
+
const ht = agentRef.runtime.session?.state.sessionTraceMode === 1 && ![_features.LOGS, _features.BLOBS].includes(endpoint);
|
|
255
281
|
const qps = ['a=' + applicationID, (0, _encode.param)('sa', agentRef.info.sa ? '' + agentRef.info.sa : ''), (0, _encode.param)('v', _env.VERSION), transactionNameParam(), (0, _encode.param)('ct', agentRef.runtime.customTransaction), '&rst=' + (0, _now.now)(), '&ck=0',
|
|
256
282
|
// ck param DEPRECATED - still expected by backend
|
|
257
283
|
'&s=' + (agentRef.runtime.session?.state.value || '0'),
|
|
258
284
|
// the 0 id encaps all untrackable and default traffic
|
|
259
285
|
(0, _encode.param)('ref', ref), (0, _encode.param)('ptid', agentRef.runtime.ptid ? '' + agentRef.runtime.ptid : '')];
|
|
260
286
|
if (hr) qps.push((0, _encode.param)('hr', '1', qs));
|
|
287
|
+
if (ht) qps.push((0, _encode.param)('ht', '1', qs));
|
|
261
288
|
return qps.join('');
|
|
262
289
|
|
|
263
290
|
// Constructs the transaction name param for the beacon URL.
|
|
@@ -33,8 +33,14 @@ function activateFeatures(flags, agentIdentifier) {
|
|
|
33
33
|
activatedFeatures[agentIdentifier] = flags;
|
|
34
34
|
sentIds.add(agentIdentifier);
|
|
35
35
|
|
|
36
|
-
// let any window level subscribers know that the agent is running
|
|
36
|
+
// let any window level subscribers know that the agent is running, per install docs
|
|
37
37
|
(0, _globalEvent.dispatchGlobalEvent)({
|
|
38
|
-
|
|
38
|
+
agentIdentifier,
|
|
39
|
+
loaded: true,
|
|
40
|
+
drained: true,
|
|
41
|
+
type: 'lifecycle',
|
|
42
|
+
name: 'load',
|
|
43
|
+
feature: undefined,
|
|
44
|
+
data: flags
|
|
39
45
|
});
|
|
40
46
|
}
|
|
@@ -33,7 +33,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
33
33
|
});
|
|
34
34
|
this.ee.on(_constants2.SESSION_EVENTS.UPDATE, (type, data) => {
|
|
35
35
|
if (this.blocked || type !== _constants2.SESSION_EVENT_TYPES.CROSS_TAB) return;
|
|
36
|
-
if (this.
|
|
36
|
+
if (this.loggingMode !== _constants.LOGGING_MODE.OFF && data.loggingMode === _constants.LOGGING_MODE.OFF) this.abort(_constants3.ABORT_REASONS.CROSS_TAB);else this.loggingMode = data.loggingMode;
|
|
37
37
|
});
|
|
38
38
|
this.harvestOpts.raw = true;
|
|
39
39
|
this.waitForFlags(['log']).then(([loggingMode]) => {
|
|
@@ -16,6 +16,8 @@ var _features = require("../../../loaders/features/features");
|
|
|
16
16
|
var _utils = require("./utils");
|
|
17
17
|
var _agentConstants = require("../../../common/constants/agent-constants");
|
|
18
18
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
19
|
+
var _console = require("../../../common/util/console");
|
|
20
|
+
var _invoke = require("../../../common/util/invoke");
|
|
19
21
|
/**
|
|
20
22
|
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
21
23
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -30,6 +32,8 @@ class Recorder {
|
|
|
30
32
|
#preloaded;
|
|
31
33
|
/** flag that if true, blocks events from being "stored". Only set to true when a full snapshot has incomplete nodes (only stylesheets ATM) */
|
|
32
34
|
#fixing = false;
|
|
35
|
+
#warnCSSOnce = (0, _invoke.single)(() => (0, _console.warn)(47)); // notifies user of potential replayer issue if fix_stylesheets is off
|
|
36
|
+
|
|
33
37
|
constructor(parent) {
|
|
34
38
|
this.#events = new _recorderEvents.RecorderEvents();
|
|
35
39
|
this.#backloggedEvents = new _recorderEvents.RecorderEvents();
|
|
@@ -90,14 +94,7 @@ class Recorder {
|
|
|
90
94
|
inline_images,
|
|
91
95
|
collect_fonts
|
|
92
96
|
} = this.parent.agentRef.init.session_replay;
|
|
93
|
-
|
|
94
|
-
try {
|
|
95
|
-
if (typeof element?.type === 'string' && element.type.toLowerCase() !== 'password' && (element?.dataset?.nrUnmask !== undefined || element?.classList?.contains('nr-unmask'))) return text;
|
|
96
|
-
} catch (err) {
|
|
97
|
-
// likely an element was passed to this handler that was invalid and was missing attributes or methods
|
|
98
|
-
}
|
|
99
|
-
return '*'.repeat(text?.length || 0);
|
|
100
|
-
};
|
|
97
|
+
|
|
101
98
|
// set up rrweb configurations for maximum privacy --
|
|
102
99
|
// https://newrelic.atlassian.net/wiki/spaces/O11Y/pages/2792293280/2023+02+28+Browser+-+Session+Replay#Configuration-options
|
|
103
100
|
const stop = (0, _rrweb.record)({
|
|
@@ -108,9 +105,9 @@ class Recorder {
|
|
|
108
105
|
blockSelector: block_selector,
|
|
109
106
|
maskInputOptions: mask_input_options,
|
|
110
107
|
maskTextSelector: mask_text_selector,
|
|
111
|
-
maskTextFn: customMasker,
|
|
108
|
+
maskTextFn: _utils.customMasker,
|
|
112
109
|
maskAllInputs: mask_all_inputs,
|
|
113
|
-
maskInputFn: customMasker,
|
|
110
|
+
maskInputFn: _utils.customMasker,
|
|
114
111
|
inlineStylesheet: true,
|
|
115
112
|
inlineImages: inline_images,
|
|
116
113
|
collectFonts: collect_fonts,
|
|
@@ -138,6 +135,7 @@ class Recorder {
|
|
|
138
135
|
if (!this.shouldFix) {
|
|
139
136
|
if (incompletes > 0) {
|
|
140
137
|
this.currentBufferTarget.inlinedAllStylesheets = false;
|
|
138
|
+
this.#warnCSSOnce();
|
|
141
139
|
(0, _handle.handle)(_constants3.SUPPORTABILITY_METRIC_CHANNEL, [missingInlineSMTag + 'Skipped', incompletes], undefined, _features.FEATURE_NAMES.metrics, this.parent.ee);
|
|
142
140
|
}
|
|
143
141
|
return this.store(event, isCheckout);
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.buildNRMetaNode = buildNRMetaNode;
|
|
7
|
+
exports.customMasker = customMasker;
|
|
7
8
|
exports.hasReplayPrerequisite = hasReplayPrerequisite;
|
|
8
9
|
exports.isPreloadAllowed = isPreloadAllowed;
|
|
9
10
|
var _nreum = require("../../../common/window/nreum");
|
|
@@ -35,4 +36,15 @@ function buildNRMetaNode(timestamp, timeKeeper) {
|
|
|
35
36
|
correctedOriginTime: timeKeeper.correctedOriginTime,
|
|
36
37
|
originTimeDiff: Math.floor(_runtime.originTime - timeKeeper.correctedOriginTime)
|
|
37
38
|
};
|
|
39
|
+
}
|
|
40
|
+
function customMasker(text, element) {
|
|
41
|
+
try {
|
|
42
|
+
if (typeof element?.type === 'string') {
|
|
43
|
+
if (element.type.toLowerCase() === 'password') return '*'.repeat(text?.length || 0);
|
|
44
|
+
if (element?.dataset?.nrUnmask !== undefined || element?.classList?.contains('nr-unmask')) return text;
|
|
45
|
+
}
|
|
46
|
+
} catch (err) {
|
|
47
|
+
// likely an element was passed to this handler that was invalid and was missing attributes or methods
|
|
48
|
+
}
|
|
49
|
+
return typeof text === 'string' ? text.replace(/[\S]/g, '*') : '*'.repeat(text?.length || 0);
|
|
38
50
|
}
|
|
@@ -22,7 +22,8 @@ const ignoredEvents = {
|
|
|
22
22
|
// we find that certain events make the data too noisy to be useful
|
|
23
23
|
global: {
|
|
24
24
|
mouseup: true,
|
|
25
|
-
mousedown: true
|
|
25
|
+
mousedown: true,
|
|
26
|
+
mousemove: true
|
|
26
27
|
},
|
|
27
28
|
// certain events are present both in the window and in PVT metrics. PVT metrics are prefered so the window events should be ignored
|
|
28
29
|
window: {
|
|
@@ -184,8 +185,8 @@ class TraceStorage {
|
|
|
184
185
|
this.storeSTN(evt);
|
|
185
186
|
}
|
|
186
187
|
shouldIgnoreEvent(event, target) {
|
|
187
|
-
const origin = (0, _eventOrigin.eventOrigin)(event.target, target, this.parent.ee);
|
|
188
188
|
if (event.type in ignoredEvents.global) return true;
|
|
189
|
+
const origin = (0, _eventOrigin.eventOrigin)(event.target, target, this.parent.ee);
|
|
189
190
|
if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true;
|
|
190
191
|
return !!(!!ignoredEvents[origin] && event.type in ignoredEvents[origin]);
|
|
191
192
|
}
|
|
@@ -43,7 +43,7 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
43
43
|
This was necessary to prevent race cond. issues where the event buffer was checked before the feature could "block" itself.
|
|
44
44
|
Its easier to just keep an empty event buffer in place. */
|
|
45
45
|
default:
|
|
46
|
-
this.events = new _eventStoreManager.EventStoreManager(agentRef.mainAppKey, 1);
|
|
46
|
+
this.events = new _eventStoreManager.EventStoreManager(agentRef.mainAppKey, 1, agentRef.agentIdentifier, this.featureName);
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
this.harvestOpts = {}; // features aggregate classes can define custom opts for when their harvest is called
|
|
@@ -145,16 +145,14 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
145
145
|
} catch (err) {
|
|
146
146
|
// do nothing
|
|
147
147
|
}
|
|
148
|
-
(0, _configure.configure)({
|
|
149
|
-
agentIdentifier: this.agentIdentifier
|
|
150
|
-
}, {
|
|
148
|
+
(0, _configure.configure)(existingAgent, {
|
|
151
149
|
...cdn,
|
|
152
150
|
info: {
|
|
153
151
|
...cdn.info,
|
|
154
152
|
jsAttributes
|
|
155
153
|
},
|
|
156
154
|
runtime: existingAgent.runtime
|
|
157
|
-
});
|
|
155
|
+
}, existingAgent.runtime.loaderType);
|
|
158
156
|
}
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -170,7 +168,7 @@ class AggregateBase extends _featureBase.FeatureBase {
|
|
|
170
168
|
appId: agentRef.info.applicationID
|
|
171
169
|
};
|
|
172
170
|
// Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
|
|
173
|
-
if (!agentRef.sharedAggregator) agentRef.sharedAggregator = new _eventStoreManager.EventStoreManager(agentRef.mainAppKey, 2);
|
|
171
|
+
if (!agentRef.sharedAggregator) agentRef.sharedAggregator = new _eventStoreManager.EventStoreManager(agentRef.mainAppKey, 2, agentRef.agentIdentifier, 'shared_aggregator');
|
|
174
172
|
if (!agentRef.runtime.harvester) agentRef.runtime.harvester = new _harvester.Harvester(agentRef);
|
|
175
173
|
}
|
|
176
174
|
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.EventStoreManager = void 0;
|
|
7
7
|
var _eventAggregator = require("../../common/aggregate/event-aggregator");
|
|
8
|
+
var _globalEvent = require("../../common/dispatch/global-event");
|
|
9
|
+
var _featureFlags = require("../../common/util/feature-flags");
|
|
8
10
|
var _eventBuffer = require("./event-buffer");
|
|
9
11
|
/**
|
|
10
12
|
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
@@ -19,12 +21,16 @@ class EventStoreManager {
|
|
|
19
21
|
/**
|
|
20
22
|
* @param {object} defaultTarget - should contain licenseKey and appId of the main app from NREUM.info at startup
|
|
21
23
|
* @param {1|2} storageChoice - the type of storage to use in this manager; 'EventBuffer' (1), 'EventAggregator' (2)
|
|
24
|
+
* @param {string} agentIdentifier - agent identifier used in inspection events
|
|
25
|
+
* @param {string} featureName - feature name used in inspection events for non-shared aggregators
|
|
22
26
|
*/
|
|
23
|
-
constructor(defaultTarget, storageChoice) {
|
|
27
|
+
constructor(defaultTarget, storageChoice, agentIdentifier, featureName) {
|
|
24
28
|
this.mainApp = defaultTarget;
|
|
25
29
|
this.StorageClass = storageChoice === 1 ? _eventBuffer.EventBuffer : _eventAggregator.EventAggregator;
|
|
26
30
|
this.appStorageMap = new Map();
|
|
27
31
|
this.appStorageMap.set(defaultTarget, new this.StorageClass());
|
|
32
|
+
this.agentIdentifier = agentIdentifier;
|
|
33
|
+
this.featureName = featureName;
|
|
28
34
|
}
|
|
29
35
|
|
|
30
36
|
// This class must contain an union of all methods from all supported storage classes and conceptualize away the target app argument.
|
|
@@ -50,6 +56,14 @@ class EventStoreManager {
|
|
|
50
56
|
* @returns {boolean} True if the event was successfully added
|
|
51
57
|
*/
|
|
52
58
|
add(event, target) {
|
|
59
|
+
(0, _globalEvent.dispatchGlobalEvent)({
|
|
60
|
+
agentIdentifier: this.agentIdentifier,
|
|
61
|
+
drained: !!_featureFlags.activatedFeatures?.[this.agentIdentifier],
|
|
62
|
+
type: 'data',
|
|
63
|
+
name: 'buffer',
|
|
64
|
+
feature: this.featureName,
|
|
65
|
+
data: event
|
|
66
|
+
});
|
|
53
67
|
if (target && !this.appStorageMap.has(target)) this.appStorageMap.set(target, new this.StorageClass());
|
|
54
68
|
return this.appStorageMap.get(target || this.mainApp).add(event);
|
|
55
69
|
}
|
|
@@ -13,7 +13,7 @@ var _nreum = require("../../common/window/nreum");
|
|
|
13
13
|
const debugId = 1;
|
|
14
14
|
const newrelic = (0, _nreum.gosCDN)();
|
|
15
15
|
function debugNR1(agentIdentifier, location, event, otherprops = {}, debugName = 'SR') {
|
|
16
|
-
const api = agentIdentifier ? newrelic.initializedAgents[agentIdentifier].
|
|
16
|
+
const api = agentIdentifier ? newrelic.initializedAgents[agentIdentifier].addPageAction : newrelic.addPageAction;
|
|
17
17
|
let url;
|
|
18
18
|
try {
|
|
19
19
|
const locURL = new URL(window.location);
|
|
@@ -25,7 +25,7 @@ class AgentBase extends _microAgentBase.MicroAgentBase {
|
|
|
25
25
|
* @param {...any} args
|
|
26
26
|
*/
|
|
27
27
|
#callMethod(methodName, ...args) {
|
|
28
|
-
if (
|
|
28
|
+
if (this[methodName] === AgentBase.prototype[methodName] || this[methodName] === _microAgentBase.MicroAgentBase.prototype[methodName]) (0, _console.warn)(35, methodName);else return this[methodName](...args);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -76,6 +76,9 @@ class Agent extends _agentBase.AgentBase {
|
|
|
76
76
|
runtime: this.runtime
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
get api() {
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
79
82
|
run() {
|
|
80
83
|
// Attempt to initialize all the requested features (sequentially in prio order & synchronously), with any failure aborting the whole process.
|
|
81
84
|
try {
|
|
@@ -103,7 +106,6 @@ class Agent extends _agentBase.AgentBase {
|
|
|
103
106
|
this.features[featName].abortHandler?.();
|
|
104
107
|
}
|
|
105
108
|
const newrelic = (0, _nreum.gosNREUM)();
|
|
106
|
-
delete newrelic.initializedAgents[this.agentIdentifier]?.api; // prevent further calls to agent-specific APIs (see "configure.js")
|
|
107
109
|
delete newrelic.initializedAgents[this.agentIdentifier]?.features; // GC mem used internally by features
|
|
108
110
|
delete this.sharedAggregator;
|
|
109
111
|
// Keep the initialized agent object with its configs for troubleshooting purposes.
|