@newrelic/browser-agent 1.232.0 → 1.233.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/cdn/polyfills.js +5 -2
- package/dist/cjs/common/config/state/configurable.js +15 -26
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +101 -56
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +1 -5
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/harvest/harvest-scheduler.js +30 -10
- package/dist/cjs/common/harvest/harvest.js +119 -55
- package/dist/cjs/common/session/session-entity.js +35 -22
- package/dist/cjs/common/session/session-entity.test.js +73 -49
- package/dist/cjs/common/timer/interaction-timer.js +9 -12
- package/dist/cjs/common/url/canonicalize-url.js +32 -0
- package/dist/cjs/common/url/canonicalize-url.test.js +42 -0
- package/dist/cjs/common/url/clean-url.js +10 -3
- package/dist/cjs/common/url/protocol.test.js +0 -1
- package/dist/cjs/common/util/feature-flags.js +2 -1
- package/dist/cjs/common/util/global-scope.js +4 -2
- package/dist/cjs/common/util/submit-data.js +57 -18
- package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
- package/dist/cjs/common/wrap/wrap-function.js +1 -3
- package/dist/cjs/common/wrap/wrap-promise.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +2 -2
- package/dist/cjs/features/ajax/instrument/index.js +1 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +164 -38
- package/dist/cjs/features/jserrors/aggregate/index.js +29 -48
- package/dist/cjs/features/jserrors/instrument/index.js +0 -2
- package/dist/cjs/features/metrics/aggregate/framework-detection.js +67 -0
- package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +137 -0
- package/dist/cjs/features/metrics/aggregate/index.js +7 -3
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +14 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +17 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +53 -0
- package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +165 -0
- package/dist/cjs/features/page_action/aggregate/index.js +2 -2
- package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
- package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +333 -0
- package/dist/cjs/features/session_replay/constants.js +9 -0
- package/dist/cjs/features/session_replay/index.js +12 -0
- package/dist/cjs/features/session_replay/instrument/index.js +29 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +163 -164
- package/dist/cjs/features/session_trace/constants.js +2 -9
- package/dist/cjs/features/session_trace/instrument/index.js +24 -66
- package/dist/cjs/features/spa/aggregate/index.js +2 -2
- package/dist/cjs/features/utils/agent-session.js +1 -2
- package/dist/cjs/features/utils/aggregate-base.js +64 -0
- package/dist/cjs/features/utils/feature-base.js +0 -31
- package/dist/cjs/features/utils/handler-cache.js +3 -4
- package/dist/cjs/features/utils/instrument-base.js +42 -10
- package/dist/cjs/features/utils/{lazy-loader.js → lazy-feature-loader.js} +4 -2
- package/dist/cjs/loaders/agent.js +1 -1
- package/dist/cjs/loaders/api/apiAsync.js +3 -1
- package/dist/cjs/loaders/configure/configure.js +3 -3
- package/dist/cjs/loaders/features/featureDependencies.js +0 -12
- package/dist/cjs/loaders/features/features.js +3 -1
- package/dist/cjs/loaders/micro-agent.js +6 -6
- package/dist/esm/cdn/polyfills.js +5 -2
- package/dist/esm/common/config/state/configurable.js +14 -24
- package/dist/esm/common/config/state/info.js +2 -2
- package/dist/esm/common/config/state/init.js +102 -57
- package/dist/esm/common/config/state/loader-config.js +2 -2
- package/dist/esm/common/config/state/runtime.js +2 -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/drain/drain.js +1 -1
- package/dist/esm/common/harvest/harvest-scheduler.js +30 -10
- package/dist/esm/common/harvest/harvest.js +121 -56
- package/dist/esm/common/session/session-entity.js +35 -22
- package/dist/esm/common/session/session-entity.test.js +73 -49
- package/dist/esm/common/timer/interaction-timer.js +9 -12
- package/dist/esm/common/url/canonicalize-url.js +27 -0
- package/dist/esm/common/url/canonicalize-url.test.js +38 -0
- package/dist/esm/common/url/clean-url.js +10 -3
- package/dist/esm/common/url/protocol.test.js +0 -1
- package/dist/esm/common/util/feature-flags.js +2 -1
- package/dist/esm/common/util/global-scope.js +1 -0
- package/dist/esm/common/util/submit-data.js +57 -18
- package/dist/esm/common/wrap/wrap-fetch.js +1 -2
- package/dist/esm/common/wrap/wrap-function.js +1 -2
- package/dist/esm/common/wrap/wrap-promise.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +2 -2
- package/dist/esm/features/ajax/instrument/index.js +1 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +93 -10
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +149 -25
- package/dist/esm/features/jserrors/aggregate/index.js +30 -48
- package/dist/esm/features/jserrors/instrument/index.js +0 -1
- package/dist/esm/features/metrics/aggregate/framework-detection.js +61 -0
- package/dist/esm/features/metrics/aggregate/framework-detection.test.js +133 -0
- package/dist/esm/features/metrics/aggregate/index.js +7 -3
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +8 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +15 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.js +47 -0
- package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +163 -0
- package/dist/esm/features/page_action/aggregate/index.js +2 -2
- package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +2 -2
- package/dist/esm/features/session_replay/aggregate/index.js +327 -0
- package/dist/esm/features/session_replay/constants.js +2 -0
- package/dist/esm/features/session_replay/index.js +12 -0
- package/dist/esm/features/session_replay/instrument/index.js +21 -0
- package/dist/esm/features/session_trace/aggregate/index.js +163 -163
- package/dist/esm/features/session_trace/constants.js +1 -5
- package/dist/esm/features/session_trace/instrument/index.js +24 -66
- package/dist/esm/features/spa/aggregate/index.js +2 -2
- package/dist/esm/features/utils/agent-session.js +1 -2
- package/dist/esm/features/utils/aggregate-base.js +57 -0
- package/dist/esm/features/utils/feature-base.js +1 -32
- package/dist/esm/features/utils/handler-cache.js +3 -4
- package/dist/esm/features/utils/instrument-base.js +42 -10
- package/dist/esm/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
- package/dist/esm/loaders/agent.js +1 -1
- package/dist/esm/loaders/api/apiAsync.js +3 -1
- package/dist/esm/loaders/configure/configure.js +3 -3
- package/dist/esm/loaders/features/featureDependencies.js +0 -11
- package/dist/esm/loaders/features/features.js +3 -1
- package/dist/esm/loaders/micro-agent.js +6 -6
- package/dist/types/common/config/state/configurable.d.ts +1 -3
- package/dist/types/common/config/state/configurable.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +37 -34
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts +6 -3
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/timer/interaction-timer.d.ts +2 -1
- package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
- package/dist/types/common/url/canonicalize-url.d.ts +9 -0
- package/dist/types/common/url/canonicalize-url.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +7 -1
- package/dist/types/common/url/clean-url.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/util/global-scope.d.ts +1 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts +40 -14
- package/dist/types/common/util/submit-data.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.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +8 -1
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +48 -19
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +14 -5
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +6 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +7 -0
- package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -0
- package/dist/types/features/page_action/aggregate/index.d.ts +3 -3
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
- 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 +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +96 -0
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_replay/constants.d.ts +2 -0
- package/dist/types/features/session_replay/constants.d.ts.map +1 -0
- package/dist/types/features/session_replay/index.d.ts +2 -0
- package/dist/types/features/session_replay/index.d.ts.map +1 -0
- package/dist/types/features/session_replay/instrument/index.d.ts +6 -0
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +8 -57
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/constants.d.ts +0 -3
- package/dist/types/features/session_trace/constants.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts +1 -3
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +11 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +0 -5
- package/dist/types/features/utils/feature-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 +3 -1
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/features/utils/{lazy-loader.d.ts → lazy-feature-loader.d.ts} +2 -2
- package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/featureDependencies.d.ts +0 -1
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/package.json +31 -22
- package/src/cdn/polyfills.js +4 -1
- package/src/common/config/state/configurable.js +18 -24
- package/src/common/config/state/info.js +2 -2
- package/src/common/config/state/init.js +62 -28
- package/src/common/config/state/loader-config.js +2 -2
- package/src/common/config/state/runtime.js +2 -4
- package/src/common/drain/drain.js +1 -1
- package/src/common/harvest/harvest-scheduler.js +35 -10
- package/src/common/harvest/harvest.js +73 -50
- package/src/common/session/session-entity.js +34 -23
- package/src/common/session/session-entity.test.js +57 -51
- package/src/common/timer/interaction-timer.js +9 -12
- package/src/common/url/canonicalize-url.js +28 -0
- package/src/common/url/canonicalize-url.test.js +34 -0
- package/src/common/url/clean-url.js +10 -3
- package/src/common/url/protocol.test.js +0 -1
- package/src/common/util/feature-flags.js +2 -2
- package/src/common/util/global-scope.js +2 -0
- package/src/common/util/submit-data.js +28 -17
- package/src/common/wrap/wrap-fetch.js +1 -2
- package/src/common/wrap/wrap-function.js +1 -2
- package/src/common/wrap/wrap-promise.js +1 -1
- package/src/features/ajax/aggregate/index.js +2 -2
- package/src/features/ajax/instrument/index.js +1 -1
- package/src/features/jserrors/aggregate/canonical-function-name.js +12 -4
- package/src/features/jserrors/aggregate/compute-stack-trace.js +85 -11
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +141 -24
- package/src/features/jserrors/aggregate/index.js +28 -52
- package/src/features/jserrors/instrument/index.js +0 -1
- package/src/features/metrics/aggregate/framework-detection.js +73 -0
- package/src/features/metrics/aggregate/framework-detection.test.js +201 -0
- package/src/features/metrics/aggregate/index.js +8 -3
- package/src/features/metrics/aggregate/polyfill-detection.es5.js +9 -0
- package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +16 -0
- package/src/features/metrics/aggregate/polyfill-detection.js +48 -0
- package/src/features/metrics/aggregate/polyfill-detection.test.js +163 -0
- package/src/features/page_action/aggregate/index.js +2 -2
- package/src/features/page_view_event/aggregate/index.js +5 -5
- package/src/features/page_view_timing/aggregate/index.js +2 -2
- package/src/features/session_replay/aggregate/index.js +314 -0
- package/src/features/session_replay/constants.js +3 -0
- package/src/features/session_replay/index.js +12 -0
- package/src/features/session_replay/instrument/index.js +22 -0
- package/src/features/session_trace/aggregate/index.js +148 -188
- package/src/features/session_trace/constants.js +0 -4
- package/src/features/session_trace/instrument/index.js +17 -69
- package/src/features/spa/aggregate/index.js +2 -2
- package/src/features/utils/agent-session.js +1 -2
- package/src/features/utils/aggregate-base.js +51 -0
- package/src/features/utils/feature-base.js +1 -31
- package/src/features/utils/handler-cache.js +3 -4
- package/src/features/utils/instrument-base.js +40 -8
- package/src/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
- package/src/loaders/agent.js +1 -1
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/configure/configure.js +4 -3
- package/src/loaders/features/featureDependencies.js +0 -12
- package/src/loaders/features/features.js +3 -1
- package/src/loaders/micro-agent.js +4 -4
- package/dist/cjs/common/metrics/framework-detection.js +0 -72
- package/dist/cjs/common/util/user-agent.js +0 -57
- package/dist/cjs/common/window/supports-performance-observer.js +0 -15
- package/dist/esm/common/metrics/framework-detection.js +0 -66
- package/dist/esm/common/util/user-agent.js +0 -48
- package/dist/esm/common/window/supports-performance-observer.js +0 -9
- package/dist/types/common/metrics/framework-detection.d.ts.map +0 -1
- package/dist/types/common/util/user-agent.d.ts +0 -5
- package/dist/types/common/util/user-agent.d.ts.map +0 -1
- package/dist/types/common/window/supports-performance-observer.d.ts +0 -2
- package/dist/types/common/window/supports-performance-observer.d.ts.map +0 -1
- package/dist/types/features/utils/lazy-loader.d.ts.map +0 -1
- package/src/common/metrics/framework-detection.js +0 -71
- package/src/common/util/user-agent.js +0 -56
- package/src/common/window/supports-performance-observer.js +0 -10
- /package/dist/types/{common/metrics → features/metrics/aggregate}/framework-detection.d.ts +0 -0
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
require("core-js/stable/promise");
|
|
4
4
|
require("core-js/stable/array/includes");
|
|
5
|
-
require("core-js/stable/array/from");
|
|
6
5
|
require("core-js/stable/array/find");
|
|
6
|
+
require("core-js/stable/array/flat");
|
|
7
|
+
require("core-js/stable/array/flat-map");
|
|
8
|
+
require("core-js/stable/array/from");
|
|
7
9
|
require("core-js/stable/array/some");
|
|
8
10
|
require("core-js/stable/object/assign");
|
|
9
11
|
require("core-js/stable/object/entries");
|
|
@@ -11,4 +13,5 @@ require("core-js/stable/object/values");
|
|
|
11
13
|
require("core-js/stable/map");
|
|
12
14
|
require("core-js/stable/reflect");
|
|
13
15
|
require("core-js/stable/set");
|
|
14
|
-
require("core-js/stable/weak-set");
|
|
16
|
+
require("core-js/stable/weak-set");
|
|
17
|
+
require("core-js/stable/object/get-own-property-descriptors");
|
|
@@ -3,36 +3,25 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _featureDependencies = require("../../../loaders/features/featureDependencies");
|
|
6
|
+
exports.getModeledObject = getModeledObject;
|
|
8
7
|
var _console = require("../../util/console");
|
|
9
|
-
|
|
10
|
-
constructor(obj, model) {
|
|
11
|
-
Object.assign(this, setValues(obj, model));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.Configurable = Configurable;
|
|
15
|
-
function setValues(obj, model) {
|
|
16
|
-
const state = {};
|
|
8
|
+
function getModeledObject(obj, model) {
|
|
17
9
|
try {
|
|
18
|
-
if (!obj || typeof obj !== 'object') return (0, _console.warn)('
|
|
10
|
+
if (!obj || typeof obj !== 'object') return (0, _console.warn)('Setting a Configurable requires an object as input');
|
|
19
11
|
if (!model || typeof model !== 'object') return (0, _console.warn)('Setting a Configurable requires a model to set its initial properties');
|
|
20
|
-
|
|
21
|
-
Object.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
});
|
|
12
|
+
// allow getters and setters to pass from model to target
|
|
13
|
+
const output = Object.create(Object.getPrototypeOf(model), Object.getOwnPropertyDescriptors(model));
|
|
14
|
+
const target = Object.keys(output).length === 0 ? obj : output;
|
|
15
|
+
for (let key in target) {
|
|
16
|
+
if (obj[key] !== undefined) {
|
|
17
|
+
try {
|
|
18
|
+
if (typeof obj[key] === 'object' && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key]);else output[key] = obj[key];
|
|
19
|
+
} catch (e) {
|
|
20
|
+
(0, _console.warn)('An error occurred while setting a property of a Configurable', e);
|
|
21
|
+
}
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return state;
|
|
23
|
+
}
|
|
24
|
+
return output;
|
|
36
25
|
} catch (err) {
|
|
37
26
|
(0, _console.warn)('An error occured while setting a Configurable', err);
|
|
38
27
|
}
|
|
@@ -45,6 +45,6 @@ function getInfo(id) {
|
|
|
45
45
|
}
|
|
46
46
|
function setInfo(id, obj) {
|
|
47
47
|
if (!id) throw new Error('All info objects require an agent identifier!');
|
|
48
|
-
_cache[id] =
|
|
48
|
+
_cache[id] = (0, _configurable.getModeledObject)(obj, model);
|
|
49
49
|
(0, _nreum.gosNREUMInitializedAgents)(id, _cache[id], 'info');
|
|
50
50
|
}
|
|
@@ -7,63 +7,108 @@ exports.getConfiguration = getConfiguration;
|
|
|
7
7
|
exports.getConfigurationValue = getConfigurationValue;
|
|
8
8
|
exports.setConfiguration = setConfiguration;
|
|
9
9
|
var _constants = require("../../session/constants");
|
|
10
|
-
var _globalScope = require("../../util/global-scope");
|
|
11
10
|
var _nreum = require("../../window/nreum");
|
|
12
11
|
var _configurable = require("./configurable");
|
|
13
|
-
const model = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
12
|
+
const model = () => {
|
|
13
|
+
const hiddenState = {
|
|
14
|
+
blockSelector: '[data-nr-block]',
|
|
15
|
+
maskInputOptions: {
|
|
16
|
+
password: true
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
allow_bfcache: true,
|
|
21
|
+
// *cli - temporary feature flag for BFCache work
|
|
22
|
+
privacy: {
|
|
23
|
+
cookies_enabled: true
|
|
24
|
+
},
|
|
25
|
+
// *cli - per discussion, default should be true
|
|
26
|
+
ajax: {
|
|
27
|
+
deny_list: undefined,
|
|
28
|
+
enabled: true,
|
|
29
|
+
harvestTimeSeconds: 10
|
|
30
|
+
},
|
|
31
|
+
distributed_tracing: {
|
|
32
|
+
enabled: undefined,
|
|
33
|
+
exclude_newrelic_header: undefined,
|
|
34
|
+
cors_use_newrelic_header: undefined,
|
|
35
|
+
cors_use_tracecontext_headers: undefined,
|
|
36
|
+
allowed_origins: undefined
|
|
37
|
+
},
|
|
38
|
+
session: {
|
|
39
|
+
domain: undefined,
|
|
40
|
+
// used by first party cookies to set the top-level domain
|
|
41
|
+
expiresMs: _constants.DEFAULT_EXPIRES_MS,
|
|
42
|
+
inactiveMs: _constants.DEFAULT_INACTIVE_MS
|
|
43
|
+
},
|
|
44
|
+
ssl: undefined,
|
|
45
|
+
obfuscate: undefined,
|
|
46
|
+
jserrors: {
|
|
47
|
+
enabled: true,
|
|
48
|
+
harvestTimeSeconds: 10
|
|
49
|
+
},
|
|
50
|
+
metrics: {
|
|
51
|
+
enabled: true
|
|
52
|
+
},
|
|
53
|
+
page_action: {
|
|
54
|
+
enabled: true,
|
|
55
|
+
harvestTimeSeconds: 30
|
|
56
|
+
},
|
|
57
|
+
page_view_event: {
|
|
58
|
+
enabled: true
|
|
59
|
+
},
|
|
60
|
+
page_view_timing: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
harvestTimeSeconds: 30,
|
|
63
|
+
long_task: false
|
|
64
|
+
},
|
|
65
|
+
session_trace: {
|
|
66
|
+
enabled: true,
|
|
67
|
+
harvestTimeSeconds: 10
|
|
68
|
+
},
|
|
69
|
+
session_replay: {
|
|
70
|
+
// feature settings
|
|
71
|
+
enabled: true,
|
|
72
|
+
harvestTimeSeconds: 60,
|
|
73
|
+
sampleRate: 0.1,
|
|
74
|
+
errorSampleRate: 0.1,
|
|
75
|
+
// recording config settings
|
|
76
|
+
maskTextSelector: '*',
|
|
77
|
+
maskAllInputs: true,
|
|
78
|
+
// these properties only have getters because they are enforcable constants and should error if someone tries to override them
|
|
79
|
+
get blockClass() {
|
|
80
|
+
return 'nr-block';
|
|
81
|
+
},
|
|
82
|
+
get ignoreClass() {
|
|
83
|
+
return 'nr-ignore';
|
|
84
|
+
},
|
|
85
|
+
get maskTextClass() {
|
|
86
|
+
return 'nr-mask';
|
|
87
|
+
},
|
|
88
|
+
// props with a getter and setter are used to extend enforcable constants with customer input
|
|
89
|
+
// we must preserve data-nr-block no matter what else the customer sets
|
|
90
|
+
get blockSelector() {
|
|
91
|
+
return hiddenState.blockSelector;
|
|
92
|
+
},
|
|
93
|
+
set blockSelector(val) {
|
|
94
|
+
hiddenState.blockSelector += ",".concat(val);
|
|
95
|
+
},
|
|
96
|
+
// password: must always be present and true no matter what customer sets
|
|
97
|
+
get maskInputOptions() {
|
|
98
|
+
return hiddenState.maskInputOptions;
|
|
99
|
+
},
|
|
100
|
+
set maskInputOptions(val) {
|
|
101
|
+
hiddenState.maskInputOptions = {
|
|
102
|
+
...val,
|
|
103
|
+
password: true
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
spa: {
|
|
108
|
+
enabled: true,
|
|
109
|
+
harvestTimeSeconds: 10
|
|
110
|
+
}
|
|
111
|
+
};
|
|
67
112
|
};
|
|
68
113
|
const _cache = {};
|
|
69
114
|
function getConfiguration(id) {
|
|
@@ -73,7 +118,7 @@ function getConfiguration(id) {
|
|
|
73
118
|
}
|
|
74
119
|
function setConfiguration(id, obj) {
|
|
75
120
|
if (!id) throw new Error('All configuration objects require an agent identifier!');
|
|
76
|
-
_cache[id] =
|
|
121
|
+
_cache[id] = (0, _configurable.getModeledObject)(obj, model());
|
|
77
122
|
(0, _nreum.gosNREUMInitializedAgents)(id, _cache[id], 'config');
|
|
78
123
|
}
|
|
79
124
|
function getConfigurationValue(id, path) {
|
|
@@ -23,6 +23,6 @@ function getLoaderConfig(id) {
|
|
|
23
23
|
}
|
|
24
24
|
function setLoaderConfig(id, obj) {
|
|
25
25
|
if (!id) throw new Error('All loader-config objects require an agent identifier!');
|
|
26
|
-
_cache[id] =
|
|
26
|
+
_cache[id] = (0, _configurable.getModeledObject)(obj, model);
|
|
27
27
|
(0, _nreum.gosNREUMInitializedAgents)(id, _cache[id], 'loader_config');
|
|
28
28
|
}
|
|
@@ -5,13 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getRuntime = getRuntime;
|
|
7
7
|
exports.setRuntime = setRuntime;
|
|
8
|
-
var userAgent = _interopRequireWildcard(require("../../util/user-agent"));
|
|
9
8
|
var _configurable = require("./configurable");
|
|
10
9
|
var _nreum = require("../../window/nreum");
|
|
11
10
|
var _globalScope = require("../../util/global-scope");
|
|
12
11
|
var _env = require("../../constants/env.npm");
|
|
13
|
-
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); }
|
|
14
|
-
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; }
|
|
15
12
|
const model = {
|
|
16
13
|
buildEnv: _env.BUILD_ENV,
|
|
17
14
|
bytesSent: {},
|
|
@@ -33,7 +30,6 @@ const model = {
|
|
|
33
30
|
releaseIds: {},
|
|
34
31
|
session: undefined,
|
|
35
32
|
xhrWrappable: typeof _globalScope.globalScope.XMLHttpRequest?.prototype?.addEventListener === 'function',
|
|
36
|
-
userAgent,
|
|
37
33
|
version: _env.VERSION
|
|
38
34
|
};
|
|
39
35
|
const _cache = {};
|
|
@@ -44,6 +40,6 @@ function getRuntime(id) {
|
|
|
44
40
|
}
|
|
45
41
|
function setRuntime(id, obj) {
|
|
46
42
|
if (!id) throw new Error('All runtime objects require an agent identifier!');
|
|
47
|
-
_cache[id] =
|
|
43
|
+
_cache[id] = (0, _configurable.getModeledObject)(obj, model);
|
|
48
44
|
(0, _nreum.gosNREUMInitializedAgents)(id, _cache[id], 'runtime');
|
|
49
45
|
}
|
|
@@ -66,7 +66,7 @@ function drain() {
|
|
|
66
66
|
|
|
67
67
|
// Only when the event-groups for all features are ready to drain (staged) do we execute the drain. This has the effect
|
|
68
68
|
// that the last feature to call drain triggers drain for all features.
|
|
69
|
-
const items =
|
|
69
|
+
const items = [...registry[agentIdentifier]];
|
|
70
70
|
if (items.every(_ref => {
|
|
71
71
|
let [key, values] = _ref;
|
|
72
72
|
return values.staged;
|
|
@@ -69,23 +69,43 @@ class HarvestScheduler extends _sharedContext.SharedContext {
|
|
|
69
69
|
runHarvest(opts) {
|
|
70
70
|
if (this.aborted) return;
|
|
71
71
|
var scheduler = this;
|
|
72
|
+
let harvests = [];
|
|
73
|
+
let submitMethod;
|
|
72
74
|
if (this.opts.getPayload) {
|
|
73
|
-
// Ajax & PVT
|
|
74
|
-
|
|
75
|
+
// Ajax & PVT & SR
|
|
76
|
+
submitMethod = (0, _harvest.getSubmitMethod)(this.endpoint, opts);
|
|
75
77
|
if (!submitMethod) return false;
|
|
76
|
-
|
|
78
|
+
const retry = submitMethod.method === _submitData.submitData.xhr;
|
|
77
79
|
var payload = this.opts.getPayload({
|
|
78
80
|
retry: retry
|
|
79
81
|
});
|
|
80
|
-
if (payload)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
if (!payload) return;
|
|
83
|
+
payload = Object.prototype.toString.call(payload) === '[object Array]' ? payload : [payload];
|
|
84
|
+
harvests.push(...payload);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** sendX is used for features that do not supply a preformatted payload via "getPayload" */
|
|
88
|
+
let send = args => this.harvest.sendX(args);
|
|
89
|
+
if (harvests.length) {
|
|
90
|
+
/** _send is the underlying method for sending in the harvest, if sending raw we can bypass the other helpers completely which format the payloads */
|
|
91
|
+
if (this.opts.raw) send = args => this.harvest._send(args);
|
|
92
|
+
/** send is used to formated the payloads from "getPayload" and obfuscate before sending */else send = args => this.harvest.send(args);
|
|
86
93
|
} else {
|
|
87
|
-
|
|
94
|
+
// force it to run at least once in sendX mode
|
|
95
|
+
harvests.push(undefined);
|
|
88
96
|
}
|
|
97
|
+
harvests.forEach(payload => {
|
|
98
|
+
send({
|
|
99
|
+
endpoint: this.endpoint,
|
|
100
|
+
payload,
|
|
101
|
+
opts,
|
|
102
|
+
submitMethod,
|
|
103
|
+
cbFinished: onHarvestFinished,
|
|
104
|
+
includeBaseParams: this.opts.includeBaseParams,
|
|
105
|
+
customUrl: this.opts.customUrl,
|
|
106
|
+
gzip: this.opts.gzip
|
|
107
|
+
});
|
|
108
|
+
});
|
|
89
109
|
if (this.started) {
|
|
90
110
|
this.scheduleHarvest();
|
|
91
111
|
}
|
|
@@ -24,6 +24,23 @@ var _globalScope = require("../util/global-scope");
|
|
|
24
24
|
* SPDX-License-Identifier: Apache-2.0
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {object} NetworkSendSpec
|
|
29
|
+
* @param {string} endpoint The endpoint to use (jserrors, events, resources etc.)
|
|
30
|
+
* @param {object} payload Object representing payload.
|
|
31
|
+
* @param {object} payload.qs Map of values that should be sent as part of the request query string.
|
|
32
|
+
* @param {string} payload.body String that should be sent as the body of the request.
|
|
33
|
+
* @param {string} payload.body.e Special case of body used for browser interactions.
|
|
34
|
+
* @param {object} opts Additional options for sending data
|
|
35
|
+
* @param {boolean} opts.needResponse Specify whether the caller expects a response data.
|
|
36
|
+
* @param {boolean} opts.unload Specify whether the call is a final harvest during page unload.
|
|
37
|
+
* @param {boolean} opts.sendEmptyBody Specify whether the call should be made even if the body is empty. Useful for rum calls.
|
|
38
|
+
* @param {function} submitMethod The submit method to use {@link ../util/submit-data}
|
|
39
|
+
* @param {string} customUrl Override the beacon url the data is sent to; must include protocol if defined
|
|
40
|
+
* @param {boolean} gzip Enabled gzip compression on the body of the request before it is sent
|
|
41
|
+
* @param {boolean} includeBaseParams Enables the use of base query parameters in the beacon url {@see Harvest.baseQueryString}
|
|
42
|
+
*/
|
|
43
|
+
|
|
27
44
|
const haveSendBeacon = !!navigator.sendBeacon; // only the web window obj has sendBeacon at this time, so 'false' for other envs
|
|
28
45
|
|
|
29
46
|
class Harvest extends _sharedContext.SharedContext {
|
|
@@ -39,62 +56,78 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
39
56
|
/**
|
|
40
57
|
* Initiate a harvest from multiple sources. An event that corresponds to the endpoint
|
|
41
58
|
* name is emitted, which gives any listeners the opportunity to provide payload data.
|
|
42
|
-
*
|
|
43
|
-
* @param {string} endpoint - The endpoint of the harvest (jserrors, events, resources etc.)
|
|
44
|
-
*
|
|
45
|
-
* @param {object} opts
|
|
46
|
-
* @param {bool} opts.needResponse - Specify whether the caller expects a response data.
|
|
47
|
-
* @param {bool} opts.unload - Specify whether the call is a final harvest during page unload.
|
|
59
|
+
* @param {NetworkSendSpec} spec Specification for sending data
|
|
48
60
|
*/
|
|
49
|
-
sendX(
|
|
61
|
+
sendX(spec) {
|
|
62
|
+
const {
|
|
63
|
+
endpoint,
|
|
64
|
+
opts
|
|
65
|
+
} = spec;
|
|
50
66
|
var submitMethod = getSubmitMethod(endpoint, opts);
|
|
51
67
|
if (!submitMethod) return false;
|
|
52
68
|
var options = {
|
|
53
69
|
retry: submitMethod.method === _submitData.submitData.xhr
|
|
54
70
|
};
|
|
55
|
-
|
|
71
|
+
const payload = this.createPayload(endpoint, options);
|
|
72
|
+
var caller = this.obfuscator.shouldObfuscate() ? this.obfuscateAndSend.bind(this) : this._send.bind(this);
|
|
73
|
+
return caller({
|
|
74
|
+
...spec,
|
|
75
|
+
payload,
|
|
76
|
+
submitMethod
|
|
77
|
+
});
|
|
56
78
|
}
|
|
57
79
|
|
|
58
80
|
/**
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
* @param {string} singlePayload.body - String that should be sent as the body of the request.
|
|
67
|
-
* @param {string} singlePayload.body.e - Special case of body used for browser interactions.
|
|
68
|
-
*
|
|
69
|
-
* @param {object} opts
|
|
70
|
-
* @param {bool} opts.needResponse - Specify whether the caller expects a response data.
|
|
71
|
-
* @param {bool} opts.unload - Specify whether the call is a final harvest during page unload.
|
|
72
|
-
*/
|
|
73
|
-
send(endpoint, singlePayload, opts, submitMethod, cbFinished) {
|
|
74
|
-
var _this = this;
|
|
81
|
+
* Initiate a harvest call.
|
|
82
|
+
* @param {NetworkSendSpec} spec Specification for sending data
|
|
83
|
+
*/
|
|
84
|
+
send(spec) {
|
|
85
|
+
const {
|
|
86
|
+
payload = {}
|
|
87
|
+
} = spec;
|
|
75
88
|
var makeBody = createAccumulator();
|
|
76
89
|
var makeQueryString = createAccumulator();
|
|
77
|
-
if (
|
|
78
|
-
if (
|
|
79
|
-
var
|
|
90
|
+
if (payload.body) (0, _mapOwn.mapOwn)(payload.body, makeBody);
|
|
91
|
+
if (payload.qs) (0, _mapOwn.mapOwn)(payload.qs, makeQueryString);
|
|
92
|
+
var newPayload = {
|
|
80
93
|
body: makeBody(),
|
|
81
94
|
qs: makeQueryString()
|
|
82
95
|
};
|
|
83
|
-
var caller = this.obfuscator.shouldObfuscate() ?
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
return caller(endpoint, payload, opts, submitMethod, cbFinished);
|
|
96
|
+
var caller = this.obfuscator.shouldObfuscate() ? this.obfuscateAndSend.bind(this) : this._send.bind(this);
|
|
97
|
+
return caller({
|
|
98
|
+
...spec,
|
|
99
|
+
payload: newPayload
|
|
100
|
+
});
|
|
89
101
|
}
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Apply obfuscation rules to the payload and then initial the harvest network call.
|
|
105
|
+
* @param {NetworkSendSpec} spec Specification for sending data
|
|
106
|
+
*/
|
|
107
|
+
obfuscateAndSend(spec) {
|
|
108
|
+
var _this = this;
|
|
109
|
+
const {
|
|
110
|
+
payload = {}
|
|
111
|
+
} = spec;
|
|
92
112
|
(0, _traverse.applyFnToProps)(payload, function () {
|
|
93
|
-
return
|
|
113
|
+
return _this.obfuscator.obfuscateString(...arguments);
|
|
94
114
|
}, 'string', ['e']);
|
|
95
|
-
return this._send(
|
|
115
|
+
return this._send({
|
|
116
|
+
...spec,
|
|
117
|
+
payload
|
|
118
|
+
});
|
|
96
119
|
}
|
|
97
|
-
_send(
|
|
120
|
+
_send(_ref) {
|
|
121
|
+
let {
|
|
122
|
+
endpoint,
|
|
123
|
+
payload = {},
|
|
124
|
+
opts = {},
|
|
125
|
+
submitMethod,
|
|
126
|
+
cbFinished,
|
|
127
|
+
customUrl,
|
|
128
|
+
gzip,
|
|
129
|
+
includeBaseParams = true
|
|
130
|
+
} = _ref;
|
|
98
131
|
var info = (0, _config.getInfo)(this.sharedContext.agentIdentifier);
|
|
99
132
|
if (!info.errorBeacon) return false;
|
|
100
133
|
var agentRuntime = (0, _config.getRuntime)(this.sharedContext.agentIdentifier);
|
|
@@ -107,38 +140,67 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
107
140
|
}
|
|
108
141
|
return false;
|
|
109
142
|
}
|
|
110
|
-
|
|
111
|
-
var
|
|
112
|
-
|
|
143
|
+
var url = customUrl || this.getScheme() + '://' + info.errorBeacon + '/' + endpoint + '/1/' + info.licenseKey + '?';
|
|
144
|
+
var baseParams = includeBaseParams ? this.baseQueryString() : '';
|
|
145
|
+
var params = payload.qs ? (0, _encode.obj)(payload.qs, agentRuntime.maxBytes) : '';
|
|
113
146
|
if (!submitMethod) {
|
|
114
147
|
submitMethod = getSubmitMethod(endpoint, opts);
|
|
115
148
|
}
|
|
116
149
|
var method = submitMethod.method;
|
|
117
150
|
var useBody = submitMethod.useBody;
|
|
118
151
|
var body;
|
|
119
|
-
var fullUrl = url;
|
|
120
|
-
if (
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
152
|
+
var fullUrl = url + baseParams + params;
|
|
153
|
+
if (!gzip) {
|
|
154
|
+
if (useBody && endpoint === 'events') {
|
|
155
|
+
body = payload.body.e;
|
|
156
|
+
} else if (useBody) {
|
|
157
|
+
body = (0, _stringify.stringify)(payload.body);
|
|
158
|
+
} else {
|
|
159
|
+
fullUrl = fullUrl + (0, _encode.obj)(payload.body, agentRuntime.maxBytes);
|
|
160
|
+
}
|
|
161
|
+
} else body = payload.body;
|
|
127
162
|
|
|
128
163
|
// Get bytes harvested per endpoint as a supportability metric. See metrics aggregator (on unload).
|
|
129
164
|
agentRuntime.bytesSent[endpoint] = (agentRuntime.bytesSent[endpoint] || 0) + body?.length || 0;
|
|
130
165
|
// Get query bytes harvested per endpoint as a supportability metric. See metrics aggregator (on unload).
|
|
131
166
|
agentRuntime.queryBytesSent[endpoint] = (agentRuntime.queryBytesSent[endpoint] || 0) + fullUrl.split('?').slice(-1)[0]?.length || 0;
|
|
167
|
+
const headers = [];
|
|
168
|
+
if (gzip) {
|
|
169
|
+
headers.push({
|
|
170
|
+
key: 'content-type',
|
|
171
|
+
value: 'application/json'
|
|
172
|
+
});
|
|
173
|
+
headers.push({
|
|
174
|
+
key: 'X-Browser-Monitoring-Key',
|
|
175
|
+
value: info.licenseKey
|
|
176
|
+
});
|
|
177
|
+
headers.push({
|
|
178
|
+
key: 'Content-Encoding',
|
|
179
|
+
value: 'gzip'
|
|
180
|
+
});
|
|
181
|
+
} else {
|
|
182
|
+
headers.push({
|
|
183
|
+
key: 'content-type',
|
|
184
|
+
value: 'text/plain'
|
|
185
|
+
});
|
|
186
|
+
}
|
|
132
187
|
|
|
133
188
|
/* Since workers don't support sendBeacon right now, or Image(), they can only use XHR method.
|
|
134
189
|
Because they still do permit synch XHR, the idea is that at final harvest time (worker is closing),
|
|
135
190
|
we just make a BLOCKING request--trivial impact--with the remaining data as a temp fill-in for sendBeacon. */
|
|
136
|
-
|
|
191
|
+
|
|
192
|
+
var result = method({
|
|
193
|
+
url: fullUrl,
|
|
194
|
+
body,
|
|
195
|
+
sync: opts.unload && _globalScope.isWorkerScope,
|
|
196
|
+
headers
|
|
197
|
+
});
|
|
137
198
|
if (cbFinished && method === _submitData.submitData.xhr) {
|
|
138
199
|
var xhr = result;
|
|
139
200
|
xhr.addEventListener('load', function () {
|
|
140
201
|
var result = {
|
|
141
|
-
sent: true
|
|
202
|
+
sent: true,
|
|
203
|
+
status: this.status
|
|
142
204
|
};
|
|
143
205
|
if (this.status === 429) {
|
|
144
206
|
result.retry = true;
|
|
@@ -156,7 +218,9 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
156
218
|
// if beacon request failed, retry with an alternative method -- will not happen for workers
|
|
157
219
|
if (!result && method === _submitData.submitData.beacon) {
|
|
158
220
|
method = _submitData.submitData.img;
|
|
159
|
-
result = method(
|
|
221
|
+
result = method({
|
|
222
|
+
url: fullUrl + (0, _encode.obj)(payload.body, agentRuntime.maxBytes)
|
|
223
|
+
});
|
|
160
224
|
}
|
|
161
225
|
return result;
|
|
162
226
|
}
|
|
@@ -167,9 +231,9 @@ class Harvest extends _sharedContext.SharedContext {
|
|
|
167
231
|
var info = (0, _config.getInfo)(this.sharedContext.agentIdentifier);
|
|
168
232
|
var location = (0, _cleanUrl.cleanURL)((0, _location.getLocation)());
|
|
169
233
|
var ref = this.obfuscator.shouldObfuscate() ? this.obfuscator.obfuscateString(location) : location;
|
|
170
|
-
return ['
|
|
234
|
+
return ['a=' + info.applicationID, (0, _encode.param)('sa', info.sa ? '' + info.sa : ''), (0, _encode.param)('v', _env.VERSION), transactionNameParam(info), (0, _encode.param)('ct', runtime.customTransaction), '&rst=' + (0, _now.now)(), '&ck=0',
|
|
171
235
|
// ck param DEPRECATED - still expected by backend
|
|
172
|
-
'&s=' + (runtime.session?.value || '0'),
|
|
236
|
+
'&s=' + (runtime.session?.state.value || '0'),
|
|
173
237
|
// the 0 id encaps all untrackable and default traffic
|
|
174
238
|
(0, _encode.param)('ref', ref), (0, _encode.param)('ptid', runtime.ptid ? '' + runtime.ptid : '')].join('');
|
|
175
239
|
}
|
|
@@ -240,7 +304,7 @@ function createAccumulator() {
|
|
|
240
304
|
var accumulator = {};
|
|
241
305
|
var hasData = false;
|
|
242
306
|
return function (key, val) {
|
|
243
|
-
if (val && val.length) {
|
|
307
|
+
if (val !== null && val !== undefined && val.length) {
|
|
244
308
|
accumulator[key] = val;
|
|
245
309
|
hasData = true;
|
|
246
310
|
}
|