@newrelic/browser-agent 1.238.0 → 1.239.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/dist/cjs/common/config/state/init.js +21 -13
- package/dist/cjs/common/config/state/runtime.js +0 -4
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +3 -3
- package/dist/cjs/common/constants/shared-channel.js +3 -1
- package/dist/cjs/common/deny-list/deny-list.js +2 -8
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/event-emitter/contextual-ee.js +6 -6
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -4
- package/dist/cjs/common/harvest/harvest.js +2 -6
- package/dist/cjs/common/serialize/bel-serializer.js +1 -1
- package/dist/cjs/common/session/session-entity.js +16 -12
- package/dist/cjs/common/storage/first-party-cookies.js +5 -4
- package/dist/cjs/common/storage/local-storage.js +3 -2
- package/dist/cjs/common/timer/interaction-timer.js +14 -6
- package/dist/cjs/common/timing/nav-timing.js +1 -1
- package/dist/cjs/common/unload/eol.js +4 -30
- package/dist/cjs/common/util/feature-flags.js +14 -15
- package/dist/cjs/common/util/invoke.js +3 -1
- package/dist/cjs/common/util/obfuscate.js +3 -5
- package/dist/cjs/common/util/traverse.js +1 -0
- package/dist/cjs/common/window/page-visibility.js +1 -2
- package/dist/cjs/common/wrap/wrap-jsonp.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +5 -7
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +8 -8
- package/dist/cjs/features/ajax/instrument/index.js +47 -15
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/cjs/features/jserrors/aggregate/index.js +4 -5
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/cjs/features/metrics/aggregate/index.js +20 -37
- package/dist/cjs/features/metrics/instrument/index.js +0 -2
- package/dist/cjs/features/page_action/aggregate/index.js +17 -19
- package/dist/cjs/features/page_view_event/aggregate/index.js +1 -2
- package/dist/cjs/features/page_view_event/instrument/index.js +4 -2
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -7
- package/dist/cjs/features/session_replay/aggregate/index.js +3 -3
- package/dist/cjs/features/session_trace/aggregate/index.js +8 -8
- package/dist/cjs/features/spa/aggregate/index.js +14 -20
- package/dist/cjs/features/spa/aggregate/interaction.js +0 -2
- package/dist/cjs/features/spa/aggregate/serializer.js +1 -1
- package/dist/cjs/features/utils/aggregate-base.js +4 -0
- package/dist/cjs/features/utils/handler-cache.js +3 -1
- package/dist/cjs/features/utils/instrument-base.js +24 -6
- package/dist/cjs/loaders/agent-base.js +11 -0
- package/dist/cjs/loaders/agent.js +7 -7
- package/dist/cjs/loaders/api/api.js +21 -4
- package/dist/cjs/loaders/api/apiAsync.js +19 -20
- package/dist/cjs/loaders/configure/configure.js +3 -0
- package/dist/cjs/loaders/micro-agent.js +20 -3
- package/dist/esm/common/config/state/init.js +21 -13
- package/dist/esm/common/config/state/runtime.js +0 -4
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +1 -1
- package/dist/esm/common/constants/shared-channel.js +3 -1
- package/dist/esm/common/deny-list/deny-list.js +2 -8
- package/dist/esm/common/drain/drain.js +1 -1
- package/dist/esm/common/event-emitter/contextual-ee.js +6 -6
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -4
- package/dist/esm/common/harvest/harvest.js +2 -6
- package/dist/esm/common/serialize/bel-serializer.js +1 -1
- package/dist/esm/common/session/session-entity.js +16 -12
- package/dist/esm/common/storage/first-party-cookies.js +5 -4
- package/dist/esm/common/storage/local-storage.js +3 -2
- package/dist/esm/common/timer/interaction-timer.js +14 -6
- package/dist/esm/common/timing/nav-timing.js +1 -1
- package/dist/esm/common/unload/eol.js +5 -31
- package/dist/esm/common/util/feature-flags.js +14 -15
- package/dist/esm/common/util/invoke.js +3 -1
- package/dist/esm/common/util/obfuscate.js +3 -5
- package/dist/esm/common/util/traverse.js +1 -0
- package/dist/esm/common/window/page-visibility.js +1 -2
- package/dist/esm/common/wrap/wrap-jsonp.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +5 -7
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +8 -8
- package/dist/esm/features/ajax/instrument/index.js +47 -15
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +0 -1
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/dist/esm/features/jserrors/aggregate/index.js +4 -5
- package/dist/esm/features/metrics/aggregate/framework-detection.js +103 -7
- package/dist/esm/features/metrics/aggregate/index.js +22 -39
- package/dist/esm/features/metrics/instrument/index.js +1 -3
- package/dist/esm/features/page_action/aggregate/index.js +17 -19
- package/dist/esm/features/page_view_event/aggregate/index.js +1 -2
- package/dist/esm/features/page_view_event/instrument/index.js +4 -2
- package/dist/esm/features/page_view_timing/aggregate/index.js +7 -8
- package/dist/esm/features/session_replay/aggregate/index.js +2 -2
- package/dist/esm/features/session_trace/aggregate/index.js +8 -8
- package/dist/esm/features/spa/aggregate/index.js +14 -20
- package/dist/esm/features/spa/aggregate/interaction.js +0 -2
- package/dist/esm/features/spa/aggregate/serializer.js +1 -1
- package/dist/esm/features/utils/aggregate-base.js +4 -0
- package/dist/esm/features/utils/handler-cache.js +3 -1
- package/dist/esm/features/utils/instrument-base.js +24 -6
- package/dist/esm/loaders/agent-base.js +11 -0
- package/dist/esm/loaders/agent.js +7 -7
- package/dist/esm/loaders/api/api.js +21 -4
- package/dist/esm/loaders/api/apiAsync.js +19 -20
- package/dist/esm/loaders/configure/configure.js +3 -0
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +21 -4
- 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/constants/runtime.d.ts +1 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts +6 -9
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts +1 -1
- package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -1
- package/dist/types/common/storage/local-storage.d.ts.map +1 -1
- package/dist/types/common/timer/interaction-timer.d.ts +3 -0
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
- package/dist/types/common/unload/eol.d.ts +1 -2
- package/dist/types/common/unload/eol.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/util/traverse.d.ts.map +1 -1
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
- 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_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +6 -0
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +1 -0
- package/dist/types/loaders/api/api.d.ts.map +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/micro-agent.d.ts +7 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +41 -12
- package/src/common/aggregate/aggregator.test.js +107 -0
- package/src/common/config/state/configurable.test.js +73 -0
- package/src/common/config/state/info.test.js +31 -0
- package/src/common/config/state/init.js +13 -12
- package/src/common/config/state/init.test.js +28 -0
- package/src/common/config/state/loader-config.test.js +21 -0
- package/src/common/config/state/runtime.js +0 -2
- package/src/common/config/state/runtime.test.js +21 -0
- package/src/common/constants/__mocks__/runtime.js +1 -1
- package/src/common/constants/runtime.js +1 -1
- package/src/common/constants/runtime.test.js +2 -2
- package/src/common/constants/shared-channel.js +1 -1
- package/src/common/deny-list/deny-list.js +2 -10
- package/src/common/drain/drain.js +1 -1
- package/src/common/drain/drain.test.js +74 -0
- package/src/common/event-emitter/contextual-ee.js +6 -6
- package/src/common/harvest/harvest-scheduler.js +2 -5
- package/src/common/harvest/harvest-scheduler.test.js +2 -6
- package/src/common/harvest/harvest.js +2 -6
- package/src/common/harvest/harvest.test.js +0 -2
- package/src/common/ids/id.test.js +6 -6
- package/src/common/serialize/bel-serializer.js +1 -1
- package/src/common/session/session-entity.component-test.js +3 -2
- package/src/common/session/session-entity.js +11 -9
- package/src/common/storage/first-party-cookies.js +5 -4
- package/src/common/storage/local-storage.js +3 -2
- package/src/common/timer/interaction-timer.component-test.js +52 -7
- package/src/common/timer/interaction-timer.js +15 -6
- package/src/common/timer/timer.test.js +0 -1
- package/src/common/timing/nav-timing.js +1 -1
- package/src/common/unload/eol.js +5 -31
- package/src/common/url/encode.test.js +1 -0
- package/src/common/util/__mocks__/invoke.js +1 -0
- package/src/common/util/data-size.test.js +0 -1
- package/src/common/util/feature-flags.js +15 -17
- package/src/common/util/feature-flags.test.js +4 -8
- package/src/common/util/invoke.js +1 -1
- package/src/common/util/obfuscate.js +3 -5
- package/src/common/util/submit-data.test.js +1 -1
- package/src/common/util/traverse.js +1 -0
- package/src/common/window/__mocks__/nreum.js +3 -1
- package/src/common/window/page-visibility.js +1 -2
- package/src/common/wrap/wrap-jsonp.js +1 -1
- package/src/features/ajax/aggregate/index.js +5 -7
- package/src/features/ajax/instrument/distributed-tracing.js +8 -8
- package/src/features/ajax/instrument/index.js +40 -17
- package/src/features/jserrors/aggregate/canonical-function-name.js +0 -2
- package/src/features/jserrors/aggregate/compute-stack-trace.js +4 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +1 -1
- package/src/features/jserrors/aggregate/index.js +4 -5
- package/src/features/metrics/aggregate/framework-detection.js +129 -8
- package/src/features/metrics/aggregate/framework-detection.test.js +213 -82
- package/src/features/metrics/aggregate/index.js +22 -45
- package/src/features/metrics/instrument/index.js +1 -3
- package/src/features/page_action/aggregate/index.js +12 -13
- package/src/features/page_view_event/aggregate/index.js +1 -2
- package/src/features/page_view_event/instrument/index.js +2 -2
- package/src/features/page_view_timing/aggregate/index.js +7 -8
- package/src/features/session_replay/aggregate/index.component-test.js +3 -15
- package/src/features/session_replay/aggregate/index.js +2 -2
- package/src/features/session_trace/aggregate/index.js +6 -9
- package/src/features/spa/aggregate/index.js +14 -20
- package/src/features/spa/aggregate/interaction.js +0 -2
- package/src/features/spa/aggregate/serializer.js +1 -1
- package/src/features/utils/aggregate-base.js +5 -0
- package/src/features/utils/aggregate-base.test.js +2 -1
- package/src/features/utils/handler-cache.js +3 -2
- package/src/features/utils/instrument-base.js +25 -6
- package/src/features/utils/instrument-base.test.js +2 -2
- package/src/loaders/agent-base.js +11 -0
- package/src/loaders/agent.js +7 -7
- package/src/loaders/api/api.js +21 -4
- package/src/loaders/api/api.test.js +85 -0
- package/src/loaders/api/apiAsync.js +19 -20
- package/src/loaders/api/apiAsync.test.js +17 -0
- package/src/loaders/configure/configure.js +3 -0
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/micro-agent.js +22 -4
- package/dist/cjs/features/metrics/aggregate/endpoint-map.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +0 -14
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +0 -53
- package/dist/esm/features/metrics/aggregate/endpoint-map.js +0 -7
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/dist/esm/features/metrics/aggregate/polyfill-detection.js +0 -47
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts +0 -8
- package/dist/types/features/metrics/aggregate/endpoint-map.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +0 -6
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +0 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +0 -7
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +0 -1
- package/src/features/metrics/aggregate/endpoint-map.js +0 -7
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +0 -8
- package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +0 -16
- package/src/features/metrics/aggregate/polyfill-detection.js +0 -48
- package/src/features/metrics/aggregate/polyfill-detection.test.js +0 -163
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
* functionality is validated and a full user experience is curated.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { drain } from '../../../common/drain/drain';
|
|
14
13
|
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
15
14
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
16
15
|
import { FEATURE_NAME } from '../constants';
|
|
@@ -20,6 +19,7 @@ import { SESSION_EVENTS, MODE } from '../../../common/session/session-entity';
|
|
|
20
19
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
21
20
|
import { sharedChannel } from '../../../common/constants/shared-channel';
|
|
22
21
|
import { obj as encodeObj } from '../../../common/url/encode';
|
|
22
|
+
import { warn } from '../../../common/util/console';
|
|
23
23
|
|
|
24
24
|
// would be better to get this dynamically in some way
|
|
25
25
|
export const RRWEB_VERSION = '2.0.0-alpha.8';
|
|
@@ -127,7 +127,7 @@ export class Aggregate extends AggregateBase {
|
|
|
127
127
|
return this.initializeRecording(flagOn, Math.random() < getConfigurationValue(this.agentIdentifier, 'session_replay.errorSampleRate'), Math.random() < getConfigurationValue(this.agentIdentifier, 'session_replay.sampleRate'));
|
|
128
128
|
}).then(() => sharedChannel.onReplayReady(this.mode)); // notify watchers that replay started with the mode
|
|
129
129
|
|
|
130
|
-
drain(
|
|
130
|
+
this.drain();
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
|
|
@@ -8,7 +8,6 @@ import { parseUrl } from '../../../common/url/parse-url';
|
|
|
8
8
|
import { getConfigurationValue, getRuntime } from '../../../common/config/config';
|
|
9
9
|
import { now } from '../../../common/timing/now';
|
|
10
10
|
import { FEATURE_NAME } from '../constants';
|
|
11
|
-
import { drain } from '../../../common/drain/drain';
|
|
12
11
|
import { HandlerCache } from '../../utils/handler-cache';
|
|
13
12
|
import { MODE, SESSION_EVENTS } from '../../../common/session/session-entity';
|
|
14
13
|
import { getSessionReplayMode } from '../../session_replay/replay-mode';
|
|
@@ -137,7 +136,9 @@ export class Aggregate extends AggregateBase {
|
|
|
137
136
|
});
|
|
138
137
|
mostRecentModeKnown = updatedTraceMode;
|
|
139
138
|
});
|
|
140
|
-
this.ee.on(SESSION_EVENTS.PAUSE, () =>
|
|
139
|
+
this.ee.on(SESSION_EVENTS.PAUSE, () => {
|
|
140
|
+
mostRecentModeKnown = sessionEntity.state.sessionTraceMode;
|
|
141
|
+
});
|
|
141
142
|
if (!sessionEntity.isNew) {
|
|
142
143
|
// inherit the same mode as existing session's Trace
|
|
143
144
|
if (sessionEntity.state.sessionReplay === MODE.OFF) this.isStandalone = true;
|
|
@@ -209,7 +210,7 @@ export class Aggregate extends AggregateBase {
|
|
|
209
210
|
}
|
|
210
211
|
return operationalGate.settle(() => _this.processPVT(...args));
|
|
211
212
|
}, this.featureName, this.ee);
|
|
212
|
-
drain(
|
|
213
|
+
this.drain();
|
|
213
214
|
}
|
|
214
215
|
startTracing(startupBuffer) {
|
|
215
216
|
let dontStartHarvestYet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -333,8 +334,7 @@ export class Aggregate extends AggregateBase {
|
|
|
333
334
|
const origin = this.evtOrigin(event.target, target);
|
|
334
335
|
if (event.type in ignoredEvents.global) return true;
|
|
335
336
|
if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true;
|
|
336
|
-
|
|
337
|
-
return false;
|
|
337
|
+
return !!(!!ignoredEvents[origin] && event.type in ignoredEvents[origin]);
|
|
338
338
|
}
|
|
339
339
|
evtName(type) {
|
|
340
340
|
switch (type) {
|
|
@@ -444,7 +444,7 @@ export class Aggregate extends AggregateBase {
|
|
|
444
444
|
// limit the amount of pending data awaiting next harvest
|
|
445
445
|
if (this.isStandalone || this.agentRuntime.session.state.sessionTraceMode !== MODE.ERROR) return;
|
|
446
446
|
const openedSpace = this.trimSTNs(ERROR_MODE_SECONDS_WINDOW); // but maybe we could make some space by discarding irrelevant nodes if we're in sessioned Error mode
|
|
447
|
-
if (openedSpace
|
|
447
|
+
if (openedSpace === 0) return;
|
|
448
448
|
}
|
|
449
449
|
if (this.isStandalone && now() >= MAX_TRACE_DURATION) {
|
|
450
450
|
return;
|
|
@@ -467,7 +467,7 @@ export class Aggregate extends AggregateBase {
|
|
|
467
467
|
* This isn't exact since nodes go through some processing & EE handlers chain, but it's close enough as we still capture nodes whose duration overlaps the lookback window.
|
|
468
468
|
* ASSUMPTION: all 'end' timings stored are relative to timeOrigin (DOMHighResTimeStamp) and not Unix epoch based. */
|
|
469
469
|
let cutoffIdx = nodeList.findIndex(node => cutoffHighResTime <= node.e);
|
|
470
|
-
if (cutoffIdx
|
|
470
|
+
if (cutoffIdx === 0) return;else if (cutoffIdx < 0) {
|
|
471
471
|
// whole list falls outside lookback window and is irrelevant
|
|
472
472
|
cutoffIdx = nodeList.length;
|
|
473
473
|
delete this.trace[nameCategory];
|
|
@@ -531,7 +531,7 @@ export class Aggregate extends AggregateBase {
|
|
|
531
531
|
};
|
|
532
532
|
function trivial(node) {
|
|
533
533
|
const limit = 4;
|
|
534
|
-
|
|
534
|
+
return !!(node && typeof node.e === 'number' && typeof node.s === 'number' && node.e - node.s < limit);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
}
|
|
@@ -17,7 +17,6 @@ import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
|
17
17
|
import { Serializer } from './serializer';
|
|
18
18
|
import { ee } from '../../../common/event-emitter/contextual-ee';
|
|
19
19
|
import * as CONSTANTS from '../constants';
|
|
20
|
-
import { drain } from '../../../common/drain/drain';
|
|
21
20
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
22
21
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
23
22
|
const {
|
|
@@ -135,8 +134,8 @@ export class Aggregate extends AggregateBase {
|
|
|
135
134
|
|
|
136
135
|
// register plugins
|
|
137
136
|
var pluginApi = {
|
|
138
|
-
getCurrentNode
|
|
139
|
-
setCurrentNode
|
|
137
|
+
getCurrentNode,
|
|
138
|
+
setCurrentNode
|
|
140
139
|
};
|
|
141
140
|
register('spa-register', function (init) {
|
|
142
141
|
if (typeof init === 'function') {
|
|
@@ -201,21 +200,19 @@ export class Aggregate extends AggregateBase {
|
|
|
201
200
|
// If this event was emitted by an XHR, restore the node ID associated with
|
|
202
201
|
// that XHR.
|
|
203
202
|
setCurrentNode(baseEE.context(eventSource).spaNode);
|
|
204
|
-
} else if (!state.currentNode) {
|
|
203
|
+
} else if (!state.currentNode && INTERACTION_EVENTS.indexOf(evName) !== -1) {
|
|
205
204
|
// Otherwise, if no interaction is currently active, create a new node ID,
|
|
206
205
|
// and let the aggregator know that we entered a new event handler callback
|
|
207
206
|
// so that it has a chance to possibly start an interaction.
|
|
208
|
-
|
|
209
|
-
var ixn = new Interaction(evName, this[FN_START], state.lastSeenUrl, state.lastSeenRouteName, onInteractionFinished, agentIdentifier);
|
|
207
|
+
var ixn = new Interaction(evName, this[FN_START], state.lastSeenUrl, state.lastSeenRouteName, onInteractionFinished, agentIdentifier);
|
|
210
208
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
}
|
|
209
|
+
// Store the interaction as prevInteraction in case it is prematurely discarded
|
|
210
|
+
state.prevInteraction = ixn;
|
|
211
|
+
setCurrentNode(ixn.root);
|
|
212
|
+
if (evName === 'click') {
|
|
213
|
+
var value = getActionText(ev.target);
|
|
214
|
+
if (value) {
|
|
215
|
+
state.currentNode.attrs.custom.actionText = value;
|
|
219
216
|
}
|
|
220
217
|
}
|
|
221
218
|
}
|
|
@@ -497,7 +494,7 @@ export class Aggregate extends AggregateBase {
|
|
|
497
494
|
}, this.featureName, promiseEE);
|
|
498
495
|
register(INTERACTION_API + 'get', function (t) {
|
|
499
496
|
var interaction;
|
|
500
|
-
if (state?.currentNode?.[INTERACTION]) interaction = this.ixn = state.currentNode[INTERACTION];else if (state?.prevNode?.end === null && state?.prevNode?.[INTERACTION]?.root?.[INTERACTION]?.eventName
|
|
497
|
+
if (state?.currentNode?.[INTERACTION]) interaction = this.ixn = state.currentNode[INTERACTION];else if (state?.prevNode?.end === null && state?.prevNode?.[INTERACTION]?.root?.[INTERACTION]?.eventName !== 'initialPageLoad') interaction = this.ixn = state.prevNode[INTERACTION];else interaction = this.ixn = new Interaction('api', t, state.lastSeenUrl, state.lastSeenRouteName, onInteractionFinished, agentIdentifier);
|
|
501
498
|
if (!state.currentNode) {
|
|
502
499
|
interaction.checkFinish();
|
|
503
500
|
if (state.depth) setCurrentNode(interaction.root);
|
|
@@ -665,11 +662,8 @@ export class Aggregate extends AggregateBase {
|
|
|
665
662
|
}
|
|
666
663
|
function isEnabled() {
|
|
667
664
|
var enabled = getConfigurationValue(agentIdentifier, 'spa.enabled');
|
|
668
|
-
|
|
669
|
-
return false;
|
|
670
|
-
}
|
|
671
|
-
return true;
|
|
665
|
+
return enabled !== false;
|
|
672
666
|
}
|
|
673
|
-
drain(
|
|
667
|
+
this.drain();
|
|
674
668
|
}
|
|
675
669
|
}
|
|
@@ -7,7 +7,6 @@ import { getInfo, getRuntime, originals } from '../../../common/config/config';
|
|
|
7
7
|
import { mapOwn } from '../../../common/util/map-own';
|
|
8
8
|
import { ee } from '../../../common/event-emitter/contextual-ee';
|
|
9
9
|
import { InteractionNode } from './interaction-node';
|
|
10
|
-
import { now } from '../../../common/timing/now';
|
|
11
10
|
var originalSetTimeout = originals.ST;
|
|
12
11
|
var originalClearTimeout = originals.CT;
|
|
13
12
|
var lastId = {};
|
|
@@ -78,7 +77,6 @@ InteractionPrototype.finish = function finishInteraction() {
|
|
|
78
77
|
var root = interaction.root;
|
|
79
78
|
if (root.end !== null) return;
|
|
80
79
|
var endTimestamp = Math.max(interaction.lastCb, interaction.lastFinish);
|
|
81
|
-
var delta = now() - endTimestamp;
|
|
82
80
|
var attrs = root.attrs;
|
|
83
81
|
var customAttrs = attrs.custom;
|
|
84
82
|
if (this.onFinished) {
|
|
@@ -119,7 +119,7 @@ export class Serializer extends SharedContext {
|
|
|
119
119
|
// (since its the same as interaction.start)
|
|
120
120
|
// and limit to just the first 20 values we know about
|
|
121
121
|
mapOwn(navTiming.slice(1, 21), function (i, v) {
|
|
122
|
-
if (v !==
|
|
122
|
+
if (v !== undefined) {
|
|
123
123
|
navTimingNode += seperator + numeric(v - prev);
|
|
124
124
|
seperator = ',';
|
|
125
125
|
prev = v;
|
|
@@ -3,6 +3,7 @@ import { FeatureBase } from './feature-base';
|
|
|
3
3
|
import { getInfo, isConfigured, getRuntime } from '../../common/config/config';
|
|
4
4
|
import { configure } from '../../loaders/configure/configure';
|
|
5
5
|
import { gosCDN } from '../../common/window/nreum';
|
|
6
|
+
import { drain } from '../../common/drain/drain';
|
|
6
7
|
export class AggregateBase extends FeatureBase {
|
|
7
8
|
constructor() {
|
|
8
9
|
super(...arguments);
|
|
@@ -20,6 +21,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
20
21
|
registerHandler("rumresp-".concat(fName), isOn => resolve(isOn), this.featureName, this.ee);
|
|
21
22
|
})));
|
|
22
23
|
}
|
|
24
|
+
drain() {
|
|
25
|
+
drain(this.agentIdentifier, this.featureName);
|
|
26
|
+
}
|
|
23
27
|
|
|
24
28
|
/**
|
|
25
29
|
* Checks for additional `jsAttributes` items to support backward compatibility with implementations of the agent where
|
|
@@ -36,7 +36,9 @@ export class HandlerCache {
|
|
|
36
36
|
* @returns {void}
|
|
37
37
|
*/
|
|
38
38
|
settle(handler) {
|
|
39
|
-
if (this.#decision === false)
|
|
39
|
+
if (this.#decision === false) {
|
|
40
|
+
// Do nothing
|
|
41
|
+
} else if (this.#decision === undefined) this.#cache.push(handler);else handler();
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
/**
|
|
@@ -32,18 +32,24 @@ export class InstrumentBase extends FeatureBase {
|
|
|
32
32
|
this.auto = auto;
|
|
33
33
|
|
|
34
34
|
/** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */
|
|
35
|
-
this.abortHandler;
|
|
35
|
+
this.abortHandler = undefined;
|
|
36
|
+
|
|
36
37
|
/**
|
|
37
38
|
* @type {Class} Holds the reference to the feature's aggregate module counterpart, if and after it has been initialized. This may not be assigned until after page loads!
|
|
38
39
|
* The only purpose of this for now is to expose it to the NREUM interface, as the feature's instrument instance is already exposed.
|
|
39
40
|
*/
|
|
40
|
-
this.featAggregate;
|
|
41
|
+
this.featAggregate = undefined;
|
|
42
|
+
|
|
41
43
|
/**
|
|
42
44
|
* @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
|
|
43
45
|
* one another if there are inter-features dependencies.
|
|
44
46
|
*/
|
|
45
|
-
this.onAggregateImported;
|
|
46
|
-
|
|
47
|
+
this.onAggregateImported = undefined;
|
|
48
|
+
|
|
49
|
+
/** used in conjunction with newrelic.start() to defer harvesting in features */
|
|
50
|
+
if (getConfigurationValue(this.agentIdentifier, "".concat(this.featureName, ".autoStart")) === false) this.auto = false;
|
|
51
|
+
/** if the feature requires opt-in (!auto-start), it will get registered once the api has been called */
|
|
52
|
+
if (this.auto) registerDrain(agentIdentifier, featureName);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
/**
|
|
@@ -54,7 +60,19 @@ export class InstrumentBase extends FeatureBase {
|
|
|
54
60
|
*/
|
|
55
61
|
importAggregator() {
|
|
56
62
|
let argsObjFromInstrument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
-
if (this.featAggregate
|
|
63
|
+
if (this.featAggregate) return;
|
|
64
|
+
if (!this.auto) {
|
|
65
|
+
// this feature requires an opt in...
|
|
66
|
+
// wait for API to be called
|
|
67
|
+
this.ee.on("".concat(this.featureName, "-opt-in"), () => {
|
|
68
|
+
// register the feature to drain only once the API has been called, it will drain when importAggregator finishes for all the features
|
|
69
|
+
// called by the api in that cycle
|
|
70
|
+
registerDrain(this.agentIdentifier, this.featureName);
|
|
71
|
+
this.auto = true;
|
|
72
|
+
this.importAggregator();
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
58
76
|
const enableSessionTracking = isBrowserScope && getConfigurationValue(this.agentIdentifier, 'privacy.cookies_enabled') === true;
|
|
59
77
|
let loadedSuccessfully;
|
|
60
78
|
this.onAggregateImported = new Promise(resolve => {
|
|
@@ -75,7 +93,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
75
93
|
}
|
|
76
94
|
|
|
77
95
|
/**
|
|
78
|
-
* Note this try-catch differs from the one in Agent.
|
|
96
|
+
* Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and
|
|
79
97
|
* it's only responsible for aborting its one specific feature, rather than all.
|
|
80
98
|
*/
|
|
81
99
|
try {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable n/handle-callback-err */
|
|
2
|
+
|
|
1
3
|
import { warn } from '../common/util/console';
|
|
2
4
|
export class AgentBase {
|
|
3
5
|
/**
|
|
@@ -89,4 +91,13 @@ export class AgentBase {
|
|
|
89
91
|
addRelease(name, id) {
|
|
90
92
|
warn('Call to agent api addRelease failed. The agent is not currently initialized.');
|
|
91
93
|
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Starts a set of agent features if not running in "autoStart" mode
|
|
97
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}
|
|
98
|
+
* @param {string|string[]|undefined} name The feature name(s) to start. If no name(s) are passed, all features will be started
|
|
99
|
+
*/
|
|
100
|
+
start(featureNames) {
|
|
101
|
+
warn('Call to agent api addRelease failed. The agent is not currently initialized.');
|
|
102
|
+
}
|
|
92
103
|
}
|
|
@@ -44,7 +44,7 @@ export class Agent extends AgentBase {
|
|
|
44
44
|
// Future work is being planned to evaluate removing this behavior from the backend, but for now we must ensure this call is made
|
|
45
45
|
this.desiredFeatures.add(PageViewEvent);
|
|
46
46
|
Object.assign(this, configure(this.agentIdentifier, options, options.loaderType || 'agent'));
|
|
47
|
-
this.
|
|
47
|
+
this.run();
|
|
48
48
|
}
|
|
49
49
|
get config() {
|
|
50
50
|
return {
|
|
@@ -54,20 +54,20 @@ export class Agent extends AgentBase {
|
|
|
54
54
|
runtime: getRuntime(this.agentIdentifier)
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
|
|
57
|
+
run() {
|
|
58
58
|
const NR_FEATURES_REF_NAME = 'features';
|
|
59
59
|
// Attempt to initialize all the requested features (sequentially in prio order & synchronously), with any failure aborting the whole process.
|
|
60
60
|
try {
|
|
61
61
|
const enabledFeatures = getEnabledFeatures(this.agentIdentifier);
|
|
62
62
|
const featuresToStart = [...this.desiredFeatures];
|
|
63
63
|
featuresToStart.sort((a, b) => featurePriority[a.featureName] - featurePriority[b.featureName]);
|
|
64
|
-
featuresToStart.forEach(
|
|
64
|
+
featuresToStart.forEach(InstrumentCtor => {
|
|
65
65
|
// pageViewEvent must be enabled because RUM calls are not optional. See comment in constructor and PR 428.
|
|
66
|
-
if (enabledFeatures[
|
|
67
|
-
const dependencies = getFeatureDependencyNames(
|
|
66
|
+
if (enabledFeatures[InstrumentCtor.featureName] || InstrumentCtor.featureName === FEATURE_NAMES.pageViewEvent) {
|
|
67
|
+
const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName);
|
|
68
68
|
const hasAllDeps = dependencies.every(x => enabledFeatures[x]);
|
|
69
|
-
if (!hasAllDeps) warn("".concat(
|
|
70
|
-
this.features[
|
|
69
|
+
if (!hasAllDeps) warn("".concat(InstrumentCtor.featureName, " is enabled but one or more dependent features has been disabled (").concat(stringify(dependencies), "). This may cause unintended consequences or missing data..."));
|
|
70
|
+
this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator);
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
gosNREUMInitializedAgents(this.agentIdentifier, this.features, NR_FEATURES_REF_NAME);
|
|
@@ -17,7 +17,7 @@ export const CUSTOM_ATTR_GROUP = 'CUSTOM/'; // the subgroup items should be stor
|
|
|
17
17
|
|
|
18
18
|
export function setTopLevelCallers() {
|
|
19
19
|
const nr = gosCDN();
|
|
20
|
-
const funcs = ['setErrorHandler', 'finished', 'addToTrace', 'inlineHit', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion'];
|
|
20
|
+
const funcs = ['setErrorHandler', 'finished', 'addToTrace', 'inlineHit', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start'];
|
|
21
21
|
funcs.forEach(f => {
|
|
22
22
|
nr[f] = function () {
|
|
23
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -49,7 +49,9 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
49
49
|
var spaPrefix = prefix + 'ixn-';
|
|
50
50
|
|
|
51
51
|
// Setup stub functions that queue calls for later processing.
|
|
52
|
-
asyncApiFns.forEach(fnName =>
|
|
52
|
+
asyncApiFns.forEach(fnName => {
|
|
53
|
+
apiInterface[fnName] = apiCall(prefix, fnName, true, 'api');
|
|
54
|
+
});
|
|
53
55
|
apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.pageAction);
|
|
54
56
|
apiInterface.setCurrentRouteName = apiCall(prefix, 'routeName', true, FEATURE_NAMES.spa);
|
|
55
57
|
apiInterface.setPageViewName = function (name, host) {
|
|
@@ -119,6 +121,21 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
119
121
|
}
|
|
120
122
|
return appendJsAttribute('application.version', value, 'setApplicationVersion', false);
|
|
121
123
|
};
|
|
124
|
+
apiInterface.start = features => {
|
|
125
|
+
try {
|
|
126
|
+
const featNames = Object.values(FEATURE_NAMES);
|
|
127
|
+
if (features === undefined) features = featNames;else {
|
|
128
|
+
features = Array.isArray(features) && features.length ? features : [features];
|
|
129
|
+
if (features.some(f => !featNames.includes(f))) return warn("Invalid feature name supplied. Acceptable feature names are: ".concat(featNames));
|
|
130
|
+
if (!features.includes(FEATURE_NAMES.pageViewEvent)) features.push(FEATURE_NAMES.pageViewEvent);
|
|
131
|
+
}
|
|
132
|
+
features.forEach(feature => {
|
|
133
|
+
instanceEE.emit("".concat(feature, "-opt-in"));
|
|
134
|
+
});
|
|
135
|
+
} catch (err) {
|
|
136
|
+
warn('An unexpected issue occurred', err);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
122
139
|
apiInterface.interaction = function () {
|
|
123
140
|
return new InteractionHandle().get();
|
|
124
141
|
};
|
|
@@ -145,14 +162,14 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
145
162
|
};
|
|
146
163
|
}
|
|
147
164
|
};
|
|
148
|
-
|
|
165
|
+
['actionText', 'setName', 'setAttribute', 'save', 'ignore', 'onEnd', 'getContext', 'end', 'get'].forEach(name => {
|
|
149
166
|
InteractionApiProto[name] = apiCall(spaPrefix, name, undefined, FEATURE_NAMES.spa);
|
|
150
167
|
});
|
|
151
168
|
function apiCall(prefix, name, notSpa, bufferGroup) {
|
|
152
169
|
return function () {
|
|
153
170
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/' + name + '/called'], undefined, FEATURE_NAMES.metrics, instanceEE);
|
|
154
171
|
if (bufferGroup) handle(prefix + name, [now(), ...arguments], notSpa ? null : this, bufferGroup, instanceEE); // no bufferGroup means only the SM is emitted
|
|
155
|
-
return notSpa ?
|
|
172
|
+
return notSpa ? undefined : this;
|
|
156
173
|
};
|
|
157
174
|
}
|
|
158
175
|
apiInterface.noticeError = function (err, customAttributes) {
|
|
@@ -13,10 +13,10 @@ export function setAPI(agentIdentifier) {
|
|
|
13
13
|
var scheme = getConfigurationValue(agentIdentifier, 'ssl') === false ? 'http' : 'https';
|
|
14
14
|
var api = {
|
|
15
15
|
finished: single(finished),
|
|
16
|
-
setErrorHandler
|
|
17
|
-
addToTrace
|
|
18
|
-
inlineHit
|
|
19
|
-
addRelease
|
|
16
|
+
setErrorHandler,
|
|
17
|
+
addToTrace,
|
|
18
|
+
inlineHit,
|
|
19
|
+
addRelease
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// Hook all of the api functions up to the queues/stubs created in loader/api.js
|
|
@@ -52,29 +52,28 @@ export function setAPI(agentIdentifier) {
|
|
|
52
52
|
handle('bstApi', [report], undefined, FEATURE_NAMES.sessionTrace, instanceEE);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// NREUM.inlineHit(
|
|
55
|
+
// NREUM.inlineHit(requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime)
|
|
56
56
|
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
function inlineHit(t,
|
|
57
|
+
// requestName - the 'web page' name or service name
|
|
58
|
+
// queueTime - the amount of time spent in the app tier queue
|
|
59
|
+
// appTime - the amount of time spent in the application code
|
|
60
|
+
// totalBackEndTime - the total roundtrip time of the remote service call
|
|
61
|
+
// domTime - the time spent processing the result of the service call (or user defined)
|
|
62
|
+
// frontEndTime - the time spent rendering the result of the service call (or user defined)
|
|
63
|
+
function inlineHit(t, requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime) {
|
|
64
64
|
if (!isBrowserScope) return;
|
|
65
|
-
|
|
65
|
+
requestName = window.encodeURIComponent(requestName);
|
|
66
66
|
cycle += 1;
|
|
67
67
|
const agentInfo = getInfo(agentIdentifier);
|
|
68
|
-
const agentRuntime = getRuntime(agentIdentifier);
|
|
69
68
|
if (!agentInfo.beacon) return;
|
|
70
69
|
var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey;
|
|
71
70
|
url += '?a=' + agentInfo.applicationID + '&';
|
|
72
|
-
url += 't=' +
|
|
73
|
-
url += 'qt=' + ~~
|
|
74
|
-
url += 'ap=' + ~~
|
|
75
|
-
url += 'be=' + ~~
|
|
76
|
-
url += 'dc=' + ~~
|
|
77
|
-
url += 'fe=' + ~~
|
|
71
|
+
url += 't=' + requestName + '&';
|
|
72
|
+
url += 'qt=' + ~~queueTime + '&';
|
|
73
|
+
url += 'ap=' + ~~appTime + '&';
|
|
74
|
+
url += 'be=' + ~~totalBackEndTime + '&';
|
|
75
|
+
url += 'dc=' + ~~domTime + '&';
|
|
76
|
+
url += 'fe=' + ~~frontEndTime + '&';
|
|
78
77
|
url += 'c=' + cycle;
|
|
79
78
|
submitData.xhr({
|
|
80
79
|
url
|
|
@@ -7,6 +7,7 @@ export function configure(agentIdentifier) {
|
|
|
7
7
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8
8
|
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
9
9
|
let forceDrain = arguments.length > 3 ? arguments[3] : undefined;
|
|
10
|
+
// eslint-disable-next-line camelcase
|
|
10
11
|
let {
|
|
11
12
|
init,
|
|
12
13
|
info,
|
|
@@ -20,9 +21,11 @@ export function configure(agentIdentifier) {
|
|
|
20
21
|
if (!info) {
|
|
21
22
|
init = nr.init;
|
|
22
23
|
info = nr.info;
|
|
24
|
+
// eslint-disable-next-line camelcase
|
|
23
25
|
loader_config = nr.loader_config;
|
|
24
26
|
}
|
|
25
27
|
setConfiguration(agentIdentifier, init || {});
|
|
28
|
+
// eslint-disable-next-line camelcase
|
|
26
29
|
setLoaderConfig(agentIdentifier, loader_config || {});
|
|
27
30
|
info.jsAttributes ??= {};
|
|
28
31
|
if (isWorkerScope) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FEATURE_NAMES } from './features';
|
|
2
|
-
import { getConfigurationValue
|
|
2
|
+
import { getConfigurationValue } from '../../common/config/config';
|
|
3
3
|
const featureNames = Object.values(FEATURE_NAMES);
|
|
4
4
|
function isEnabled(name, agentIdentifier) {
|
|
5
5
|
return getConfigurationValue(agentIdentifier, "".concat(name, ".enabled")) !== false;
|
|
@@ -6,7 +6,7 @@ import { configure } from './configure/configure';
|
|
|
6
6
|
import { Aggregator } from '../common/aggregate/aggregator';
|
|
7
7
|
import { gosNREUMInitializedAgents } from '../common/window/nreum';
|
|
8
8
|
import { generateRandomHexString } from '../common/ids/unique-id';
|
|
9
|
-
import { getConfiguration, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
9
|
+
import { getConfiguration, getConfigurationValue, getInfo, getLoaderConfig, getRuntime } from '../common/config/config';
|
|
10
10
|
import { FEATURE_NAMES } from './features/features';
|
|
11
11
|
import { warn } from '../common/util/console';
|
|
12
12
|
import { onWindowLoad } from '../common/window/load';
|
|
@@ -37,7 +37,14 @@ export class MicroAgent extends AgentBase {
|
|
|
37
37
|
isolatedBacklog: true
|
|
38
38
|
}
|
|
39
39
|
}, options.loaderType || 'micro-agent'));
|
|
40
|
-
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Starts a set of agent features if not running in "autoStart" mode
|
|
43
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}
|
|
44
|
+
* @param {string|string[]|undefined} name The feature name(s) to start. If no name(s) are passed, all features will be started
|
|
45
|
+
*/
|
|
46
|
+
this.start = features => this.run(features);
|
|
47
|
+
this.run(nonAutoFeatures.filter(featureName => getConfigurationValue(agentIdentifier, "".concat(featureName, ".autoStart"))));
|
|
41
48
|
}
|
|
42
49
|
get config() {
|
|
43
50
|
return {
|
|
@@ -47,7 +54,17 @@ export class MicroAgent extends AgentBase {
|
|
|
47
54
|
runtime: getRuntime(this.agentIdentifier)
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
|
-
|
|
57
|
+
run(features) {
|
|
58
|
+
try {
|
|
59
|
+
const featNames = nonAutoFeatures;
|
|
60
|
+
if (features === undefined) features = featNames;else {
|
|
61
|
+
features = Array.isArray(features) && features.length ? features : [features];
|
|
62
|
+
if (features.some(f => !featNames.includes(f))) return warn("Invalid feature name supplied. Acceptable feature names are: ".concat(featNames));
|
|
63
|
+
if (!features.includes(FEATURE_NAMES.pageViewEvent)) features.push(FEATURE_NAMES.pageViewEvent);
|
|
64
|
+
}
|
|
65
|
+
} catch (err) {
|
|
66
|
+
warn('An unexpected issue occurred', err);
|
|
67
|
+
}
|
|
51
68
|
try {
|
|
52
69
|
const enabledFeatures = getEnabledFeatures(this.agentIdentifier);
|
|
53
70
|
try {
|
|
@@ -59,7 +76,7 @@ export class MicroAgent extends AgentBase {
|
|
|
59
76
|
onWindowLoad(() => {
|
|
60
77
|
// these features do not import an "instrument" file, meaning they are only hooked up to the API.
|
|
61
78
|
nonAutoFeatures.forEach(f => {
|
|
62
|
-
if (enabledFeatures[f]) {
|
|
79
|
+
if (enabledFeatures[f] && features.includes(f)) {
|
|
63
80
|
import( /* webpackChunkName: "lazy-feature-loader" */'../features/utils/lazy-feature-loader').then(_ref => {
|
|
64
81
|
let {
|
|
65
82
|
lazyFeatureLoader
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAsEA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AA4BA,yCAIC;AAED,oDAIC"}
|
|
@@ -22,7 +22,7 @@ export const isiOS: boolean;
|
|
|
22
22
|
* did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.
|
|
23
23
|
* This was fixed in v16+.
|
|
24
24
|
*/
|
|
25
|
-
export const
|
|
25
|
+
export const iOSBelow16: boolean;
|
|
26
26
|
export const ffVersion: number;
|
|
27
27
|
export const isIE: boolean;
|
|
28
28
|
export const supportsSendBeacon: true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,sCAAwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE;;;;;;;;;;SAUK;IACL,sBATa,MAAM;QAES,UAAU;QACV,UAAU;QACZ,UAAU,EAAvB,MAAM;QACQ,GAAG,EAAjB,OAAO;QACM,SAAS,EAAtB,MAAM;oBAoBlB;IAfC,iBAAwB;IACxB;;;oBARW,MAAM;aACN,OAAO;mBACP,MAAM;MAMK;IACtB,iBAAoB;IACpB,mBAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAWhD;;;OAGG;IACH,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAUC;IAED,yCA8DC;IAED,gDAiBC;CACF;8BA9J6B,2BAA2B;wBACjC,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAWzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,
|
|
1
|
+
{"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAWzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CA+EnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAhPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
|
|
@@ -16,21 +16,18 @@ export class SessionEntity {
|
|
|
16
16
|
* expiresMs and inactiveMs are used to "expire" the session, but can be overridden in the constructor. Pass 0 to disable expiration timers.
|
|
17
17
|
*/
|
|
18
18
|
constructor(opts: any);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
agentIdentifier: any;
|
|
20
|
+
storage: any;
|
|
21
|
+
state: {};
|
|
22
|
+
key: any;
|
|
23
|
+
ee: any;
|
|
24
|
+
setup({ value, expiresMs, inactiveMs }: {
|
|
23
25
|
value?: string | undefined;
|
|
24
26
|
expiresMs?: number | undefined;
|
|
25
27
|
inactiveMs?: number | undefined;
|
|
26
28
|
}): void;
|
|
27
|
-
agentIdentifier: any;
|
|
28
|
-
storage: any;
|
|
29
|
-
state: {} | undefined;
|
|
30
|
-
key: any;
|
|
31
29
|
expiresMs: number | undefined;
|
|
32
30
|
inactiveMs: number | undefined;
|
|
33
|
-
ee: any;
|
|
34
31
|
expiresTimer: Timer | undefined;
|
|
35
32
|
inactiveTimer: InteractionTimer | undefined;
|
|
36
33
|
isNew: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;AAoCA;IACE;;;;;OAKG;IACH,
|
|
1
|
+
{"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;AAoCA;IACE;;;;;OAKG;IACH,uBAgBC;IAVC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAKnC;;;;aAsEC;IA/DC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAiBsC;IAOV,2BAA6C;IAM3E,iCAAuB;IAIzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAiBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAYC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA1RqB,gBAAgB;iCAGL,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"first-party-cookies.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/first-party-cookies.js"],"names":[],"mappings":"AAAA;IACE,yBAEC;IADC,YAAoB;IAGtB,
|
|
1
|
+
{"version":3,"file":"first-party-cookies.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/first-party-cookies.js"],"names":[],"mappings":"AAAA;IACE,yBAEC;IADC,YAAoB;IAGtB,mCAQC;IAED,gCAOC;IAED,uBAMC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-storage.js"],"names":[],"mappings":"AAAA;IACE,
|
|
1
|
+
{"version":3,"file":"local-storage.d.ts","sourceRoot":"","sources":["../../../../src/common/storage/local-storage.js"],"names":[],"mappings":"AAAA;IACE,kCASC;IAED,gCAOC;IAED,uBAMC;CACF"}
|