@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
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { ee } from '../event-emitter/contextual-ee';
|
|
10
|
-
|
|
10
|
+
import { bundleId } from '../ids/bundle-id';
|
|
11
|
+
export const flag = "nr@original:".concat(bundleId);
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* A convenience alias of `hasOwnProperty`.
|
|
@@ -100,25 +101,23 @@ export function createWrapperWithEmitter(emitter, always) {
|
|
|
100
101
|
|
|
101
102
|
/**
|
|
102
103
|
* Creates wrapper functions around each of an array of methods on a specified object.
|
|
103
|
-
* @param {Object} obj
|
|
104
|
-
* @param {string[]} methods
|
|
105
|
-
* @param {string} [prefix='']
|
|
106
|
-
*
|
|
107
|
-
* @param {function|object} [getContext]
|
|
108
|
-
*
|
|
109
|
-
* @param {boolean} [bubble=false]
|
|
110
|
-
*
|
|
104
|
+
* @param {Object} obj The object to which the specified methods belong.
|
|
105
|
+
* @param {string[]} methods An array of method names to be wrapped.
|
|
106
|
+
* @param {string} [prefix=''] A prefix to add to the names of emitted events. If `-` is the first character, also
|
|
107
|
+
* adds the method name before the prefix.
|
|
108
|
+
* @param {function|object} [getContext] The function or object that will serve as the 'this' context for handlers
|
|
109
|
+
* of events emitted by this wrapper.
|
|
110
|
+
* @param {boolean} [bubble=false] If `true`, emitted events should also bubble up to the old emitter upon which
|
|
111
|
+
* the `emitter` in the current scope was based (if it defines one).
|
|
111
112
|
*/
|
|
112
113
|
function inPlace(obj, methods, prefix, getContext, bubble) {
|
|
113
114
|
if (!prefix) prefix = '';
|
|
115
|
+
|
|
114
116
|
// If prefix starts with '-' set this boolean to add the method name to the prefix before passing each one to wrap.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
for (i = 0; i < methods.length; i++) {
|
|
120
|
-
method = methods[i];
|
|
121
|
-
fn = obj[method];
|
|
117
|
+
const prependMethodPrefix = prefix.charAt(0) === '-';
|
|
118
|
+
for (let i = 0; i < methods.length; i++) {
|
|
119
|
+
const method = methods[i];
|
|
120
|
+
const fn = obj[method];
|
|
122
121
|
|
|
123
122
|
// Unless fn is both wrappable and unwrapped, bail so we don't add extra properties with undefined values.
|
|
124
123
|
if (notWrappable(fn)) continue;
|
|
@@ -212,32 +211,4 @@ function copy(from, to, emitter) {
|
|
|
212
211
|
*/
|
|
213
212
|
function notWrappable(fn) {
|
|
214
213
|
return !(fn && fn instanceof Function && fn.apply && !fn[flag]);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Creates a wrapped version of a function using a specified wrapper function. The new wrapped function references the
|
|
219
|
-
* original function. Also copies the properties of the original function to the wrapped function.
|
|
220
|
-
* @param {function} fn - A function to be wrapped.
|
|
221
|
-
* @param {function} wrapper - A higher order function that returns a new function, which executes the function passed
|
|
222
|
-
* to the higher order function as an argument.
|
|
223
|
-
* @returns {function} A wrapped function with an internal reference to the original function.
|
|
224
|
-
*/
|
|
225
|
-
export function wrapFunction(fn, wrapper) {
|
|
226
|
-
var wrapped = wrapper(fn);
|
|
227
|
-
wrapped[flag] = fn;
|
|
228
|
-
copy(fn, wrapped, ee);
|
|
229
|
-
return wrapped;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Replaces a function with a wrapped version of itself. To preserve object references, rather than taking the function
|
|
234
|
-
* itself as an argument, takes the object on which the particular named function is a property.
|
|
235
|
-
* @param {Object} obj - The object on which the named function is a property.
|
|
236
|
-
* @param {string} fnName - The name of the function to be wrapped.
|
|
237
|
-
* @param {function} wrapper - A higher order function that returns a new function, which executes the function passed
|
|
238
|
-
* to the higher order function as an argument.
|
|
239
|
-
*/
|
|
240
|
-
export function wrapInPlace(obj, fnName, wrapper) {
|
|
241
|
-
var fn = obj[fnName];
|
|
242
|
-
obj[fnName] = wrapFunction(fn, wrapper);
|
|
243
214
|
}
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
11
11
|
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
12
|
-
import {
|
|
13
|
-
import { isBrowserScope } from '../constants/runtime';
|
|
12
|
+
import { globalScope, isBrowserScope } from '../constants/runtime';
|
|
14
13
|
const wrapped = {};
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -29,7 +28,7 @@ export function wrapMutation(sharedEE) {
|
|
|
29
28
|
wrapped[ee.debugId] = true; // otherwise, first feature to wrap mutations
|
|
30
29
|
|
|
31
30
|
var wrapFn = wfn(ee);
|
|
32
|
-
var OriginalObserver =
|
|
31
|
+
var OriginalObserver = globalScope.MutationObserver;
|
|
33
32
|
if (OriginalObserver) {
|
|
34
33
|
window.MutationObserver = function WrappedMutationObserver(cb) {
|
|
35
34
|
if (this instanceof OriginalObserver) {
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { createWrapperWithEmitter as wrapFn, flag } from './wrap-function';
|
|
11
|
-
import { ee as baseEE
|
|
12
|
-
import { originals } from '../config/config';
|
|
11
|
+
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
13
12
|
import { globalScope } from '../constants/runtime';
|
|
14
13
|
const wrapped = {};
|
|
15
14
|
|
|
@@ -28,9 +27,9 @@ export function wrapPromise(sharedEE) {
|
|
|
28
27
|
if (wrapped[promiseEE.debugId]) return promiseEE;
|
|
29
28
|
wrapped[promiseEE.debugId] = true; // otherwise, first feature to wrap promise
|
|
30
29
|
|
|
31
|
-
var getContext =
|
|
30
|
+
var getContext = promiseEE.context;
|
|
32
31
|
var promiseWrapper = wrapFn(promiseEE);
|
|
33
|
-
var prevPromiseObj =
|
|
32
|
+
var prevPromiseObj = globalScope.Promise;
|
|
34
33
|
if (prevPromiseObj) {
|
|
35
34
|
// ensure there's a Promise API (native or otherwise) to even wrap
|
|
36
35
|
wrap();
|
|
@@ -11,7 +11,6 @@ import { wrapEvents } from './wrap-events';
|
|
|
11
11
|
import { ee as contextualEE } from '../event-emitter/contextual-ee';
|
|
12
12
|
import { eventListenerOpts } from '../event-listener/event-listener-opts';
|
|
13
13
|
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
14
|
-
import { originals } from '../config/config';
|
|
15
14
|
import { globalScope } from '../constants/runtime';
|
|
16
15
|
import { warn } from '../util/console';
|
|
17
16
|
const wrapped = {};
|
|
@@ -35,32 +34,28 @@ export function wrapXhr(sharedEE) {
|
|
|
35
34
|
|
|
36
35
|
wrapEvents(baseEE); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us
|
|
37
36
|
var wrapFn = wfn(ee);
|
|
38
|
-
var OrigXHR =
|
|
39
|
-
var MutationObserver =
|
|
40
|
-
var Promise =
|
|
41
|
-
var setImmediate =
|
|
37
|
+
var OrigXHR = globalScope.XMLHttpRequest;
|
|
38
|
+
var MutationObserver = globalScope.MutationObserver;
|
|
39
|
+
var Promise = globalScope.Promise;
|
|
40
|
+
var setImmediate = globalScope.setInterval;
|
|
42
41
|
var READY_STATE_CHANGE = 'readystatechange';
|
|
43
42
|
var handlers = ['onload', 'onerror', 'onabort', 'onloadstart', 'onloadend', 'onprogress', 'ontimeout'];
|
|
44
43
|
var pendingXhrs = [];
|
|
45
|
-
var activeListeners = globalScope.XMLHttpRequest.listeners;
|
|
46
44
|
var XHR = globalScope.XMLHttpRequest = newXHR;
|
|
47
45
|
function newXHR(opts) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
const xhr = new OrigXHR(opts);
|
|
47
|
+
const context = ee.context(xhr);
|
|
48
|
+
try {
|
|
49
|
+
ee.emit('new-xhr', [xhr], context);
|
|
50
|
+
xhr.addEventListener(READY_STATE_CHANGE, wrapXHR(context), eventListenerOpts(false));
|
|
51
|
+
} catch (e) {
|
|
52
|
+
warn('An error occurred while intercepting XHR', e);
|
|
51
53
|
try {
|
|
52
|
-
ee.emit('
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
warn('An error occured while intercepting XHR', e);
|
|
56
|
-
try {
|
|
57
|
-
ee.emit('internal-error', [e]);
|
|
58
|
-
} catch (err) {
|
|
59
|
-
// do nothing
|
|
60
|
-
}
|
|
54
|
+
ee.emit('internal-error', [e]);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
// do nothing
|
|
61
57
|
}
|
|
62
58
|
}
|
|
63
|
-
this.listeners.forEach(listener => listener());
|
|
64
59
|
return xhr;
|
|
65
60
|
}
|
|
66
61
|
copy(OrigXHR, XHR);
|
|
@@ -74,14 +69,15 @@ export function wrapXhr(sharedEE) {
|
|
|
74
69
|
function wrapOnreadystatechange(args, xhr) {
|
|
75
70
|
wrapFn.inPlace(xhr, ['onreadystatechange'], 'fn-', getObject);
|
|
76
71
|
}
|
|
77
|
-
function wrapXHR() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
function wrapXHR(ctx) {
|
|
73
|
+
return function () {
|
|
74
|
+
var xhr = this;
|
|
75
|
+
if (xhr.readyState > 3 && !ctx.resolved) {
|
|
76
|
+
ctx.resolved = true;
|
|
77
|
+
ee.emit('xhr-resolved', [], xhr);
|
|
78
|
+
}
|
|
79
|
+
wrapFn.inPlace(xhr, handlers, 'fn-', getObject);
|
|
80
|
+
};
|
|
85
81
|
}
|
|
86
82
|
|
|
87
83
|
// Wrapping the onreadystatechange property of XHRs takes some special tricks.
|
|
@@ -10,7 +10,6 @@ import { getConfiguration, getInfo, getRuntime } from '../../../common/config/co
|
|
|
10
10
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
11
11
|
import { setDenyList, shouldCollectEvent } from '../../../common/deny-list/deny-list';
|
|
12
12
|
import { FEATURE_NAME } from '../constants';
|
|
13
|
-
import { drain } from '../../../common/drain/drain';
|
|
14
13
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
15
14
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
|
|
16
15
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
@@ -22,7 +21,7 @@ export class Aggregate extends AggregateBase {
|
|
|
22
21
|
const allAjaxIsEnabled = agentInit.ajax.enabled !== false;
|
|
23
22
|
register('xhr', storeXhr, this.featureName, this.ee);
|
|
24
23
|
if (!allAjaxIsEnabled) {
|
|
25
|
-
drain(
|
|
24
|
+
this.drain();
|
|
26
25
|
return; // feature will only collect timeslice metrics & ajax trace nodes if it's not fully enabled
|
|
27
26
|
}
|
|
28
27
|
|
|
@@ -64,8 +63,7 @@ export class Aggregate extends AggregateBase {
|
|
|
64
63
|
ee.on("drain-".concat(this.featureName), () => {
|
|
65
64
|
scheduler.startTimer(harvestTimeSeconds);
|
|
66
65
|
});
|
|
67
|
-
drain(
|
|
68
|
-
return;
|
|
66
|
+
this.drain();
|
|
69
67
|
function storeXhr(params, metrics, startTime, endTime, type) {
|
|
70
68
|
metrics.time = startTime;
|
|
71
69
|
|
|
@@ -97,9 +95,9 @@ export class Aggregate extends AggregateBase {
|
|
|
97
95
|
path: params.pathname,
|
|
98
96
|
requestSize: metrics.txSize,
|
|
99
97
|
responseSize: metrics.rxSize,
|
|
100
|
-
type
|
|
101
|
-
startTime
|
|
102
|
-
endTime
|
|
98
|
+
type,
|
|
99
|
+
startTime,
|
|
100
|
+
endTime,
|
|
103
101
|
callbackDuration: metrics.cbTime
|
|
104
102
|
};
|
|
105
103
|
if (xhrContext.dt) {
|
|
@@ -10,22 +10,18 @@ import { stringify } from '../../../common/util/stringify';
|
|
|
10
10
|
export class DT {
|
|
11
11
|
constructor(agentIdentifier) {
|
|
12
12
|
this.agentIdentifier = agentIdentifier;
|
|
13
|
-
// Binds this class instance context to the following fn used in an external module (exported);
|
|
14
|
-
// Alternatively, can make them class field arrow functions, but requires experimental features/plugin for eslint.
|
|
15
|
-
this.generateTracePayload = this.generateTracePayload.bind(this);
|
|
16
|
-
this.shouldGenerateTrace = this.shouldGenerateTrace.bind(this);
|
|
17
13
|
}
|
|
18
14
|
generateTracePayload(parsedOrigin) {
|
|
19
15
|
if (!this.shouldGenerateTrace(parsedOrigin)) {
|
|
20
16
|
return null;
|
|
21
17
|
}
|
|
22
|
-
var
|
|
23
|
-
if (!
|
|
18
|
+
var loaderConfig = getLoaderConfig(this.agentIdentifier);
|
|
19
|
+
if (!loaderConfig) {
|
|
24
20
|
return null;
|
|
25
21
|
}
|
|
26
|
-
var accountId = (
|
|
27
|
-
var agentId = (
|
|
28
|
-
var trustKey = (
|
|
22
|
+
var accountId = (loaderConfig.accountID || '').toString() || null;
|
|
23
|
+
var agentId = (loaderConfig.agentID || '').toString() || null;
|
|
24
|
+
var trustKey = (loaderConfig.trustKey || '').toString() || null;
|
|
29
25
|
if (!accountId || !agentId) {
|
|
30
26
|
return null;
|
|
31
27
|
}
|
|
@@ -33,9 +29,9 @@ export class DT {
|
|
|
33
29
|
var traceId = generateTraceId();
|
|
34
30
|
var timestamp = Date.now();
|
|
35
31
|
var payload = {
|
|
36
|
-
spanId
|
|
37
|
-
traceId
|
|
38
|
-
timestamp
|
|
32
|
+
spanId,
|
|
33
|
+
traceId,
|
|
34
|
+
timestamp
|
|
39
35
|
};
|
|
40
36
|
if (parsedOrigin.sameOrigin || this.isAllowedOrigin(parsedOrigin) && this.useTraceContextHeadersForCors()) {
|
|
41
37
|
payload.traceContextParentHeader = this.generateTraceContextParentHeader(spanId, traceId);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { originals, getLoaderConfig, getRuntime } from '../../../common/config/config';
|
|
6
6
|
import { handle } from '../../../common/event-emitter/handle';
|
|
7
7
|
import { id } from '../../../common/ids/id';
|
|
8
|
-
import { ffVersion, globalScope } from '../../../common/constants/runtime';
|
|
8
|
+
import { ffVersion, globalScope, isBrowserScope } from '../../../common/constants/runtime';
|
|
9
9
|
import { dataSize } from '../../../common/util/data-size';
|
|
10
10
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
|
|
11
11
|
import { now } from '../../../common/timing/now';
|
|
@@ -19,7 +19,7 @@ import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
|
19
19
|
var handlers = ['load', 'error', 'abort', 'timeout'];
|
|
20
20
|
var handlersLen = handlers.length;
|
|
21
21
|
var origRequest = originals.REQ;
|
|
22
|
-
var origXHR =
|
|
22
|
+
var origXHR = originals.XHR;
|
|
23
23
|
export class Instrument extends InstrumentBase {
|
|
24
24
|
static featureName = FEATURE_NAME;
|
|
25
25
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -30,6 +30,38 @@ export class Instrument extends InstrumentBase {
|
|
|
30
30
|
if (!getRuntime(agentIdentifier).xhrWrappable) return;
|
|
31
31
|
this.dt = new DT(agentIdentifier);
|
|
32
32
|
this.handler = (type, args, ctx, group) => handle(type, args, ctx, group, this.ee);
|
|
33
|
+
|
|
34
|
+
// this is a best (but imperfect) effort at capturing AJAX calls that may have fired before the agent was instantiated
|
|
35
|
+
// this could happen because the agent was "improperly" set up (ie, not at the top of the head) or
|
|
36
|
+
// because it was deferred from loading in some way -- e.g. 'deferred' script loading tags or other lazy-loading techniques
|
|
37
|
+
//
|
|
38
|
+
// it is "imperfect" because we cannot capture the following with the API vs wrapping the events directly:
|
|
39
|
+
// * requestBodySize - (txSize -- request body size)
|
|
40
|
+
// * method - request type (GET, POST, etc)
|
|
41
|
+
// * callbackDuration - (cbTime -- sum of resulting callback time)
|
|
42
|
+
try {
|
|
43
|
+
const initiators = {
|
|
44
|
+
xmlhttprequest: 'xhr',
|
|
45
|
+
fetch: 'fetch',
|
|
46
|
+
beacon: 'beacon'
|
|
47
|
+
};
|
|
48
|
+
globalScope?.performance?.getEntriesByType('resource').forEach(resource => {
|
|
49
|
+
if (resource.initiatorType in initiators && resource.responseStatus !== 0) {
|
|
50
|
+
const params = {
|
|
51
|
+
status: resource.responseStatus
|
|
52
|
+
};
|
|
53
|
+
const metrics = {
|
|
54
|
+
rxSize: resource.transferSize,
|
|
55
|
+
duration: Math.floor(resource.duration),
|
|
56
|
+
cbTime: 0
|
|
57
|
+
};
|
|
58
|
+
addUrl(params, resource.name);
|
|
59
|
+
this.handler('xhr', [params, metrics, resource.startTime, resource.responseEnd, initiators[resource.initiatorType]], undefined, FEATURE_NAMES.ajax);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} catch (err) {
|
|
63
|
+
// do nothing
|
|
64
|
+
}
|
|
33
65
|
wrapFetch(this.ee);
|
|
34
66
|
wrapXhr(this.ee);
|
|
35
67
|
subscribeToEvents(agentIdentifier, this.ee, this.handler, this.dt);
|
|
@@ -89,9 +121,9 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
89
121
|
this.metrics = {};
|
|
90
122
|
}
|
|
91
123
|
function onOpenXhrEnd(args, xhr) {
|
|
92
|
-
var
|
|
93
|
-
if (
|
|
94
|
-
xhr.setRequestHeader('X-NewRelic-ID',
|
|
124
|
+
var loaderConfig = getLoaderConfig(agentIdentifier);
|
|
125
|
+
if (loaderConfig.xpid && this.sameOrigin) {
|
|
126
|
+
xhr.setRequestHeader('X-NewRelic-ID', loaderConfig.xpid);
|
|
95
127
|
}
|
|
96
128
|
var payload = dt.generateTracePayload(this.parsedOrigin);
|
|
97
129
|
if (payload) {
|
|
@@ -185,15 +217,25 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
185
217
|
function onFetchBeforeStart(args) {
|
|
186
218
|
var opts = args[1] || {};
|
|
187
219
|
var url;
|
|
188
|
-
// argument is USVString
|
|
189
220
|
if (typeof args[0] === 'string') {
|
|
221
|
+
// argument is USVString
|
|
190
222
|
url = args[0];
|
|
191
|
-
|
|
223
|
+
if (url.length === 0 && isBrowserScope) {
|
|
224
|
+
url = '' + globalScope.location.href;
|
|
225
|
+
}
|
|
192
226
|
} else if (args[0] && args[0].url) {
|
|
227
|
+
// argument is Request object
|
|
193
228
|
url = args[0].url;
|
|
194
|
-
// argument is URL object
|
|
195
229
|
} else if (globalScope?.URL && args[0] && args[0] instanceof URL) {
|
|
230
|
+
// argument is URL object
|
|
196
231
|
url = args[0].href;
|
|
232
|
+
} else if (typeof args[0].toString === 'function') {
|
|
233
|
+
url = args[0].toString();
|
|
234
|
+
}
|
|
235
|
+
if (typeof url !== 'string' || url.length === 0) {
|
|
236
|
+
// Short-circuit DT since we could not determine the URL of the fetch call
|
|
237
|
+
// this is very unlikely to happen
|
|
238
|
+
return;
|
|
197
239
|
}
|
|
198
240
|
if (url) {
|
|
199
241
|
this.parsedOrigin = parseUrl(url);
|
|
@@ -203,7 +245,11 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
203
245
|
if (!payload || !payload.newrelicHeader && !payload.traceContextParentHeader) {
|
|
204
246
|
return;
|
|
205
247
|
}
|
|
206
|
-
if (
|
|
248
|
+
if (args[0] && args[0].headers) {
|
|
249
|
+
if (addHeaders(args[0].headers, payload)) {
|
|
250
|
+
this.dt = payload;
|
|
251
|
+
}
|
|
252
|
+
} else {
|
|
207
253
|
var clone = {};
|
|
208
254
|
for (var key in opts) {
|
|
209
255
|
clone[key] = opts[key];
|
|
@@ -217,10 +263,6 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
217
263
|
} else {
|
|
218
264
|
args.push(clone);
|
|
219
265
|
}
|
|
220
|
-
} else if (args[0] && args[0].headers) {
|
|
221
|
-
if (addHeaders(args[0].headers, payload)) {
|
|
222
|
-
this.dt = payload;
|
|
223
|
-
}
|
|
224
266
|
}
|
|
225
267
|
function addHeaders(headersObj, payload) {
|
|
226
268
|
var added = false;
|
|
@@ -263,7 +305,7 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
263
305
|
|
|
264
306
|
// we capture failed call as status 0, the actual error is ignored
|
|
265
307
|
// eslint-disable-next-line handle-callback-err
|
|
266
|
-
function onFetchDone(
|
|
308
|
+
function onFetchDone(_, res) {
|
|
267
309
|
this.endTime = now();
|
|
268
310
|
if (!this.params) {
|
|
269
311
|
this.params = {};
|
|
@@ -304,17 +346,6 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
304
346
|
metrics.cbTime = this.cbTime;
|
|
305
347
|
handler('xhr', [params, metrics, this.startTime, this.endTime, 'xhr'], this, FEATURE_NAMES.ajax);
|
|
306
348
|
}
|
|
307
|
-
function addUrl(ctx, url) {
|
|
308
|
-
var parsed = parseUrl(url);
|
|
309
|
-
var params = ctx.params;
|
|
310
|
-
params.hostname = parsed.hostname;
|
|
311
|
-
params.port = parsed.port;
|
|
312
|
-
params.protocol = parsed.protocol;
|
|
313
|
-
params.host = parsed.hostname + ':' + parsed.port;
|
|
314
|
-
params.pathname = parsed.pathname;
|
|
315
|
-
ctx.parsedOrigin = parsed;
|
|
316
|
-
ctx.sameOrigin = parsed.sameOrigin;
|
|
317
|
-
}
|
|
318
349
|
function captureXhrData(ctx, xhr) {
|
|
319
350
|
ctx.params.status = xhr.status;
|
|
320
351
|
var size = responseSizeFromXhr(xhr, ctx.lastSize);
|
|
@@ -327,4 +358,15 @@ function subscribeToEvents(agentIdentifier, ee, handler, dt) {
|
|
|
327
358
|
}
|
|
328
359
|
ctx.loadCaptureCalled = true;
|
|
329
360
|
}
|
|
361
|
+
}
|
|
362
|
+
function addUrl(ctx, url) {
|
|
363
|
+
var parsed = parseUrl(url);
|
|
364
|
+
var params = ctx.params || ctx;
|
|
365
|
+
params.hostname = parsed.hostname;
|
|
366
|
+
params.port = parsed.port;
|
|
367
|
+
params.protocol = parsed.protocol;
|
|
368
|
+
params.host = parsed.hostname + ':' + parsed.port;
|
|
369
|
+
params.pathname = parsed.pathname;
|
|
370
|
+
ctx.parsedOrigin = parsed;
|
|
371
|
+
ctx.sameOrigin = parsed.sameOrigin;
|
|
330
372
|
}
|
|
@@ -62,8 +62,8 @@ var debug = false;
|
|
|
62
62
|
var classNameRegex = /function (.+?)\s*\(/;
|
|
63
63
|
var chrome = /^\s*at (?:((?:\[object object\])?(?:[^(]*\([^)]*\))*[^()]*(?: \[as \S+\])?) )?\(?((?:file|http|https|chrome-extension):.*?)?:(\d+)(?::(\d+))?\)?\s*$/i;
|
|
64
64
|
var gecko = /^\s*(?:(\S*|global code)(?:\(.*?\))?@)?((?:file|http|https|chrome|safari-extension).*?):(\d+)(?::(\d+))?\s*$/i;
|
|
65
|
-
var
|
|
66
|
-
var
|
|
65
|
+
var chromeEval = /^\s*at .+ \(eval at \S+ \((?:(?:file|http|https):[^)]+)?\)(?:, [^:]*:\d+:\d+)?\)$/i;
|
|
66
|
+
var ieEval = /^\s*at Function code \(Function code:\d+:\d+\)\s*/i;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Represents an error with a stack trace.
|
|
@@ -197,7 +197,7 @@ function getStackElement(line) {
|
|
|
197
197
|
column: parts[4] ? +parts[4] : null
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
if (line.match(
|
|
200
|
+
if (line.match(chromeEval) || line.match(ieEval) || line === 'anonymous') {
|
|
201
201
|
return {
|
|
202
202
|
func: 'evaluated code'
|
|
203
203
|
};
|
|
@@ -242,7 +242,7 @@ function computeStackTraceBySourceAndLine(ex) {
|
|
|
242
242
|
mode: 'sourceline',
|
|
243
243
|
name: className,
|
|
244
244
|
message: ex.message,
|
|
245
|
-
stackString
|
|
245
|
+
stackString,
|
|
246
246
|
frames: [{
|
|
247
247
|
url: canonicalUrl,
|
|
248
248
|
line: ex.line,
|
|
@@ -16,7 +16,6 @@ import { getInfo, getConfigurationValue, getRuntime } from '../../../common/conf
|
|
|
16
16
|
import { now } from '../../../common/timing/now';
|
|
17
17
|
import { globalScope } from '../../../common/constants/runtime';
|
|
18
18
|
import { FEATURE_NAME } from '../constants';
|
|
19
|
-
import { drain } from '../../../common/drain/drain';
|
|
20
19
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
21
20
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
22
21
|
|
|
@@ -34,7 +33,7 @@ export class Aggregate extends AggregateBase {
|
|
|
34
33
|
this.observedAt = {};
|
|
35
34
|
this.pageviewReported = {};
|
|
36
35
|
this.errorCache = {};
|
|
37
|
-
this.currentBody;
|
|
36
|
+
this.currentBody = undefined;
|
|
38
37
|
this.errorOnPage = false;
|
|
39
38
|
|
|
40
39
|
// this will need to change to match whatever ee we use in the instrument
|
|
@@ -68,7 +67,7 @@ export class Aggregate extends AggregateBase {
|
|
|
68
67
|
this.blocked = true;
|
|
69
68
|
scheduler.stopTimer(true);
|
|
70
69
|
}, this.featureName, this.ee);
|
|
71
|
-
drain(
|
|
70
|
+
this.drain();
|
|
72
71
|
}
|
|
73
72
|
onHarvestStarted(options) {
|
|
74
73
|
// this gets rid of dependency in AJAX module
|
|
@@ -77,7 +76,7 @@ export class Aggregate extends AggregateBase {
|
|
|
77
76
|
this.currentBody = body;
|
|
78
77
|
}
|
|
79
78
|
var payload = {
|
|
80
|
-
body
|
|
79
|
+
body,
|
|
81
80
|
qs: {}
|
|
82
81
|
};
|
|
83
82
|
var releaseIds = stringify(getRuntime(this.agentIdentifier).releaseIds);
|
|
@@ -187,7 +186,7 @@ export class Aggregate extends AggregateBase {
|
|
|
187
186
|
params.firstOccurrenceTimestamp = this.observedAt[bucketHash];
|
|
188
187
|
var type = internal ? 'ierr' : 'err';
|
|
189
188
|
var newMetrics = {
|
|
190
|
-
time
|
|
189
|
+
time
|
|
191
190
|
};
|
|
192
191
|
|
|
193
192
|
// sr, stn and spa aggregators listen to this event - stn sends the error in its payload,
|