@newrelic/browser-agent 1.237.1 → 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 +3 -9
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/event-emitter/contextual-ee.js +24 -32
- package/dist/cjs/common/event-emitter/event-context.js +12 -0
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -4
- package/dist/cjs/common/harvest/harvest.js +4 -7
- package/dist/cjs/common/ids/bundle-id.js +19 -0
- 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-events.js +3 -2
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
- package/dist/cjs/common/wrap/wrap-function.js +15 -46
- package/dist/cjs/common/wrap/wrap-jsonp.js +1 -1
- package/dist/cjs/common/wrap/wrap-mutation.js +1 -2
- package/dist/cjs/common/wrap/wrap-promise.js +2 -3
- package/dist/cjs/common/wrap/wrap-xhr.js +23 -27
- package/dist/cjs/features/ajax/aggregate/index.js +5 -7
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +8 -12
- package/dist/cjs/features/ajax/instrument/index.js +66 -24
- 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 +5 -3
- package/dist/cjs/features/session_trace/aggregate/index.js +22 -16
- 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 +23 -0
- package/dist/cjs/loaders/agent.js +7 -7
- package/dist/cjs/loaders/api/api.js +34 -4
- package/dist/cjs/loaders/api/apiAsync.js +19 -20
- package/dist/cjs/loaders/api/interaction-types.js +11 -4
- 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 +3 -9
- package/dist/esm/common/drain/drain.js +1 -1
- package/dist/esm/common/event-emitter/contextual-ee.js +22 -29
- package/dist/esm/common/event-emitter/event-context.js +5 -0
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -4
- package/dist/esm/common/harvest/harvest.js +4 -7
- package/dist/esm/common/ids/bundle-id.js +13 -0
- 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-events.js +4 -3
- package/dist/esm/common/wrap/wrap-fetch.js +2 -4
- package/dist/esm/common/wrap/wrap-function.js +15 -44
- package/dist/esm/common/wrap/wrap-jsonp.js +1 -1
- package/dist/esm/common/wrap/wrap-mutation.js +2 -3
- package/dist/esm/common/wrap/wrap-promise.js +3 -4
- package/dist/esm/common/wrap/wrap-xhr.js +23 -27
- package/dist/esm/features/ajax/aggregate/index.js +5 -7
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +8 -12
- package/dist/esm/features/ajax/instrument/index.js +67 -25
- 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 +4 -2
- package/dist/esm/features/session_trace/aggregate/index.js +22 -16
- 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 +23 -0
- package/dist/esm/loaders/agent.js +7 -7
- package/dist/esm/loaders/api/api.js +34 -4
- package/dist/esm/loaders/api/apiAsync.js +19 -20
- package/dist/esm/loaders/api/interaction-types.js +11 -4
- 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/event-emitter/contextual-ee.d.ts +22 -2
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -1
- package/dist/types/common/event-emitter/event-context.d.ts +5 -0
- package/dist/types/common/event-emitter/event-context.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +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/ids/bundle-id.d.ts +5 -0
- package/dist/types/common/ids/bundle-id.d.ts.map +1 -0
- package/dist/types/common/session/session-entity.d.ts +12 -15
- 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/nreum.d.ts +2 -2
- package/dist/types/common/window/page-visibility.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-function.d.ts +1 -19
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.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 +5 -0
- 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 +15 -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 +7 -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/api/interaction-types.d.ts +18 -7
- package/dist/types/loaders/api/interaction-types.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts +2 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +9 -9
- package/dist/types/loaders/micro-agent.d.ts +7 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +62 -38
- 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 +3 -11
- package/src/common/deny-list/deny-list.test.js +103 -30
- package/src/common/drain/drain.js +1 -1
- package/src/common/drain/drain.test.js +74 -0
- package/src/common/event-emitter/{contextual-ee.test.js → contextual-ee.component-test.js} +15 -32
- package/src/common/event-emitter/contextual-ee.js +26 -37
- package/src/common/event-emitter/event-context.js +5 -0
- 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 +4 -7
- package/src/common/harvest/harvest.test.js +1 -3
- package/src/common/ids/__mocks__/bundle-id.js +2 -0
- package/src/common/ids/__mocks__/unique-id.js +17 -0
- package/src/common/ids/bundle-id.js +13 -0
- 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/__mocks__/parse-url.js +15 -0
- package/src/common/url/{encode.component-test.js → encode.test.js} +1 -0
- package/src/common/util/__mocks__/get-or-set.js +5 -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 +12 -0
- package/src/common/window/page-visibility.js +1 -2
- package/src/common/wrap/wrap-events.js +4 -3
- package/src/common/wrap/wrap-fetch.js +2 -4
- package/src/common/wrap/wrap-function.js +16 -44
- package/src/common/wrap/wrap-jsonp.js +1 -1
- package/src/common/wrap/wrap-mutation.js +2 -3
- package/src/common/wrap/{wrap-promise.test.js → wrap-promise.component-test.js} +2 -32
- package/src/common/wrap/wrap-promise.js +3 -4
- package/src/common/wrap/wrap-xhr.js +24 -28
- package/src/features/ajax/aggregate/index.js +5 -7
- package/src/features/ajax/instrument/distributed-tracing.js +8 -12
- package/src/features/ajax/instrument/distributed-tracing.test.js +375 -0
- package/src/features/ajax/instrument/index.js +62 -27
- 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 +4 -2
- package/src/features/session_trace/aggregate/index.js +22 -16
- 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 +23 -0
- package/src/loaders/agent.js +7 -7
- package/src/loaders/api/api.component-test.js +45 -0
- package/src/loaders/api/api.js +34 -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/api/interaction-types.js +11 -4
- 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
- /package/src/common/url/{protocol.component-test.js → protocol.test.js} +0 -0
|
@@ -17,7 +17,6 @@ var _config = require("../../../common/config/config");
|
|
|
17
17
|
var _now = require("../../../common/timing/now");
|
|
18
18
|
var _runtime = require("../../../common/constants/runtime");
|
|
19
19
|
var _constants = require("../constants");
|
|
20
|
-
var _drain = require("../../../common/drain/drain");
|
|
21
20
|
var _features = require("../../../loaders/features/features");
|
|
22
21
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
23
22
|
/*
|
|
@@ -39,7 +38,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
39
38
|
this.observedAt = {};
|
|
40
39
|
this.pageviewReported = {};
|
|
41
40
|
this.errorCache = {};
|
|
42
|
-
this.currentBody;
|
|
41
|
+
this.currentBody = undefined;
|
|
43
42
|
this.errorOnPage = false;
|
|
44
43
|
|
|
45
44
|
// this will need to change to match whatever ee we use in the instrument
|
|
@@ -73,7 +72,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
73
72
|
this.blocked = true;
|
|
74
73
|
scheduler.stopTimer(true);
|
|
75
74
|
}, this.featureName, this.ee);
|
|
76
|
-
|
|
75
|
+
this.drain();
|
|
77
76
|
}
|
|
78
77
|
onHarvestStarted(options) {
|
|
79
78
|
// this gets rid of dependency in AJAX module
|
|
@@ -82,7 +81,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
82
81
|
this.currentBody = body;
|
|
83
82
|
}
|
|
84
83
|
var payload = {
|
|
85
|
-
body
|
|
84
|
+
body,
|
|
86
85
|
qs: {}
|
|
87
86
|
};
|
|
88
87
|
var releaseIds = (0, _stringify.stringify)((0, _config.getRuntime)(this.agentIdentifier).releaseIds);
|
|
@@ -192,7 +191,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
192
191
|
params.firstOccurrenceTimestamp = this.observedAt[bucketHash];
|
|
193
192
|
var type = internal ? 'ierr' : 'err';
|
|
194
193
|
var newMetrics = {
|
|
195
|
-
time
|
|
194
|
+
time
|
|
196
195
|
};
|
|
197
196
|
|
|
198
197
|
// sr, stn and spa aggregators listen to this event - stn sends the error in its payload,
|
|
@@ -7,31 +7,59 @@ exports.getFrameworks = getFrameworks;
|
|
|
7
7
|
var _runtime = require("../../../common/constants/runtime");
|
|
8
8
|
const FRAMEWORKS = {
|
|
9
9
|
REACT: 'React',
|
|
10
|
+
NEXTJS: 'NextJS',
|
|
11
|
+
VUE: 'Vue',
|
|
12
|
+
NUXTJS: 'NuxtJS',
|
|
10
13
|
ANGULAR: 'Angular',
|
|
14
|
+
ANGULARUNIVERSAL: 'AngularUniversal',
|
|
15
|
+
SVELTE: 'Svelte',
|
|
16
|
+
SVELTEKIT: 'SvelteKit',
|
|
17
|
+
PREACT: 'Preact',
|
|
18
|
+
PREACTSSR: 'PreactSSR',
|
|
11
19
|
ANGULARJS: 'AngularJS',
|
|
12
20
|
BACKBONE: 'Backbone',
|
|
13
21
|
EMBER: 'Ember',
|
|
14
|
-
VUE: 'Vue',
|
|
15
22
|
METEOR: 'Meteor',
|
|
16
23
|
ZEPTO: 'Zepto',
|
|
17
24
|
JQUERY: 'Jquery',
|
|
18
|
-
MOOTOOLS: 'MooTools'
|
|
25
|
+
MOOTOOLS: 'MooTools',
|
|
26
|
+
QWIK: 'Qwik',
|
|
27
|
+
ELECTRON: 'Electron'
|
|
19
28
|
};
|
|
20
29
|
function getFrameworks() {
|
|
21
30
|
if (!_runtime.isBrowserScope) return []; // don't bother detecting frameworks if not in the main window context
|
|
22
31
|
|
|
23
32
|
const frameworks = [];
|
|
24
33
|
try {
|
|
25
|
-
if (detectReact())
|
|
34
|
+
if (detectReact()) {
|
|
35
|
+
frameworks.push(FRAMEWORKS.REACT);
|
|
36
|
+
if (detectNextJS()) frameworks.push(FRAMEWORKS.NEXTJS);
|
|
37
|
+
}
|
|
38
|
+
if (detectVue()) {
|
|
39
|
+
frameworks.push(FRAMEWORKS.VUE);
|
|
40
|
+
if (detectNuxtJS()) frameworks.push(FRAMEWORKS.NUXTJS);
|
|
41
|
+
}
|
|
42
|
+
if (detectAngular()) {
|
|
43
|
+
frameworks.push(FRAMEWORKS.ANGULAR);
|
|
44
|
+
if (detectAngularUniversal()) frameworks.push(FRAMEWORKS.ANGULARUNIVERSAL);
|
|
45
|
+
}
|
|
46
|
+
if (detectSvelte()) {
|
|
47
|
+
frameworks.push(FRAMEWORKS.SVELTE);
|
|
48
|
+
if (detectSvelteKit()) frameworks.push(FRAMEWORKS.SVELTEKIT);
|
|
49
|
+
}
|
|
50
|
+
if (detectPreact()) {
|
|
51
|
+
frameworks.push(FRAMEWORKS.PREACT);
|
|
52
|
+
if (detectPreactSSR()) frameworks.push(FRAMEWORKS.PREACTSSR);
|
|
53
|
+
}
|
|
26
54
|
if (detectAngularJs()) frameworks.push(FRAMEWORKS.ANGULARJS);
|
|
27
|
-
if (detectAngular()) frameworks.push(FRAMEWORKS.ANGULAR);
|
|
28
55
|
if (Object.prototype.hasOwnProperty.call(window, 'Backbone')) frameworks.push(FRAMEWORKS.BACKBONE);
|
|
29
56
|
if (Object.prototype.hasOwnProperty.call(window, 'Ember')) frameworks.push(FRAMEWORKS.EMBER);
|
|
30
|
-
if (Object.prototype.hasOwnProperty.call(window, 'Vue')) frameworks.push(FRAMEWORKS.VUE);
|
|
31
57
|
if (Object.prototype.hasOwnProperty.call(window, 'Meteor')) frameworks.push(FRAMEWORKS.METEOR);
|
|
32
58
|
if (Object.prototype.hasOwnProperty.call(window, 'Zepto')) frameworks.push(FRAMEWORKS.ZEPTO);
|
|
33
59
|
if (Object.prototype.hasOwnProperty.call(window, 'jQuery')) frameworks.push(FRAMEWORKS.JQUERY);
|
|
34
60
|
if (Object.prototype.hasOwnProperty.call(window, 'MooTools')) frameworks.push(FRAMEWORKS.MOOTOOLS);
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(window, 'qwikevents')) frameworks.push(FRAMEWORKS.QWIK);
|
|
62
|
+
if (detectElectron()) frameworks.push(FRAMEWORKS.ELECTRON);
|
|
35
63
|
} catch (err) {
|
|
36
64
|
// Possibly not supported
|
|
37
65
|
}
|
|
@@ -51,9 +79,25 @@ function detectReact() {
|
|
|
51
79
|
return false;
|
|
52
80
|
}
|
|
53
81
|
}
|
|
54
|
-
function
|
|
82
|
+
function detectNextJS() {
|
|
83
|
+
// React SSR
|
|
55
84
|
try {
|
|
56
|
-
return Object.prototype.hasOwnProperty.call(window, '
|
|
85
|
+
return Object.prototype.hasOwnProperty.call(window, 'next') && Object.prototype.hasOwnProperty.call(window.next, 'version');
|
|
86
|
+
} catch (err) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function detectVue() {
|
|
91
|
+
try {
|
|
92
|
+
return Object.prototype.hasOwnProperty.call(window, 'Vue');
|
|
93
|
+
} catch (err) {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function detectNuxtJS() {
|
|
98
|
+
// Vue SSR
|
|
99
|
+
try {
|
|
100
|
+
return Object.prototype.hasOwnProperty.call(window, '$nuxt') && Object.prototype.hasOwnProperty.call(window.$nuxt, 'nuxt');
|
|
57
101
|
} catch (err) {
|
|
58
102
|
return false;
|
|
59
103
|
}
|
|
@@ -64,4 +108,56 @@ function detectAngular() {
|
|
|
64
108
|
} catch (err) {
|
|
65
109
|
return false;
|
|
66
110
|
}
|
|
111
|
+
}
|
|
112
|
+
function detectAngularUniversal() {
|
|
113
|
+
// Anguler SSR
|
|
114
|
+
try {
|
|
115
|
+
return document.querySelector('[ng-server-context]');
|
|
116
|
+
} catch (err) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function detectSvelte() {
|
|
121
|
+
try {
|
|
122
|
+
return Object.prototype.hasOwnProperty.call(window, '__svelte');
|
|
123
|
+
} catch (err) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function detectSvelteKit() {
|
|
128
|
+
// Svelte SSR
|
|
129
|
+
try {
|
|
130
|
+
return !!Object.keys(window).find(prop => prop.startsWith('__sveltekit'));
|
|
131
|
+
} catch (err) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function detectPreact() {
|
|
136
|
+
try {
|
|
137
|
+
return Object.prototype.hasOwnProperty.call(window, 'preact');
|
|
138
|
+
} catch (err) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
function detectPreactSSR() {
|
|
143
|
+
// Svelte SSR
|
|
144
|
+
try {
|
|
145
|
+
return document.querySelector('script[type="__PREACT_CLI_DATA__"]');
|
|
146
|
+
} catch (err) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function detectAngularJs() {
|
|
151
|
+
try {
|
|
152
|
+
return Object.prototype.hasOwnProperty.call(window, 'angular') || document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') || document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]');
|
|
153
|
+
} catch (err) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function detectElectron() {
|
|
158
|
+
try {
|
|
159
|
+
return typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0;
|
|
160
|
+
} catch (err) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
67
163
|
}
|
|
@@ -8,18 +8,13 @@ var _config = require("../../../common/config/config");
|
|
|
8
8
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
9
9
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
-
var _drain = require("../../../common/drain/drain");
|
|
12
11
|
var _frameworkDetection = require("./framework-detection");
|
|
13
|
-
var _polyfillDetection = require("./polyfill-detection");
|
|
14
12
|
var _protocol = require("../../../common/url/protocol");
|
|
15
13
|
var _obfuscate = require("../../../common/util/obfuscate");
|
|
16
|
-
var _env = require("../../../common/constants/env.npm");
|
|
17
14
|
var _load = require("../../../common/window/load");
|
|
18
15
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
19
16
|
var _runtime = require("../../../common/constants/runtime");
|
|
20
17
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
21
|
-
var _stringify = require("../../../common/util/stringify");
|
|
22
|
-
var _endpointMap = require("./endpoint-map");
|
|
23
18
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
24
19
|
static featureName = _constants.FEATURE_NAME;
|
|
25
20
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -45,9 +40,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
45
40
|
scheduler.harvest.on('jserrors', () => ({
|
|
46
41
|
body: this.aggregator.take(['cm', 'sm'])
|
|
47
42
|
}));
|
|
48
|
-
|
|
43
|
+
this.drain();
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
storeSupportabilityMetrics(name, value) {
|
|
52
46
|
if (this.blocked) return;
|
|
53
47
|
const type = _constants.SUPPORTABILITY_METRIC;
|
|
@@ -65,9 +59,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
65
59
|
this.aggregator.store(type, name, params, metrics);
|
|
66
60
|
}
|
|
67
61
|
singleChecks() {
|
|
68
|
-
// report generic info about the agent itself
|
|
69
|
-
// note the browser agent version
|
|
70
|
-
this.storeSupportabilityMetrics("Generic/Version/".concat(_env.VERSION, "/Detected"));
|
|
71
62
|
// report loaderType
|
|
72
63
|
const {
|
|
73
64
|
distMethod,
|
|
@@ -78,22 +69,27 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
78
69
|
|
|
79
70
|
// frameworks on page
|
|
80
71
|
if (_runtime.isBrowserScope) {
|
|
72
|
+
this.storeSupportabilityMetrics('Generic/Runtime/Browser/Detected');
|
|
73
|
+
|
|
74
|
+
// These SMs are used by the AppExp team
|
|
81
75
|
(0, _load.onDOMContentLoaded)(() => {
|
|
82
76
|
(0, _frameworkDetection.getFrameworks)().forEach(framework => {
|
|
83
77
|
this.storeSupportabilityMetrics('Framework/' + framework + '/Detected');
|
|
84
78
|
});
|
|
85
79
|
});
|
|
80
|
+
} else if (_runtime.isWorkerScope) {
|
|
81
|
+
this.storeSupportabilityMetrics('Generic/Runtime/Worker/Detected');
|
|
82
|
+
} else {
|
|
83
|
+
this.storeSupportabilityMetrics('Generic/Runtime/Unknown/Detected');
|
|
86
84
|
}
|
|
87
|
-
(0, _polyfillDetection.getPolyfills)().forEach(polyfill => {
|
|
88
|
-
this.storeSupportabilityMetrics('Polyfill/' + polyfill + '/Detected');
|
|
89
|
-
});
|
|
90
85
|
|
|
91
|
-
// file protocol
|
|
86
|
+
// Track if the agent is being loaded using a file protocol such as is the case in some
|
|
87
|
+
// set-top box applications or Electron applications
|
|
92
88
|
if ((0, _protocol.isFileProtocol)()) {
|
|
93
89
|
this.storeSupportabilityMetrics('Generic/FileProtocol/Detected');
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
// obfuscation
|
|
92
|
+
// Capture SMs to assess customer engagement with the obfuscation config
|
|
97
93
|
const rules = (0, _obfuscate.getRules)(this.agentIdentifier);
|
|
98
94
|
if (rules.length > 0) this.storeSupportabilityMetrics('Generic/Obfuscate/Detected');
|
|
99
95
|
if (rules.length > 0 && !(0, _obfuscate.validateRules)(rules)) this.storeSupportabilityMetrics('Generic/Obfuscate/Invalid');
|
|
@@ -106,18 +102,17 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
106
102
|
if (evt.persisted) {
|
|
107
103
|
this.storeSupportabilityMetrics('Generic/BFCache/PageRestored');
|
|
108
104
|
}
|
|
109
|
-
return;
|
|
110
105
|
});
|
|
111
106
|
}
|
|
112
107
|
unload() {
|
|
113
|
-
// Page Resources detection for estimations with resources feature work
|
|
114
|
-
// TODO - these SMs are to be removed when we implement the actual resources feature
|
|
115
108
|
try {
|
|
116
109
|
if (this.resourcesSent) return;
|
|
110
|
+
this.resourcesSent = true; // make sure this only gets sent once
|
|
111
|
+
|
|
117
112
|
const agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
118
|
-
|
|
119
|
-
//
|
|
120
|
-
this
|
|
113
|
+
|
|
114
|
+
// Capture SMs around network resources using the performance API to assess
|
|
115
|
+
// work to split this out from the ST nodes
|
|
121
116
|
// differentiate between internal+external and ajax+non-ajax
|
|
122
117
|
const ajaxResources = ['beacon', 'fetch', 'xmlhttprequest'];
|
|
123
118
|
const internalUrls = ['nr-data.net', 'newrelic.com', 'nr-local.net', 'localhost'];
|
|
@@ -136,26 +131,14 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
136
131
|
}
|
|
137
132
|
});
|
|
138
133
|
|
|
139
|
-
// Capture
|
|
140
|
-
|
|
141
|
-
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(_endpointMap.endpointMap[endpoint], "/BytesSent"), agentRuntime.bytesSent[endpoint]);
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// Capture per-agent query bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
|
|
145
|
-
Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
|
|
146
|
-
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(_endpointMap.endpointMap[endpoint], "/QueryBytesSent"), agentRuntime.queryBytesSent[endpoint]);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
// Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
|
|
134
|
+
// Capture SMs for session trace if active (`ptid` is set when returned by replay ingest).
|
|
135
|
+
// Retain these SMs while we are working through the session_replay feature
|
|
150
136
|
if (agentRuntime.ptid) {
|
|
151
137
|
this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()));
|
|
152
138
|
}
|
|
153
139
|
|
|
154
|
-
// Capture
|
|
155
|
-
|
|
156
|
-
this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length);
|
|
157
|
-
|
|
158
|
-
// Capture metrics for performance markers and measures
|
|
140
|
+
// Capture SMs for performance markers and measures to assess the usage and possible inclusion of this
|
|
141
|
+
// data in the agent for use in NR
|
|
159
142
|
if (typeof performance !== 'undefined') {
|
|
160
143
|
const markers = performance.getEntriesByType('mark');
|
|
161
144
|
const measures = performance.getEntriesByType('measure');
|
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
7
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
8
8
|
var _constants = require("../constants");
|
|
9
|
-
var _handle = require("../../../common/event-emitter/handle");
|
|
10
|
-
var _features = require("../../../loaders/features/features");
|
|
11
9
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
12
10
|
static featureName = _constants.FEATURE_NAME;
|
|
13
11
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -11,7 +11,6 @@ var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
|
11
11
|
var _cleanUrl = require("../../../common/url/clean-url");
|
|
12
12
|
var _config = require("../../../common/config/config");
|
|
13
13
|
var _constants = require("../constants");
|
|
14
|
-
var _drain = require("../../../common/drain/drain");
|
|
15
14
|
var _runtime = require("../../../common/constants/runtime");
|
|
16
15
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
17
16
|
/*
|
|
@@ -28,8 +27,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
28
27
|
this.eventsPerMinute = 240;
|
|
29
28
|
this.harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_action.harvestTimeSeconds') || (0, _config.getConfigurationValue)(this.agentIdentifier, 'ins.harvestTimeSeconds') || 30;
|
|
30
29
|
this.eventsPerHarvest = this.eventsPerMinute * this.harvestTimeSeconds / 60;
|
|
31
|
-
this.referrerUrl;
|
|
32
|
-
this.currentEvents;
|
|
30
|
+
this.referrerUrl = undefined;
|
|
31
|
+
this.currentEvents = undefined;
|
|
33
32
|
this.events = [];
|
|
34
33
|
this.att = (0, _config.getInfo)(this.agentIdentifier).jsAttributes; // per-agent, aggregators-shared info context
|
|
35
34
|
|
|
@@ -37,24 +36,23 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
37
36
|
(0, _registerHandler.registerHandler)('api-addPageAction', function () {
|
|
38
37
|
return _this.addPageAction(...arguments);
|
|
39
38
|
}, this.featureName, this.ee);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
this.waitForFlags(['ins']).then(_ref => {
|
|
40
|
+
let [enabled] = _ref;
|
|
41
|
+
if (enabled) {
|
|
42
|
+
const scheduler = new _harvestScheduler.HarvestScheduler('ins', {
|
|
43
|
+
onFinished: function () {
|
|
44
|
+
return _this.onHarvestFinished(...arguments);
|
|
45
|
+
}
|
|
46
|
+
}, this);
|
|
47
|
+
scheduler.harvest.on('ins', function () {
|
|
48
|
+
return _this.onHarvestStarted(...arguments);
|
|
49
|
+
});
|
|
50
|
+
scheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
51
|
+
} else {
|
|
52
|
+
this.blocked = true;
|
|
43
53
|
}
|
|
44
|
-
}, this);
|
|
45
|
-
scheduler.harvest.on('ins', function () {
|
|
46
|
-
return _this.onHarvestStarted(...arguments);
|
|
47
54
|
});
|
|
48
|
-
this.
|
|
49
|
-
if (!this.blocked) scheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
// if rum response determines that customer lacks entitlements for ins endpoint, block it
|
|
53
|
-
(0, _registerHandler.registerHandler)('block-ins', () => {
|
|
54
|
-
this.blocked = true;
|
|
55
|
-
scheduler.stopTimer(true);
|
|
56
|
-
}, this.featureName, this.ee);
|
|
57
|
-
(0, _drain.drain)(this.agentIdentifier, this.featureName);
|
|
55
|
+
this.drain();
|
|
58
56
|
}
|
|
59
57
|
onHarvestStarted(options) {
|
|
60
58
|
const {
|
|
@@ -15,7 +15,6 @@ var _config = require("../../../common/config/config");
|
|
|
15
15
|
var _harvest = require("../../../common/harvest/harvest");
|
|
16
16
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
17
17
|
var _initializedFeatures = require("./initialized-features");
|
|
18
|
-
var _drain = require("../../../common/drain/drain");
|
|
19
18
|
var _featureFlags = require("../../../common/util/feature-flags");
|
|
20
19
|
var _console = require("../../../common/util/console");
|
|
21
20
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
@@ -155,7 +154,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
155
154
|
}
|
|
156
155
|
try {
|
|
157
156
|
(0, _featureFlags.activateFeatures)(JSON.parse(responseText), this.agentIdentifier);
|
|
158
|
-
|
|
157
|
+
this.drain();
|
|
159
158
|
} catch (err) {
|
|
160
159
|
this.ee.abort();
|
|
161
160
|
(0, _console.warn)('RUM call failed. Agent shutting down.');
|
|
@@ -21,10 +21,12 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
21
21
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
22
22
|
if ((typeof PerformanceNavigationTiming === 'undefined' || _runtime.isiOS) && typeof PerformanceTiming !== 'undefined') {
|
|
23
23
|
// For majority browser versions in which PNT exists, we can get load timings later from the nav entry (in the aggregate portion). At minimum, PT should exist for main window.
|
|
24
|
-
// *cli Mar'23 - iOS 15.2 & 15.4 testing in Sauce still fails with onTTFB. Hence, all iOS will fallback to this for now. Unknown if this is similar in nature to
|
|
24
|
+
// *cli Mar'23 - iOS 15.2 & 15.4 testing in Sauce still fails with onTTFB. Hence, all iOS will fallback to this for now. Unknown if this is similar in nature to iOSBelow16 bug.
|
|
25
25
|
const agentRuntime = (0, _config.getRuntime)(agentIdentifier);
|
|
26
26
|
agentRuntime[CONSTANTS.TTFB] = Math.max(Date.now() - agentRuntime.offset, 0);
|
|
27
|
-
(0, _load.onDOMContentLoaded)(() =>
|
|
27
|
+
(0, _load.onDOMContentLoaded)(() => {
|
|
28
|
+
agentRuntime[CONSTANTS.FBTDC] = Math.max((0, _now.now)() - agentRuntime[CONSTANTS.TTFB], 0);
|
|
29
|
+
});
|
|
28
30
|
(0, _load.onWindowLoad)(() => {
|
|
29
31
|
const timeNow = (0, _now.now)();
|
|
30
32
|
agentRuntime[CONSTANTS.FBTWL] = Math.max(timeNow - agentRuntime[CONSTANTS.TTFB], 0);
|
|
@@ -16,7 +16,6 @@ var _cleanUrl = require("../../../common/url/clean-url");
|
|
|
16
16
|
var _handle = require("../../../common/event-emitter/handle");
|
|
17
17
|
var _config = require("../../../common/config/config");
|
|
18
18
|
var _constants = require("../constants");
|
|
19
|
-
var _drain = require("../../../common/drain/drain");
|
|
20
19
|
var _features = require("../../../loaders/features/features");
|
|
21
20
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
22
21
|
/*
|
|
@@ -51,7 +50,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
51
50
|
});
|
|
52
51
|
|
|
53
52
|
/* First Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
54
|
-
if (_runtime.
|
|
53
|
+
if (_runtime.iOSBelow16) {
|
|
55
54
|
try {
|
|
56
55
|
if (!pageStartedHidden) {
|
|
57
56
|
// see ios-version.js for detail on this following bug case; tldr: buffered flag doesn't work but getEntriesByType does
|
|
@@ -127,7 +126,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
127
126
|
let {
|
|
128
127
|
value
|
|
129
128
|
} = _ref5;
|
|
130
|
-
|
|
129
|
+
this.cls = value;
|
|
131
130
|
}, {
|
|
132
131
|
reportAllChanges: true
|
|
133
132
|
});
|
|
@@ -176,7 +175,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
176
175
|
this.ee.on("drain-".concat(this.featureName), () => {
|
|
177
176
|
this.scheduler.startTimer(harvestTimeSeconds, initialHarvestSeconds);
|
|
178
177
|
});
|
|
179
|
-
|
|
178
|
+
this.drain();
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
// takes an attributes object and appends connection attributes if available
|
|
@@ -230,9 +229,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
230
229
|
attrs.cls = this.cls;
|
|
231
230
|
}
|
|
232
231
|
this.timings.push({
|
|
233
|
-
name
|
|
234
|
-
value
|
|
235
|
-
attrs
|
|
232
|
+
name,
|
|
233
|
+
value,
|
|
234
|
+
attrs
|
|
236
235
|
});
|
|
237
236
|
(0, _handle.handle)('pvtAdded', [name, value, attrs], undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
|
|
238
237
|
}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RRWEB_VERSION = exports.MAX_PAYLOAD_SIZE = exports.IDEAL_PAYLOAD_SIZE = exports.Aggregate = exports.AVG_COMPRESSION = void 0;
|
|
7
|
-
var _drain = require("../../../common/drain/drain");
|
|
8
7
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
9
8
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
10
9
|
var _constants = require("../constants");
|
|
@@ -14,6 +13,7 @@ var _sessionEntity = require("../../../common/session/session-entity");
|
|
|
14
13
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
15
14
|
var _sharedChannel = require("../../../common/constants/shared-channel");
|
|
16
15
|
var _encode = require("../../../common/url/encode");
|
|
16
|
+
var _console = require("../../../common/util/console");
|
|
17
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /*
|
|
19
19
|
* Copyright 2023 New Relic Corporation. All rights reserved.
|
|
@@ -135,7 +135,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
135
135
|
return this.initializeRecording(flagOn, Math.random() < (0, _config.getConfigurationValue)(this.agentIdentifier, 'session_replay.errorSampleRate'), Math.random() < (0, _config.getConfigurationValue)(this.agentIdentifier, 'session_replay.sampleRate'));
|
|
136
136
|
}).then(() => _sharedChannel.sharedChannel.onReplayReady(this.mode)); // notify watchers that replay started with the mode
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
this.drain();
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
|
|
@@ -182,11 +182,13 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
182
182
|
this.scheduler.startTimer(this.harvestTimeSeconds);
|
|
183
183
|
}
|
|
184
184
|
try {
|
|
185
|
+
// Do not change the webpackChunkName or it will break the webpack nrba-chunking plugin
|
|
185
186
|
recorder = (await Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "recorder" */'rrweb')))).record;
|
|
186
187
|
} catch (err) {
|
|
187
188
|
return this.abort();
|
|
188
189
|
}
|
|
189
190
|
try {
|
|
191
|
+
// Do not change the webpackChunkName or it will break the webpack nrba-chunking plugin
|
|
190
192
|
const {
|
|
191
193
|
gzipSync,
|
|
192
194
|
strToU8
|
|
@@ -266,7 +268,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
266
268
|
/** Begin recording using configured recording lib */
|
|
267
269
|
startRecording() {
|
|
268
270
|
if (!recorder) {
|
|
269
|
-
warn('Recording library was never imported');
|
|
271
|
+
(0, _console.warn)('Recording library was never imported');
|
|
270
272
|
return this.abort();
|
|
271
273
|
}
|
|
272
274
|
this.recording = true;
|
|
@@ -10,7 +10,6 @@ var _parseUrl = require("../../../common/url/parse-url");
|
|
|
10
10
|
var _config = require("../../../common/config/config");
|
|
11
11
|
var _now = require("../../../common/timing/now");
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
-
var _drain = require("../../../common/drain/drain");
|
|
14
13
|
var _handlerCache = require("../../utils/handler-cache");
|
|
15
14
|
var _sessionEntity = require("../../../common/session/session-entity");
|
|
16
15
|
var _replayMode = require("../../session_replay/replay-mode");
|
|
@@ -64,9 +63,13 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
64
63
|
this.sentTrace = null;
|
|
65
64
|
this.harvestTimeSeconds = (0, _config.getConfigurationValue)(agentIdentifier, 'session_trace.harvestTimeSeconds') || 10;
|
|
66
65
|
this.maxNodesPerHarvest = (0, _config.getConfigurationValue)(agentIdentifier, 'session_trace.maxNodesPerHarvest') || 1000;
|
|
66
|
+
/**
|
|
67
|
+
* Standalone (mode) refers to the legacy version of ST before the idea of 'session' or the Replay feature existed.
|
|
68
|
+
* It has some different behavior vs when used in tandem with replay. */
|
|
67
69
|
this.isStandalone = false;
|
|
68
70
|
const operationalGate = new _handlerCache.HandlerCache(); // acts as a controller-intermediary that can enable or disable this feature's collection dynamically
|
|
69
71
|
const sessionEntity = this.agentRuntime.session;
|
|
72
|
+
this.operationalGate = operationalGate;
|
|
70
73
|
|
|
71
74
|
/* --- The following section deals with user sessions concept & contains non-trivial control flow. --- */
|
|
72
75
|
const controlTraceOp = traceMode => {
|
|
@@ -140,7 +143,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
140
143
|
});
|
|
141
144
|
mostRecentModeKnown = updatedTraceMode;
|
|
142
145
|
});
|
|
143
|
-
this.ee.on(_sessionEntity.SESSION_EVENTS.PAUSE, () =>
|
|
146
|
+
this.ee.on(_sessionEntity.SESSION_EVENTS.PAUSE, () => {
|
|
147
|
+
mostRecentModeKnown = sessionEntity.state.sessionTraceMode;
|
|
148
|
+
});
|
|
144
149
|
if (!sessionEntity.isNew) {
|
|
145
150
|
// inherit the same mode as existing session's Trace
|
|
146
151
|
if (sessionEntity.state.sessionReplay === _sessionEntity.MODE.OFF) this.isStandalone = true;
|
|
@@ -212,7 +217,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
212
217
|
}
|
|
213
218
|
return operationalGate.settle(() => _this.processPVT(...args));
|
|
214
219
|
}, this.featureName, this.ee);
|
|
215
|
-
|
|
220
|
+
this.drain();
|
|
216
221
|
}
|
|
217
222
|
startTracing(startupBuffer) {
|
|
218
223
|
let dontStartHarvestYet = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -250,17 +255,16 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
257
|
#prepareHarvest(options) {
|
|
253
|
-
/* Standalone refers to the legacy version of ST before the idea of 'session' or the Replay feature existed.
|
|
254
|
-
It has a different behavior on returning a payload for harvest than when used in tandem with either of those concepts. */
|
|
255
258
|
if (this.isStandalone) {
|
|
256
|
-
if ((0, _now.now)()
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
this.
|
|
259
|
+
if (this.ptid && (0, _now.now)() >= MAX_TRACE_DURATION) {
|
|
260
|
+
// Perform a final harvest once we hit or exceed the max session trace time
|
|
261
|
+
options.isFinalHarvest = true;
|
|
262
|
+
this.operationalGate.permanentlyDecide(false);
|
|
263
|
+
this.#scheduler.stopTimer(true);
|
|
264
|
+
} else if (this.ptid && this.nodeCount <= REQ_THRESHOLD_TO_SEND && !options.isFinalHarvest) {
|
|
265
|
+
// Only harvest when more than some threshold of nodes are pending, after the very first harvest, with the exception of the last outgoing harvest.
|
|
260
266
|
return;
|
|
261
267
|
}
|
|
262
|
-
// Only harvest when more than some threshold of nodes are pending, after the very first harvest.
|
|
263
|
-
if (this.ptid && this.nodeCount <= REQ_THRESHOLD_TO_SEND) return;
|
|
264
268
|
} else {
|
|
265
269
|
// -- *cli May '26 - Update: Not rate limiting backgrounded pages either for now.
|
|
266
270
|
// if (this.ptid && document.visibilityState === 'hidden' && this.nodeCount <= REQ_THRESHOLD_TO_SEND) return
|
|
@@ -337,8 +341,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
337
341
|
const origin = this.evtOrigin(event.target, target);
|
|
338
342
|
if (event.type in ignoredEvents.global) return true;
|
|
339
343
|
if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true;
|
|
340
|
-
|
|
341
|
-
return false;
|
|
344
|
+
return !!(!!ignoredEvents[origin] && event.type in ignoredEvents[origin]);
|
|
342
345
|
}
|
|
343
346
|
evtName(type) {
|
|
344
347
|
switch (type) {
|
|
@@ -448,7 +451,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
448
451
|
// limit the amount of pending data awaiting next harvest
|
|
449
452
|
if (this.isStandalone || this.agentRuntime.session.state.sessionTraceMode !== _sessionEntity.MODE.ERROR) return;
|
|
450
453
|
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
|
|
451
|
-
if (openedSpace
|
|
454
|
+
if (openedSpace === 0) return;
|
|
455
|
+
}
|
|
456
|
+
if (this.isStandalone && (0, _now.now)() >= MAX_TRACE_DURATION) {
|
|
457
|
+
return;
|
|
452
458
|
}
|
|
453
459
|
if (this.trace[stn.n]) this.trace[stn.n].push(stn);else this.trace[stn.n] = [stn];
|
|
454
460
|
this.nodeCount++;
|
|
@@ -468,7 +474,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
468
474
|
* 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.
|
|
469
475
|
* ASSUMPTION: all 'end' timings stored are relative to timeOrigin (DOMHighResTimeStamp) and not Unix epoch based. */
|
|
470
476
|
let cutoffIdx = nodeList.findIndex(node => cutoffHighResTime <= node.e);
|
|
471
|
-
if (cutoffIdx
|
|
477
|
+
if (cutoffIdx === 0) return;else if (cutoffIdx < 0) {
|
|
472
478
|
// whole list falls outside lookback window and is irrelevant
|
|
473
479
|
cutoffIdx = nodeList.length;
|
|
474
480
|
delete this.trace[nameCategory];
|
|
@@ -532,7 +538,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
532
538
|
};
|
|
533
539
|
function trivial(node) {
|
|
534
540
|
const limit = 4;
|
|
535
|
-
|
|
541
|
+
return !!(node && typeof node.e === 'number' && typeof node.s === 'number' && node.e - node.s < limit);
|
|
536
542
|
}
|
|
537
543
|
}
|
|
538
544
|
}
|