@newrelic/browser-agent 1.252.1 → 1.254.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 +25 -0
- package/README.md +2 -2
- package/dist/cjs/cdn/experimental.js +6 -2
- package/dist/cjs/cdn/polyfills.js +2 -1
- package/dist/cjs/cdn/spa.js +5 -3
- package/dist/cjs/common/aggregate/aggregator.js +1 -8
- package/dist/cjs/common/config/state/init.js +7 -0
- package/dist/cjs/common/config/state/runtime.js +4 -1
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/drain/drain.js +41 -27
- package/dist/cjs/common/event-emitter/contextual-ee.js +17 -12
- package/dist/cjs/common/harvest/harvest.js +5 -1
- package/dist/cjs/common/session/constants.js +2 -1
- package/dist/cjs/common/timing/nav-timing.js +8 -3
- package/dist/cjs/common/timing/now.js +1 -1
- package/dist/cjs/common/timing/time-keeper.js +94 -0
- package/dist/cjs/common/util/feature-flags.js +14 -31
- package/dist/cjs/common/wrap/index.js +0 -7
- package/dist/cjs/features/ajax/aggregate/index.js +41 -29
- package/dist/cjs/features/jserrors/aggregate/index.js +96 -84
- package/dist/cjs/features/metrics/aggregate/index.js +25 -24
- package/dist/cjs/features/page_action/aggregate/index.js +6 -4
- package/dist/cjs/features/page_view_event/aggregate/index.js +23 -3
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -0
- package/dist/cjs/features/page_view_timing/aggregate/index.js +15 -16
- package/dist/cjs/features/session_replay/aggregate/index.js +102 -92
- package/dist/cjs/features/session_replay/constants.js +5 -1
- package/dist/cjs/features/session_replay/instrument/index.js +24 -8
- package/dist/cjs/features/session_replay/shared/utils.js +26 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +11 -8
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +50 -0
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +29 -0
- package/dist/cjs/features/soft_navigations/aggregate/index.js +268 -0
- package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +62 -0
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +146 -0
- package/dist/cjs/features/soft_navigations/constants.js +31 -0
- package/dist/cjs/features/soft_navigations/index.js +12 -0
- package/dist/cjs/features/soft_navigations/instrument/index.js +79 -0
- package/dist/cjs/features/spa/aggregate/index.js +23 -18
- package/dist/cjs/features/utils/agent-session.js +2 -1
- package/dist/cjs/features/utils/aggregate-base.js +18 -5
- package/dist/cjs/features/utils/feature-base.js +2 -0
- package/dist/cjs/features/utils/instrument-base.js +7 -9
- package/dist/cjs/features/utils/lazy-feature-loader.js +2 -0
- package/dist/cjs/loaders/agent-base.js +13 -3
- package/dist/cjs/loaders/agent.js +19 -22
- package/dist/cjs/loaders/api/api-methods.js +2 -1
- package/dist/cjs/loaders/api/api.js +15 -12
- package/dist/cjs/loaders/configure/configure.js +5 -2
- package/dist/cjs/loaders/configure/nonce.cdn.js +13 -0
- package/dist/cjs/loaders/configure/nonce.js +2 -13
- package/dist/cjs/loaders/configure/public-path.cdn.js +16 -0
- package/dist/cjs/loaders/configure/public-path.js +2 -8
- package/dist/cjs/loaders/features/enabled-features.js +1 -1
- package/dist/cjs/loaders/features/features.js +3 -1
- package/dist/esm/cdn/experimental.js +5 -2
- package/dist/esm/cdn/polyfills.js +2 -1
- package/dist/esm/cdn/spa.js +3 -1
- package/dist/esm/common/aggregate/aggregator.js +1 -8
- package/dist/esm/common/config/state/init.js +7 -0
- package/dist/esm/common/config/state/runtime.js +4 -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/drain/drain.js +40 -27
- package/dist/esm/common/event-emitter/contextual-ee.js +17 -12
- package/dist/esm/common/harvest/harvest.js +5 -1
- package/dist/esm/common/session/constants.js +1 -0
- package/dist/esm/common/timing/nav-timing.js +8 -3
- package/dist/esm/common/timing/now.js +1 -1
- package/dist/esm/common/timing/time-keeper.js +88 -0
- package/dist/esm/common/util/feature-flags.js +14 -31
- package/dist/esm/common/wrap/index.js +1 -2
- package/dist/esm/features/ajax/aggregate/index.js +43 -31
- package/dist/esm/features/jserrors/aggregate/index.js +96 -84
- package/dist/esm/features/metrics/aggregate/index.js +25 -24
- package/dist/esm/features/page_action/aggregate/index.js +6 -4
- package/dist/esm/features/page_view_event/aggregate/index.js +23 -3
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -0
- package/dist/esm/features/page_view_timing/aggregate/index.js +15 -16
- package/dist/esm/features/session_replay/aggregate/index.js +103 -93
- package/dist/esm/features/session_replay/constants.js +4 -0
- package/dist/esm/features/session_replay/instrument/index.js +25 -9
- package/dist/esm/features/session_replay/shared/utils.js +17 -0
- package/dist/esm/features/session_trace/aggregate/index.js +11 -8
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +43 -0
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +22 -0
- package/dist/esm/features/soft_navigations/aggregate/index.js +261 -0
- package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +55 -0
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +140 -0
- package/dist/esm/features/soft_navigations/constants.js +25 -0
- package/dist/esm/features/soft_navigations/index.js +1 -0
- package/dist/esm/features/soft_navigations/instrument/index.js +73 -0
- package/dist/esm/features/spa/aggregate/index.js +23 -18
- package/dist/esm/features/utils/agent-session.js +2 -1
- package/dist/esm/features/utils/aggregate-base.js +18 -5
- package/dist/esm/features/utils/feature-base.js +2 -0
- package/dist/esm/features/utils/instrument-base.js +8 -10
- package/dist/esm/features/utils/lazy-feature-loader.js +2 -0
- package/dist/esm/loaders/agent-base.js +13 -3
- package/dist/esm/loaders/agent.js +19 -22
- package/dist/esm/loaders/api/api-methods.js +2 -1
- package/dist/esm/loaders/api/api.js +15 -12
- package/dist/esm/loaders/configure/configure.js +5 -2
- package/dist/esm/loaders/configure/nonce.cdn.js +11 -0
- package/dist/esm/loaders/configure/nonce.js +1 -11
- package/dist/esm/loaders/configure/public-path.cdn.js +9 -0
- package/dist/esm/loaders/configure/public-path.js +2 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/features/features.js +3 -1
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/drain/drain.d.ts +6 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -1
- package/dist/types/common/event-emitter/contextual-ee.d.ts +2 -1
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/constants.d.ts +1 -0
- package/dist/types/common/session/constants.d.ts.map +1 -1
- package/dist/types/common/timing/nav-timing.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +31 -0
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -0
- package/dist/types/common/util/feature-flags.d.ts +11 -2
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/wrap/index.d.ts +1 -2
- package/dist/types/common/wrap/index.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +5 -5
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +4 -3
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +0 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/constants.d.ts +4 -0
- package/dist/types/features/session_replay/constants.d.ts.map +1 -1
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/utils.d.ts +4 -0
- package/dist/types/features/session_replay/shared/utils.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +19 -0
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts +16 -0
- package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/aggregate/index.d.ts +34 -0
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/aggregate/initial-page-load-interaction.d.ts +12 -0
- package/dist/types/features/soft_navigations/aggregate/initial-page-load-interaction.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +50 -0
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/constants.d.ts +20 -0
- package/dist/types/features/soft_navigations/constants.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/index.d.ts +2 -0
- package/dist/types/features/soft_navigations/index.d.ts.map +1 -0
- package/dist/types/features/soft_navigations/instrument/index.d.ts +7 -0
- package/dist/types/features/soft_navigations/instrument/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/index.d.ts +2 -0
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +2 -2
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/feature-base.d.ts +1 -0
- package/dist/types/features/utils/feature-base.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts +1 -7
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +5 -1
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts +2 -2
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api-methods.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +3 -5
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/configure/public-path.d.ts +1 -1
- package/dist/types/loaders/configure/public-path.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts +0 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cdn/experimental.js +4 -2
- package/src/cdn/polyfills.js +1 -0
- package/src/cdn/spa.js +3 -1
- package/src/common/aggregate/aggregator.js +2 -11
- package/src/common/config/state/init.js +3 -1
- package/src/common/config/state/runtime.js +4 -1
- package/src/common/drain/drain.js +41 -28
- package/src/common/event-emitter/contextual-ee.js +21 -13
- package/src/common/harvest/harvest.js +4 -1
- package/src/common/session/constants.js +1 -0
- package/src/common/timing/nav-timing.js +7 -3
- package/src/common/timing/now.js +1 -1
- package/src/common/timing/time-keeper.js +96 -0
- package/src/common/util/feature-flags.js +13 -31
- package/src/common/wrap/index.js +1 -2
- package/src/features/ajax/aggregate/index.js +43 -33
- package/src/features/jserrors/aggregate/index.js +82 -87
- package/src/features/metrics/aggregate/index.js +18 -17
- package/src/features/page_action/aggregate/index.js +6 -5
- package/src/features/page_view_event/aggregate/index.js +19 -3
- package/src/features/page_view_event/aggregate/initialized-features.js +1 -0
- package/src/features/page_view_timing/aggregate/index.js +15 -15
- package/src/features/session_replay/aggregate/index.js +95 -92
- package/src/features/session_replay/constants.js +5 -0
- package/src/features/session_replay/instrument/index.js +24 -9
- package/src/features/session_replay/shared/utils.js +19 -0
- package/src/features/session_trace/aggregate/index.js +2 -2
- package/src/features/soft_navigations/aggregate/ajax-node.js +57 -0
- package/src/features/soft_navigations/aggregate/bel-node.js +26 -0
- package/src/features/soft_navigations/aggregate/index.js +256 -0
- package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +53 -0
- package/src/features/soft_navigations/aggregate/interaction.js +159 -0
- package/src/features/soft_navigations/constants.js +29 -0
- package/src/features/soft_navigations/index.js +1 -0
- package/src/features/soft_navigations/instrument/index.js +67 -0
- package/src/features/spa/aggregate/index.js +20 -17
- package/src/features/utils/agent-session.js +2 -1
- package/src/features/utils/aggregate-base.js +16 -8
- package/src/features/utils/feature-base.js +3 -0
- package/src/features/utils/instrument-base.js +8 -10
- package/src/features/utils/lazy-feature-loader.js +2 -0
- package/src/loaders/agent-base.js +13 -3
- package/src/loaders/agent.js +20 -19
- package/src/loaders/api/api-methods.js +4 -1
- package/src/loaders/api/api.js +15 -13
- package/src/loaders/configure/configure.js +4 -1
- package/src/loaders/configure/nonce.cdn.js +12 -0
- package/src/loaders/configure/nonce.js +1 -12
- package/src/loaders/configure/public-path.cdn.js +9 -0
- package/src/loaders/configure/public-path.js +2 -8
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/features/features.js +3 -1
- package/dist/cjs/common/wrap/wrap-raf.js +0 -55
- package/dist/cjs/loaders/configure/nonce.npm.js +0 -2
- package/dist/cjs/loaders/configure/public-path.npm.js +0 -10
- package/dist/esm/common/wrap/wrap-raf.js +0 -48
- package/dist/esm/loaders/configure/nonce.npm.js +0 -1
- package/dist/esm/loaders/configure/public-path.npm.js +0 -3
- package/dist/types/common/wrap/wrap-raf.d.ts +0 -16
- package/dist/types/common/wrap/wrap-raf.d.ts.map +0 -1
- package/dist/types/loaders/configure/nonce.npm.d.ts +0 -1
- package/dist/types/loaders/configure/nonce.npm.d.ts.map +0 -1
- package/dist/types/loaders/configure/public-path.npm.d.ts +0 -2
- package/dist/types/loaders/configure/public-path.npm.d.ts.map +0 -1
- package/src/common/wrap/wrap-raf.js +0 -52
- package/src/loaders/configure/nonce.npm.js +0 -1
- package/src/loaders/configure/public-path.npm.js +0 -3
package/dist/esm/cdn/spa.js
CHANGED
|
@@ -10,9 +10,11 @@ import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
|
|
|
10
10
|
import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
|
|
11
11
|
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
|
|
12
12
|
import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
|
|
13
|
+
import { Instrument as InstrumentSoftNav } from '../features/soft_navigations/instrument';
|
|
13
14
|
import { Instrument as InstrumentSpa } from '../features/spa/instrument';
|
|
14
15
|
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
|
|
15
16
|
new Agent({
|
|
16
|
-
features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSpa
|
|
17
|
+
features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSoftNav, InstrumentSpa // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
|
|
18
|
+
],
|
|
17
19
|
loaderType: 'spa'
|
|
18
20
|
});
|
|
@@ -77,7 +77,7 @@ export class Aggregator extends SharedContext {
|
|
|
77
77
|
var hasData = false;
|
|
78
78
|
for (var i = 0; i < types.length; i++) {
|
|
79
79
|
type = types[i];
|
|
80
|
-
results[type] =
|
|
80
|
+
results[type] = Object.values(this.aggregatedData[type] || {});
|
|
81
81
|
if (results[type].length) hasData = true;
|
|
82
82
|
delete this.aggregatedData[type];
|
|
83
83
|
}
|
|
@@ -151,11 +151,4 @@ function createMetricObject(value) {
|
|
|
151
151
|
sos: value * value,
|
|
152
152
|
c: 1
|
|
153
153
|
};
|
|
154
|
-
}
|
|
155
|
-
function toArray(obj) {
|
|
156
|
-
if (typeof obj !== 'object') return [];
|
|
157
|
-
return mapOwn(obj, getValue);
|
|
158
|
-
}
|
|
159
|
-
function getValue(key, value) {
|
|
160
|
-
return value;
|
|
161
154
|
}
|
|
@@ -98,6 +98,8 @@ const model = () => {
|
|
|
98
98
|
autoStart: true,
|
|
99
99
|
enabled: false,
|
|
100
100
|
harvestTimeSeconds: 60,
|
|
101
|
+
preload: false,
|
|
102
|
+
// if true, enables the agent to load rrweb immediately instead of waiting to do so after the window.load event
|
|
101
103
|
sampling_rate: 10,
|
|
102
104
|
// float from 0 - 100
|
|
103
105
|
error_sampling_rate: 100,
|
|
@@ -150,6 +152,11 @@ const model = () => {
|
|
|
150
152
|
enabled: true,
|
|
151
153
|
harvestTimeSeconds: 10,
|
|
152
154
|
autoStart: true
|
|
155
|
+
},
|
|
156
|
+
soft_navigations: {
|
|
157
|
+
enabled: true,
|
|
158
|
+
harvestTimeSeconds: 10,
|
|
159
|
+
autoStart: true
|
|
153
160
|
}
|
|
154
161
|
};
|
|
155
162
|
};
|
|
@@ -17,10 +17,13 @@ const model = {
|
|
|
17
17
|
origin: '' + globalScope.location,
|
|
18
18
|
ptid: undefined,
|
|
19
19
|
releaseIds: {},
|
|
20
|
+
/** Agent-specific metadata found in the RUM call response. ex. entityGuid */
|
|
21
|
+
appMetadata: {},
|
|
20
22
|
session: undefined,
|
|
21
23
|
xhrWrappable: typeof globalScope.XMLHttpRequest?.prototype?.addEventListener === 'function',
|
|
22
24
|
version: VERSION,
|
|
23
|
-
denyList: undefined
|
|
25
|
+
denyList: undefined,
|
|
26
|
+
harvestCount: 0
|
|
24
27
|
};
|
|
25
28
|
const _cache = {};
|
|
26
29
|
export function getRuntime(id) {
|
|
@@ -28,13 +28,24 @@ export function registerDrain(agentIdentifier, group) {
|
|
|
28
28
|
if (!registry[agentIdentifier].get(group)) registry[agentIdentifier].set(group, item);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Removes an item from the registry and immediately re-checks if the registry is ready to "drain all"
|
|
33
|
+
* @param {*} agentIdentifier - A 16 character string uniquely identifying the agent.
|
|
34
|
+
* @param {*} group - The named "bucket" to be removed from the registry
|
|
35
|
+
*/
|
|
36
|
+
export function deregisterDrain(agentIdentifier, group) {
|
|
37
|
+
curateRegistry(agentIdentifier);
|
|
38
|
+
if (registry[agentIdentifier].get(group)) registry[agentIdentifier].delete(group);
|
|
39
|
+
if (registry[agentIdentifier].size) checkCanDrainAll(agentIdentifier);
|
|
40
|
+
}
|
|
41
|
+
|
|
31
42
|
/**
|
|
32
43
|
* Registers the specified agent with the centralized event buffer registry if it is not already registered.
|
|
33
44
|
* Agents without an identifier (as in the case of some tests) will be excluded from the registry.
|
|
34
45
|
* @param {string} agentIdentifier - A 16 character string uniquely identifying an agent.
|
|
35
46
|
*/
|
|
36
47
|
function curateRegistry(agentIdentifier) {
|
|
37
|
-
if (!agentIdentifier)
|
|
48
|
+
if (!agentIdentifier) throw new Error('agentIdentifier required');
|
|
38
49
|
if (!registry[agentIdentifier]) registry[agentIdentifier] = new Map();
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -53,11 +64,15 @@ export function drain() {
|
|
|
53
64
|
// If the feature for the specified agent is not in the registry, that means the instrument file was bypassed.
|
|
54
65
|
// This could happen in tests, or loaders that directly import the aggregator. In these cases it is safe to
|
|
55
66
|
// drain the feature group immediately rather than waiting to drain all at once.
|
|
56
|
-
if (!agentIdentifier || !registry[agentIdentifier].get(featureName) || force) return drainGroup(featureName);
|
|
67
|
+
if (!agentIdentifier || !registry[agentIdentifier].get(featureName) || force) return drainGroup(agentIdentifier, featureName);
|
|
57
68
|
|
|
58
69
|
// When `drain` is called, this feature is ready to drain (staged).
|
|
59
70
|
registry[agentIdentifier].get(featureName).staged = true;
|
|
71
|
+
checkCanDrainAll(agentIdentifier);
|
|
72
|
+
}
|
|
60
73
|
|
|
74
|
+
/** Checks all items in the registry to see if they have been "staged". If ALL items are staged, it will drain all registry items (drainGroup). It not, nothing will happen */
|
|
75
|
+
function checkCanDrainAll(agentIdentifier) {
|
|
61
76
|
// Only when the event-groups for all features are ready to drain (staged) do we execute the drain. This has the effect
|
|
62
77
|
// that the last feature to call drain triggers drain for all features.
|
|
63
78
|
const items = [...registry[agentIdentifier]];
|
|
@@ -69,40 +84,38 @@ export function drain() {
|
|
|
69
84
|
items.forEach(_ref2 => {
|
|
70
85
|
let [group] = _ref2;
|
|
71
86
|
registry[agentIdentifier].delete(group);
|
|
72
|
-
drainGroup(group);
|
|
87
|
+
drainGroup(agentIdentifier, group);
|
|
73
88
|
});
|
|
74
89
|
}
|
|
90
|
+
}
|
|
75
91
|
|
|
76
|
-
|
|
92
|
+
/**
|
|
77
93
|
* Drains all the buffered (backlog) events for a particular feature's event-group by emitting each event to each of
|
|
78
94
|
* the subscribed handlers for the group.
|
|
79
95
|
* @param {*} group - The name of a particular feature's event "bucket".
|
|
80
96
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
mapOwn(groupHandlers, function (eventType, handlerRegistrationList) {
|
|
94
|
-
mapOwn(handlerRegistrationList, function (i, registration) {
|
|
95
|
-
// registration is an array of: [targetEE, eventHandler]
|
|
96
|
-
registration[0].on(eventType, registration[1]);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
97
|
+
function drainGroup(agentIdentifier, group) {
|
|
98
|
+
const baseEE = agentIdentifier ? ee.get(agentIdentifier) : ee;
|
|
99
|
+
const handlers = defaultRegister.handlers; // other storage in registerHandler
|
|
100
|
+
if (!baseEE.backlog || !handlers) return;
|
|
101
|
+
var bufferedEventsInGroup = baseEE.backlog[group];
|
|
102
|
+
var groupHandlers = handlers[group]; // each group in the registerHandler storage
|
|
103
|
+
if (groupHandlers) {
|
|
104
|
+
// We don't cache the length of the buffer while looping because events might still be added while processing.
|
|
105
|
+
for (var i = 0; bufferedEventsInGroup && i < bufferedEventsInGroup.length; ++i) {
|
|
106
|
+
// eslint-disable-line no-unmodified-loop-condition
|
|
107
|
+
emitEvent(bufferedEventsInGroup[i], groupHandlers);
|
|
99
108
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
109
|
+
mapOwn(groupHandlers, function (eventType, handlerRegistrationList) {
|
|
110
|
+
mapOwn(handlerRegistrationList, function (i, registration) {
|
|
111
|
+
// registration is an array of: [targetEE, eventHandler]
|
|
112
|
+
registration[0].on(eventType, registration[1]);
|
|
113
|
+
});
|
|
114
|
+
});
|
|
105
115
|
}
|
|
116
|
+
if (!baseEE.isolatedBacklog) delete handlers[group];
|
|
117
|
+
baseEE.backlog[group] = null;
|
|
118
|
+
baseEE.emit('drain-' + group, []);
|
|
106
119
|
}
|
|
107
120
|
|
|
108
121
|
/**
|
|
@@ -46,11 +46,26 @@ function ee(old, debugId) {
|
|
|
46
46
|
context,
|
|
47
47
|
buffer: bufferEventsByGroup,
|
|
48
48
|
abort,
|
|
49
|
-
aborted: false,
|
|
50
49
|
isBuffering,
|
|
51
50
|
debugId,
|
|
52
|
-
backlog: isolatedBacklog ? {} : old && typeof old.backlog === 'object' ? old.backlog : {}
|
|
51
|
+
backlog: isolatedBacklog ? {} : old && typeof old.backlog === 'object' ? old.backlog : {},
|
|
52
|
+
isolatedBacklog
|
|
53
53
|
};
|
|
54
|
+
function abort() {
|
|
55
|
+
emitter._aborted = true;
|
|
56
|
+
Object.keys(emitter.backlog).forEach(key => {
|
|
57
|
+
delete emitter.backlog[key];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
Object.defineProperty(emitter, 'aborted', {
|
|
61
|
+
get: () => {
|
|
62
|
+
let aborted = emitter._aborted || false;
|
|
63
|
+
if (aborted) return aborted;else if (old) {
|
|
64
|
+
aborted = old.aborted;
|
|
65
|
+
}
|
|
66
|
+
return aborted;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
54
69
|
return emitter;
|
|
55
70
|
function context(contextOrStore) {
|
|
56
71
|
if (contextOrStore && contextOrStore instanceof EventContext) {
|
|
@@ -128,14 +143,4 @@ function ee(old, debugId) {
|
|
|
128
143
|
function getBuffer() {
|
|
129
144
|
return emitter.backlog;
|
|
130
145
|
}
|
|
131
|
-
}
|
|
132
|
-
function abort() {
|
|
133
|
-
globalInstance.aborted = true;
|
|
134
|
-
// The global backlog can be referenced directly by other emitters,
|
|
135
|
-
// so we need to delete its contents as opposed to replacing it.
|
|
136
|
-
// Otherwise, these references to the old backlog would still exist
|
|
137
|
-
// and the keys will not be garbage collected.
|
|
138
|
-
Object.keys(globalInstance.backlog).forEach(key => {
|
|
139
|
-
delete globalInstance.backlog[key];
|
|
140
|
-
});
|
|
141
146
|
}
|
|
@@ -177,7 +177,9 @@ export class Harvest extends SharedContext {
|
|
|
177
177
|
// status 0 refers to a local error, such as CORS or network failure, or a blocked request by the browser (e.g. adblocker)
|
|
178
178
|
const cbResult = {
|
|
179
179
|
sent: this.status !== 0,
|
|
180
|
-
status: this.status
|
|
180
|
+
status: this.status,
|
|
181
|
+
xhr: this,
|
|
182
|
+
fullUrl
|
|
181
183
|
};
|
|
182
184
|
if (this.status === 429) {
|
|
183
185
|
cbResult.retry = true;
|
|
@@ -191,6 +193,8 @@ export class Harvest extends SharedContext {
|
|
|
191
193
|
cbFinished(cbResult);
|
|
192
194
|
}, eventListenerOpts(false));
|
|
193
195
|
}
|
|
196
|
+
const runtime = getRuntime(this.sharedContext.agentIdentifier);
|
|
197
|
+
runtime.harvestCount++;
|
|
194
198
|
return result;
|
|
195
199
|
}
|
|
196
200
|
|
|
@@ -24,7 +24,7 @@ var REQUEST = 'request';
|
|
|
24
24
|
var RESPONSE = 'response';
|
|
25
25
|
var LOAD_EVENT = 'loadEvent';
|
|
26
26
|
var DOM_CONTENT_LOAD_EVENT = 'domContentLoadedEvent';
|
|
27
|
-
export
|
|
27
|
+
export const navTimingValues = [];
|
|
28
28
|
function getPntType(type) {
|
|
29
29
|
if (typeof type === 'number') return type;
|
|
30
30
|
const types = {
|
|
@@ -70,6 +70,11 @@ export function addPN(pn, v) {
|
|
|
70
70
|
handleValue(pn.redirectCount, v, 'rc');
|
|
71
71
|
return v;
|
|
72
72
|
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* By side effect, this modifies 'obj' with a mapping of the 'prop' provided to a 'value', and invalid values are not added.
|
|
76
|
+
* On the other hand, the local navTimingValues array gets the value appended if valid and 'undefined' appended if invalid, regardless.
|
|
77
|
+
*/
|
|
73
78
|
function handleValue(value, obj, prop, isOldApi) {
|
|
74
79
|
/*
|
|
75
80
|
For L2 Timing API, the value will already be a relative-to-previous-document DOMHighResTimeStamp.
|
|
@@ -84,6 +89,6 @@ function handleValue(value, obj, prop, isOldApi) {
|
|
|
84
89
|
}
|
|
85
90
|
value = Math.round(value);
|
|
86
91
|
obj[prop] = value;
|
|
87
|
-
|
|
88
|
-
navTimingValues.push(
|
|
92
|
+
navTimingValues.push(value);
|
|
93
|
+
} else navTimingValues.push(undefined);
|
|
89
94
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { gosNREUM } from '../window/nreum';
|
|
2
|
+
import { globalScope } from '../constants/runtime';
|
|
3
|
+
import { getRuntime } from '../config/config';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Class used to adjust the timestamp of harvested data to New Relic server time. This
|
|
7
|
+
* is done by tracking the performance timings of the RUM call and applying a calculation
|
|
8
|
+
* to the harvested data event offset time.
|
|
9
|
+
*/
|
|
10
|
+
export class TimeKeeper {
|
|
11
|
+
#agent;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the browser origin time corrected to NR server time.
|
|
15
|
+
* @type {number}
|
|
16
|
+
*/
|
|
17
|
+
#correctedOriginTime;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the difference in milliseconds between the calculated NR server time and
|
|
21
|
+
* the local time.
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
#localTimeDiff;
|
|
25
|
+
constructor(agent) {
|
|
26
|
+
this.#agent = agent;
|
|
27
|
+
}
|
|
28
|
+
static getTimeKeeperByAgentIdentifier(agentIdentifier) {
|
|
29
|
+
const nr = gosNREUM();
|
|
30
|
+
return Object.keys(nr?.initializedAgents || {}).indexOf(agentIdentifier) > -1 ? nr.initializedAgents[agentIdentifier].timeKeeper : undefined;
|
|
31
|
+
}
|
|
32
|
+
get correctedPageOriginTime() {
|
|
33
|
+
return this.#correctedOriginTime;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Process a rum request to calculate NR server time.
|
|
38
|
+
* @param rumRequest {XMLHttpRequest} The xhr for the rum request
|
|
39
|
+
* @param rumRequestUrl {string} The full url of the rum request
|
|
40
|
+
*/
|
|
41
|
+
processRumRequest(rumRequest, rumRequestUrl) {
|
|
42
|
+
const responseDateHeader = rumRequest.getResponseHeader('Date');
|
|
43
|
+
if (!responseDateHeader) {
|
|
44
|
+
throw new Error('Missing date header on rum response.');
|
|
45
|
+
}
|
|
46
|
+
const resourceEntries = globalScope.performance.getEntriesByName(rumRequestUrl, 'resource');
|
|
47
|
+
if (!Array.isArray(resourceEntries) || resourceEntries.length === 0) {
|
|
48
|
+
throw new Error('Missing rum request performance entry.');
|
|
49
|
+
}
|
|
50
|
+
let medianRumOffset = 0;
|
|
51
|
+
let serverOffset = 0;
|
|
52
|
+
if (typeof resourceEntries[0].responseStart === 'number' && resourceEntries[0].responseStart !== 0) {
|
|
53
|
+
// Cors is enabled and we can make a more accurate calculation of NR server time
|
|
54
|
+
medianRumOffset = (resourceEntries[0].responseStart - resourceEntries[0].requestStart) / 2;
|
|
55
|
+
serverOffset = Math.floor(resourceEntries[0].requestStart + medianRumOffset);
|
|
56
|
+
} else {
|
|
57
|
+
// Cors is disabled or erred, we need to use a less accurate calculation
|
|
58
|
+
medianRumOffset = (resourceEntries[0].responseEnd - resourceEntries[0].fetchStart) / 2;
|
|
59
|
+
serverOffset = Math.floor(resourceEntries[0].fetchStart + medianRumOffset);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Corrected page origin time
|
|
63
|
+
this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
|
|
64
|
+
this.#localTimeDiff = getRuntime(this.#agent.agentIdentifier).offset - this.#correctedOriginTime;
|
|
65
|
+
if (Number.isNaN(this.#correctedOriginTime)) {
|
|
66
|
+
throw new Error('Date header invalid format.');
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Converts a page origin relative time to an absolute timestamp
|
|
72
|
+
* corrected to NR server time.
|
|
73
|
+
* @param relativeTime {number} The relative time of the event in milliseconds
|
|
74
|
+
* @returns {number} The correct timestamp as a unix/epoch timestamp value
|
|
75
|
+
*/
|
|
76
|
+
convertRelativeTimestamp(relativeTime) {
|
|
77
|
+
return this.#correctedOriginTime + relativeTime;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Corrects an event timestamp to NR server time.
|
|
82
|
+
* @param timestamp {number} The unix/epoch timestamp of the event with milliseconds
|
|
83
|
+
* @return {number} Corrected unix/epoch timestamp
|
|
84
|
+
*/
|
|
85
|
+
correctAbsoluteTimestamp(timestamp) {
|
|
86
|
+
return Math.floor(timestamp - this.#localTimeDiff);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -3,47 +3,30 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { ee } from '../event-emitter/contextual-ee';
|
|
6
|
-
import { handle } from '../event-emitter/handle';
|
|
7
|
-
import { FEATURE_NAMES } from '../../loaders/features/features';
|
|
8
6
|
import { dispatchGlobalEvent } from '../dispatch/global-event';
|
|
9
|
-
const bucketMap = {
|
|
10
|
-
stn: [FEATURE_NAMES.sessionTrace],
|
|
11
|
-
err: [FEATURE_NAMES.jserrors, FEATURE_NAMES.metrics],
|
|
12
|
-
ins: [FEATURE_NAMES.pageAction],
|
|
13
|
-
spa: [FEATURE_NAMES.spa],
|
|
14
|
-
sr: [FEATURE_NAMES.sessionReplay, FEATURE_NAMES.sessionTrace]
|
|
15
|
-
};
|
|
16
7
|
const sentIds = new Set();
|
|
17
8
|
|
|
18
|
-
/**
|
|
9
|
+
/** A map of feature flags and their values as provided by the rum call -- scoped by agent ID */
|
|
10
|
+
export const activatedFeatures = {};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Sets the activatedFeatures object, dispatches the global loaded event,
|
|
14
|
+
* and emits the rumresp flag to features
|
|
15
|
+
* @param {{[key:string]:number}} flags key-val pair of flag names and numeric
|
|
16
|
+
* @param {string} agentIdentifier agent instance identifier
|
|
17
|
+
* @returns {void}
|
|
18
|
+
*/
|
|
19
19
|
export function activateFeatures(flags, agentIdentifier) {
|
|
20
20
|
const sharedEE = ee.get(agentIdentifier);
|
|
21
|
+
activatedFeatures[agentIdentifier] ??= {};
|
|
21
22
|
if (!(flags && typeof flags === 'object')) return;
|
|
22
23
|
if (sentIds.has(agentIdentifier)) return;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (bucketMap[flag]) {
|
|
26
|
-
bucketMap[flag].forEach(feat => {
|
|
27
|
-
if (!num) handle('block-' + flag, [], undefined, feat, sharedEE);else handle('feat-' + flag, [], undefined, feat, sharedEE);
|
|
28
|
-
handle('rumresp-' + flag, [Boolean(num)], undefined, feat, sharedEE); // this is a duplicate of feat-/block- but makes awaiting for 1 event easier than 2
|
|
29
|
-
});
|
|
30
|
-
} else if (num) handle('feat-' + flag, [], undefined, undefined, sharedEE); // not sure what other flags are overlooked, but there's a test for ones not in the map --
|
|
31
|
-
activatedFeatures[flag] = Boolean(num);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// Let the features waiting on their respective flags know that RUM response was received and that any missing flags are interpreted as bad entitlement / "off".
|
|
35
|
-
// Hence, those features will not be hanging forever if their flags aren't included in the response.
|
|
36
|
-
Object.keys(bucketMap).forEach(flag => {
|
|
37
|
-
if (activatedFeatures[flag] === undefined) {
|
|
38
|
-
bucketMap[flag]?.forEach(feat => handle('rumresp-' + flag, [false], undefined, feat, sharedEE));
|
|
39
|
-
activatedFeatures[flag] = false;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
24
|
+
sharedEE.emit('rumresp', [flags]);
|
|
25
|
+
activatedFeatures[agentIdentifier] = flags;
|
|
42
26
|
sentIds.add(agentIdentifier);
|
|
43
27
|
|
|
44
28
|
// let any window level subscribers know that the agent is running
|
|
45
29
|
dispatchGlobalEvent({
|
|
46
30
|
loaded: true
|
|
47
31
|
});
|
|
48
|
-
}
|
|
49
|
-
export const activatedFeatures = {};
|
|
32
|
+
}
|
|
@@ -8,7 +8,6 @@ import { wrapHistory } from './wrap-history';
|
|
|
8
8
|
import { wrapJsonP } from './wrap-jsonp';
|
|
9
9
|
import { wrapMutation } from './wrap-mutation';
|
|
10
10
|
import { wrapPromise } from './wrap-promise';
|
|
11
|
-
import { wrapRaf } from './wrap-raf';
|
|
12
11
|
import { wrapTimer } from './wrap-timer';
|
|
13
12
|
import { wrapXhr } from './wrap-xhr';
|
|
14
|
-
export { wrapEvents, wrapFetch, wrapHistory, wrapJsonP, wrapMutation, wrapPromise,
|
|
13
|
+
export { wrapEvents, wrapFetch, wrapHistory, wrapJsonP, wrapMutation, wrapPromise, wrapTimer, wrapXhr };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { registerHandler
|
|
5
|
+
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
6
6
|
import { stringify } from '../../../common/util/stringify';
|
|
7
7
|
import { nullable, numeric, getAddStringContext, addCustomAttributes } from '../../../common/serialize/bel-serializer';
|
|
8
8
|
import { handle } from '../../../common/event-emitter/handle';
|
|
@@ -14,17 +14,21 @@ import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
|
14
14
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
15
15
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
16
16
|
import { parseGQL } from './gql';
|
|
17
|
+
import { getNREUMInitializedAgent } from '../../../common/window/nreum';
|
|
17
18
|
export class Aggregate extends AggregateBase {
|
|
18
19
|
static featureName = FEATURE_NAME;
|
|
19
20
|
constructor(agentIdentifier, aggregator) {
|
|
20
21
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
21
22
|
const agentInit = getConfiguration(agentIdentifier);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
registerHandler('xhr', storeXhr, this.featureName, this.ee);
|
|
24
|
+
this.waitForFlags([]).then(() => {
|
|
25
|
+
const scheduler = new HarvestScheduler('events', {
|
|
26
|
+
onFinished: onEventsHarvestFinished,
|
|
27
|
+
getPayload: prepareHarvest
|
|
28
|
+
}, this);
|
|
29
|
+
scheduler.startTimer(harvestTimeSeconds);
|
|
25
30
|
this.drain();
|
|
26
|
-
|
|
27
|
-
}
|
|
31
|
+
});
|
|
28
32
|
const denyList = getRuntime(agentIdentifier).denyList;
|
|
29
33
|
setDenyList(denyList);
|
|
30
34
|
let ajaxEvents = [];
|
|
@@ -43,27 +47,23 @@ export class Aggregate extends AggregateBase {
|
|
|
43
47
|
spaAjaxEvents
|
|
44
48
|
};
|
|
45
49
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
delete spaAjaxEvents[interaction.id];
|
|
50
|
-
});
|
|
51
|
-
ee.on('interactionDiscarded', interaction => {
|
|
50
|
+
|
|
51
|
+
// --- v Used by old spa feature
|
|
52
|
+
ee.on('interactionDone', (interaction, wasSaved) => {
|
|
52
53
|
if (!spaAjaxEvents[interaction.id]) return;
|
|
53
|
-
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
if (!wasSaved) {
|
|
55
|
+
// if the ixn was saved, then its ajax reqs are part of the payload whereas if it was discarded, it should still be harvested in the ajax feature itself
|
|
56
|
+
spaAjaxEvents[interaction.id].forEach(function (item) {
|
|
57
|
+
ajaxEvents.push(item);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
57
60
|
delete spaAjaxEvents[interaction.id];
|
|
58
61
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
scheduler.startTimer(harvestTimeSeconds);
|
|
65
|
-
});
|
|
66
|
-
this.drain();
|
|
62
|
+
// --- ^
|
|
63
|
+
// --- v Used by new soft nav
|
|
64
|
+
registerHandler('returnAjax', event => ajaxEvents.push(event), this.featureName, this.ee);
|
|
65
|
+
// --- ^
|
|
66
|
+
|
|
67
67
|
const beacon = getInfo(agentIdentifier).errorBeacon;
|
|
68
68
|
const proxyBeacon = agentInit.proxy.beacon;
|
|
69
69
|
function storeXhr(params, metrics, startTime, endTime, type) {
|
|
@@ -76,16 +76,25 @@ export class Aggregate extends AggregateBase {
|
|
|
76
76
|
} else {
|
|
77
77
|
hash = stringify([params.status, params.host, params.pathname]);
|
|
78
78
|
}
|
|
79
|
+
const shouldCollect = shouldCollectEvent(params);
|
|
80
|
+
const ajaxMetricDenyListEnabled = agentInit.feature_flags?.includes('ajax_metrics_deny_list');
|
|
79
81
|
|
|
80
82
|
// store as metric
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
if (shouldCollect || !ajaxMetricDenyListEnabled) {
|
|
84
|
+
aggregator.store('xhr', hash, params, metrics);
|
|
85
|
+
}
|
|
86
|
+
if (!shouldCollect) {
|
|
84
87
|
if (params.hostname === beacon || proxyBeacon && params.hostname === proxyBeacon) {
|
|
85
88
|
// This doesn't make a distinction if the same-domain request is going to a different port or path...
|
|
86
89
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Ajax/Events/Excluded/Agent'], undefined, FEATURE_NAMES.metrics, ee);
|
|
90
|
+
if (ajaxMetricDenyListEnabled) {
|
|
91
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Ajax/Metrics/Excluded/Agent'], undefined, FEATURE_NAMES.metrics, ee);
|
|
92
|
+
}
|
|
87
93
|
} else {
|
|
88
94
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Ajax/Events/Excluded/App'], undefined, FEATURE_NAMES.metrics, ee);
|
|
95
|
+
if (ajaxMetricDenyListEnabled) {
|
|
96
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['Ajax/Metrics/Excluded/App'], undefined, FEATURE_NAMES.metrics, ee);
|
|
97
|
+
}
|
|
89
98
|
}
|
|
90
99
|
return;
|
|
91
100
|
}
|
|
@@ -115,10 +124,13 @@ export class Aggregate extends AggregateBase {
|
|
|
115
124
|
query: this?.parsedOrigin?.search
|
|
116
125
|
});
|
|
117
126
|
if (event.gql) handle(SUPPORTABILITY_METRIC_CHANNEL, ['Ajax/Events/GraphQL/Bytes-Added', stringify(event.gql).length], undefined, FEATURE_NAMES.metrics, ee);
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const softNavInUse = Boolean(getNREUMInitializedAgent(agentIdentifier)?.features?.[FEATURE_NAMES.softNav]);
|
|
128
|
+
if (softNavInUse) {
|
|
129
|
+
// For newer soft nav (when running), pass the event to it for evaluation -- either part of an interaction or is given back
|
|
130
|
+
handle('ajax', [event], undefined, FEATURE_NAMES.softNav, ee);
|
|
131
|
+
} else if (this.spaNode) {
|
|
132
|
+
// For old spa (when running), if the ajax happened inside an interaction, hold it until the interaction finishes
|
|
133
|
+
const interactionId = this.spaNode.interaction.id;
|
|
122
134
|
spaAjaxEvents[interactionId] = spaAjaxEvents[interactionId] || [];
|
|
123
135
|
spaAjaxEvents[interactionId].push(event);
|
|
124
136
|
} else {
|