@newrelic/browser-agent 0.1.229 → 0.1.231
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/README.md +65 -2
- package/dist/cjs/common/browser-version/ios-version.js +4 -3
- package/dist/cjs/common/config/state/configurable.js +3 -2
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +1 -1
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +6 -5
- package/dist/cjs/common/constants/env.cdn.js +29 -0
- package/dist/cjs/common/constants/env.js +32 -0
- package/dist/cjs/common/constants/env.npm.js +30 -0
- package/dist/cjs/common/context/shared-context.js +2 -1
- package/dist/cjs/common/drain/drain.js +9 -3
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +282 -0
- package/dist/cjs/common/event-emitter/handle.test.js +58 -0
- package/dist/cjs/common/event-emitter/register-handler.test.js +55 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -1
- package/dist/cjs/common/harvest/harvest.js +15 -4
- package/dist/cjs/common/ids/id.js +14 -6
- package/dist/cjs/common/ids/id.test.js +85 -0
- package/dist/cjs/common/ids/unique-id.js +75 -51
- package/dist/cjs/common/ids/unique-id.test.js +49 -0
- package/dist/cjs/common/timing/nav-timing.js +51 -30
- package/dist/cjs/common/timing/nav-timing.test.js +192 -0
- package/dist/cjs/common/url/clean-url.test.js +9 -0
- package/dist/cjs/common/url/encode.test.js +74 -0
- package/dist/cjs/common/url/location.js +4 -0
- package/dist/cjs/common/url/location.test.js +13 -0
- package/dist/cjs/common/url/parse-url.test.js +111 -0
- package/dist/cjs/common/url/protocol.js +2 -12
- package/dist/cjs/common/url/protocol.test.js +16 -0
- package/dist/cjs/common/util/console.js +2 -2
- package/dist/cjs/common/util/map-own.js +21 -14
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +1 -1
- package/dist/cjs/common/util/submit-data.js +11 -3
- package/dist/cjs/common/window/page-visibility.js +4 -2
- package/dist/cjs/common/window/session-storage.js +56 -11
- package/dist/cjs/common/wrap/index.js +4 -4
- package/dist/cjs/common/wrap/wrap-events.js +10 -10
- package/dist/cjs/common/wrap/wrap-fetch.js +6 -8
- package/dist/cjs/common/wrap/wrap-function.js +4 -18
- package/dist/cjs/common/wrap/wrap-history.js +7 -6
- package/dist/cjs/common/wrap/wrap-jsonp.js +7 -6
- package/dist/cjs/common/wrap/wrap-mutation.js +7 -6
- package/dist/cjs/common/wrap/wrap-promise.js +11 -7
- package/dist/cjs/common/wrap/wrap-promise.test.js +119 -0
- package/dist/cjs/common/wrap/wrap-raf.js +6 -6
- package/dist/cjs/common/wrap/wrap-timer.js +6 -6
- package/dist/cjs/common/wrap/wrap-xhr.js +5 -6
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +2 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/cjs/features/jserrors/aggregate/index.js +35 -14
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/cjs/features/jserrors/instrument/index.js +9 -12
- package/dist/cjs/features/metrics/aggregate/index.js +16 -6
- package/dist/cjs/features/metrics/instrument/index.js +2 -1
- package/dist/cjs/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/cjs/features/page_action/aggregate/index.js +12 -4
- package/dist/cjs/features/page_action/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +25 -10
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +69 -26
- package/dist/cjs/features/session_trace/instrument/index.js +2 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -1
- package/dist/cjs/features/utils/instrument-base.js +8 -3
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/loaders/agent.js +3 -2
- package/dist/cjs/loaders/api/api.js +90 -22
- package/dist/cjs/loaders/api/apiAsync.js +3 -3
- package/dist/cjs/loaders/configure/configure.js +13 -7
- package/dist/cjs/loaders/features/enabled-features.js +1 -1
- package/dist/cjs/loaders/micro-agent.js +20 -14
- package/dist/esm/common/browser-version/ios-version.js +4 -3
- package/dist/esm/common/config/state/configurable.js +3 -2
- package/dist/esm/common/config/state/info.js +1 -1
- package/dist/esm/common/config/state/init.js +1 -1
- package/dist/esm/common/config/state/loader-config.js +1 -1
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +20 -0
- package/dist/esm/common/constants/env.js +23 -0
- package/dist/esm/common/constants/env.npm.js +21 -0
- package/dist/esm/common/context/shared-context.js +2 -1
- package/dist/esm/common/drain/drain.js +9 -3
- package/dist/esm/common/event-emitter/contextual-ee.test.js +278 -0
- package/dist/esm/common/event-emitter/handle.test.js +54 -0
- package/dist/esm/common/event-emitter/register-handler.test.js +51 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -1
- package/dist/esm/common/harvest/harvest.js +14 -3
- package/dist/esm/common/ids/id.js +16 -6
- package/dist/esm/common/ids/id.test.js +81 -0
- package/dist/esm/common/ids/unique-id.js +75 -51
- package/dist/esm/common/ids/unique-id.test.js +44 -0
- package/dist/esm/common/timing/nav-timing.js +51 -29
- package/dist/esm/common/timing/nav-timing.test.js +190 -0
- package/dist/esm/common/url/clean-url.test.js +7 -0
- package/dist/esm/common/url/encode.test.js +70 -0
- package/dist/esm/common/url/location.js +4 -0
- package/dist/esm/common/url/location.test.js +11 -0
- package/dist/esm/common/url/parse-url.test.js +107 -0
- package/dist/esm/common/url/protocol.js +3 -12
- package/dist/esm/common/url/protocol.test.js +14 -0
- package/dist/esm/common/util/console.js +2 -2
- package/dist/esm/common/util/map-own.js +19 -13
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +2 -2
- package/dist/esm/common/util/submit-data.js +11 -3
- package/dist/esm/common/window/page-visibility.js +4 -2
- package/dist/esm/common/window/session-storage.js +54 -13
- package/dist/esm/common/wrap/index.js +3 -3
- package/dist/esm/common/wrap/wrap-events.js +11 -11
- package/dist/esm/common/wrap/wrap-fetch.js +7 -9
- package/dist/esm/common/wrap/wrap-function.js +4 -17
- package/dist/esm/common/wrap/wrap-history.js +8 -7
- package/dist/esm/common/wrap/wrap-jsonp.js +8 -7
- package/dist/esm/common/wrap/wrap-mutation.js +7 -6
- package/dist/esm/common/wrap/wrap-promise.js +11 -7
- package/dist/esm/common/wrap/wrap-promise.test.js +115 -0
- package/dist/esm/common/wrap/wrap-raf.js +7 -7
- package/dist/esm/common/wrap/wrap-timer.js +7 -7
- package/dist/esm/common/wrap/wrap-xhr.js +7 -8
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +2 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/esm/features/jserrors/aggregate/index.js +35 -14
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/esm/features/jserrors/instrument/index.js +9 -12
- package/dist/esm/features/metrics/aggregate/index.js +17 -7
- package/dist/esm/features/metrics/instrument/index.js +2 -1
- package/dist/esm/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/esm/features/page_action/aggregate/index.js +12 -4
- package/dist/esm/features/page_action/instrument/index.js +2 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +25 -10
- package/dist/esm/features/page_view_event/instrument/index.js +2 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/esm/features/page_view_timing/instrument/index.js +2 -1
- package/dist/esm/features/session_trace/aggregate/index.js +69 -26
- package/dist/esm/features/session_trace/instrument/index.js +2 -1
- package/dist/esm/features/spa/instrument/index.js +2 -1
- package/dist/esm/features/utils/instrument-base.js +3 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/loaders/agent.js +3 -2
- package/dist/esm/loaders/api/api.js +85 -21
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/configure/configure.js +14 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +18 -13
- package/dist/types/cdn/lite.d.ts +2 -0
- package/dist/types/cdn/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/lite.d.ts +2 -0
- package/dist/types/cdn/polyfills/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/pro.d.ts +2 -0
- package/dist/types/cdn/polyfills/pro.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/spa.d.ts +2 -0
- package/dist/types/cdn/polyfills/spa.d.ts.map +1 -0
- package/dist/types/cdn/polyfills.d.ts +2 -0
- package/dist/types/cdn/polyfills.d.ts.map +1 -0
- package/dist/types/cdn/pro.d.ts +2 -0
- package/dist/types/cdn/pro.d.ts.map +1 -0
- package/dist/types/cdn/spa.d.ts +2 -0
- package/dist/types/cdn/spa.d.ts.map +1 -0
- package/dist/types/cdn/worker.d.ts +2 -0
- package/dist/types/cdn/worker.d.ts.map +1 -0
- package/dist/types/common/aggregate/aggregator.d.ts +11 -0
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -0
- package/dist/types/common/browser-version/firefox-version.d.ts +2 -0
- package/dist/types/common/browser-version/firefox-version.d.ts.map +1 -0
- package/dist/types/common/browser-version/ios-version.d.ts +3 -0
- package/dist/types/common/browser-version/ios-version.d.ts.map +1 -0
- package/dist/types/common/config/config.d.ts +13 -0
- package/dist/types/common/config/config.d.ts.map +1 -0
- package/dist/types/common/config/state/configurable.d.ts +4 -0
- package/dist/types/common/config/state/configurable.d.ts.map +1 -0
- package/dist/types/common/config/state/info.d.ts +4 -0
- package/dist/types/common/config/state/info.d.ts.map +1 -0
- package/dist/types/common/config/state/init.d.ts +4 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -0
- package/dist/types/common/config/state/loader-config.d.ts +3 -0
- package/dist/types/common/config/state/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/state/originals.d.ts +2 -0
- package/dist/types/common/config/state/originals.d.ts.map +1 -0
- package/dist/types/common/config/state/runtime.d.ts +3 -0
- package/dist/types/common/config/state/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/env.cdn.d.ts +18 -0
- package/dist/types/common/constants/env.cdn.d.ts.map +1 -0
- package/dist/types/common/constants/env.d.ts +13 -0
- package/dist/types/common/constants/env.d.ts.map +1 -0
- package/dist/types/common/constants/env.npm.d.ts +19 -0
- package/dist/types/common/constants/env.npm.d.ts.map +1 -0
- package/dist/types/common/context/shared-context.d.ts +5 -0
- package/dist/types/common/context/shared-context.d.ts.map +1 -0
- package/dist/types/common/deny-list/deny-list.d.ts +12 -0
- package/dist/types/common/deny-list/deny-list.d.ts.map +1 -0
- package/dist/types/common/drain/drain.d.ts +17 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts +4 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -0
- package/dist/types/common/event-emitter/handle.d.ts +3 -0
- package/dist/types/common/event-emitter/handle.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +8 -0
- package/dist/types/common/event-emitter/register-handler.d.ts.map +1 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts +10 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts +21 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest.d.ts +58 -0
- package/dist/types/common/harvest/harvest.d.ts.map +1 -0
- package/dist/types/common/ids/id.d.ts +12 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +28 -0
- package/dist/types/common/ids/unique-id.d.ts.map +1 -0
- package/dist/types/common/metrics/framework-detection.d.ts +2 -0
- package/dist/types/common/metrics/framework-detection.d.ts.map +1 -0
- package/dist/types/common/metrics/paint-metrics.d.ts +2 -0
- package/dist/types/common/metrics/paint-metrics.d.ts.map +1 -0
- package/dist/types/common/serialize/bel-serializer.d.ts +5 -0
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -0
- package/dist/types/common/timing/nav-timing.d.ts +4 -0
- package/dist/types/common/timing/nav-timing.d.ts.map +1 -0
- package/dist/types/common/timing/now.d.ts +2 -0
- package/dist/types/common/timing/now.d.ts.map +1 -0
- package/dist/types/common/unload/eol.d.ts +8 -0
- package/dist/types/common/unload/eol.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +2 -0
- package/dist/types/common/url/clean-url.d.ts.map +1 -0
- package/dist/types/common/url/encode.d.ts +5 -0
- package/dist/types/common/url/encode.d.ts.map +1 -0
- package/dist/types/common/url/location.d.ts +6 -0
- package/dist/types/common/url/location.d.ts.map +1 -0
- package/dist/types/common/url/parse-url.d.ts +2 -0
- package/dist/types/common/url/parse-url.d.ts.map +1 -0
- package/dist/types/common/url/protocol.d.ts +2 -0
- package/dist/types/common/url/protocol.d.ts.map +1 -0
- package/dist/types/common/util/console.d.ts +8 -0
- package/dist/types/common/util/console.d.ts.map +1 -0
- package/dist/types/common/util/data-size.d.ts +2 -0
- package/dist/types/common/util/data-size.d.ts.map +1 -0
- package/dist/types/common/util/feature-flags.d.ts +3 -0
- package/dist/types/common/util/feature-flags.d.ts.map +1 -0
- package/dist/types/common/util/get-or-set.d.ts +2 -0
- package/dist/types/common/util/get-or-set.d.ts.map +1 -0
- package/dist/types/common/util/global-scope.d.ts +13 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -0
- package/dist/types/common/util/map-own.d.ts +3 -0
- package/dist/types/common/util/map-own.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts +8 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -0
- package/dist/types/common/util/s-hash.d.ts +2 -0
- package/dist/types/common/util/s-hash.d.ts.map +1 -0
- package/dist/types/common/util/single.d.ts +2 -0
- package/dist/types/common/util/single.d.ts.map +1 -0
- package/dist/types/common/util/stringify.d.ts +8 -0
- package/dist/types/common/util/stringify.d.ts.map +1 -0
- package/dist/types/common/util/submit-data.d.ts +35 -0
- package/dist/types/common/util/submit-data.d.ts.map +1 -0
- package/dist/types/common/util/traverse.d.ts +2 -0
- package/dist/types/common/util/traverse.d.ts.map +1 -0
- package/dist/types/common/util/user-agent.d.ts +5 -0
- package/dist/types/common/util/user-agent.d.ts.map +1 -0
- package/dist/types/common/window/load.d.ts +3 -0
- package/dist/types/common/window/load.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts +14 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -0
- package/dist/types/common/window/page-visibility.d.ts +7 -0
- package/dist/types/common/window/page-visibility.d.ts.map +1 -0
- package/dist/types/common/window/session-storage.d.ts +18 -0
- package/dist/types/common/window/session-storage.d.ts.map +1 -0
- package/dist/types/common/window/supports-performance-observer.d.ts +2 -0
- package/dist/types/common/window/supports-performance-observer.d.ts.map +1 -0
- package/dist/types/common/wrap/index.d.ts +11 -0
- package/dist/types/common/wrap/index.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-events.d.ts +17 -0
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts +18 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-function.d.ts +28 -0
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-history.d.ts +16 -0
- package/dist/types/common/wrap/wrap-history.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts +16 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts +16 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-promise.d.ts +17 -0
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-raf.d.ts +16 -0
- package/dist/types/common/wrap/wrap-raf.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-timer.d.ts +17 -0
- package/dist/types/common/wrap/wrap-timer.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts +16 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts +16 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/ajax/constants.d.ts +2 -0
- package/dist/types/features/ajax/constants.d.ts.map +1 -0
- package/dist/types/features/ajax/index.d.ts +2 -0
- package/dist/types/features/ajax/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +19 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts +9 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts +2 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +22 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts +3 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts +24 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts.map +1 -0
- package/dist/types/features/jserrors/constants.d.ts +3 -0
- package/dist/types/features/jserrors/constants.d.ts.map +1 -0
- package/dist/types/features/jserrors/index.d.ts +2 -0
- package/dist/types/features/jserrors/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts +2 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts +22 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts +6 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -0
- package/dist/types/features/metrics/index.d.ts +2 -0
- package/dist/types/features/metrics/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts +6 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts +7 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +1 -0
- package/dist/types/features/page_action/aggregate/index.d.ts +24 -0
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_action/constants.d.ts +2 -0
- package/dist/types/features/page_action/constants.d.ts.map +1 -0
- package/dist/types/features/page_action/index.d.ts +2 -0
- package/dist/types/features/page_action/index.d.ts.map +1 -0
- package/dist/types/features/page_action/instrument/index.d.ts +6 -0
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts +9 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts +8 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -0
- package/dist/types/features/page_view_event/constants.d.ts +5 -0
- package/dist/types/features/page_view_event/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_event/index.d.ts +2 -0
- package/dist/types/features/page_view_event/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +32 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/constants.d.ts +2 -0
- package/dist/types/features/page_view_timing/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts +2 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts +2 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +77 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/constants.d.ts +13 -0
- package/dist/types/features/session_trace/constants.d.ts.map +1 -0
- package/dist/types/features/session_trace/index.d.ts +2 -0
- package/dist/types/features/session_trace/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts +11 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/index.d.ts +25 -0
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts +15 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts +20 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts +15 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -0
- package/dist/types/features/spa/constants.d.ts +23 -0
- package/dist/types/features/spa/constants.d.ts.map +1 -0
- package/dist/types/features/spa/index.d.ts +2 -0
- package/dist/types/features/spa/index.d.ts.map +1 -0
- package/dist/types/features/spa/instrument/index.d.ts +8 -0
- package/dist/types/features/spa/instrument/index.d.ts.map +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts +4 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +23 -0
- package/dist/types/features/utils/feature-base.d.ts.map +1 -0
- package/dist/types/features/utils/handler-cache.d.ts +22 -0
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +27 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -0
- package/dist/types/features/utils/lazy-loader.d.ts +13 -0
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/loaders/agent.d.ts +20 -0
- package/dist/types/loaders/agent.d.ts.map +1 -0
- package/dist/types/loaders/api/api.d.ts +17 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -0
- package/dist/types/loaders/api/apiAsync.d.ts +2 -0
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -0
- package/dist/types/loaders/browser-agent.d.ts +9 -0
- package/dist/types/loaders/browser-agent.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts +10 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -0
- package/dist/types/loaders/features/enabled-features.d.ts +2 -0
- package/dist/types/loaders/features/enabled-features.d.ts.map +1 -0
- package/dist/types/loaders/features/featureDependencies.d.ts +3 -0
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -0
- package/dist/types/loaders/features/features.d.ts +18 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -0
- package/dist/types/loaders/micro-agent.d.ts +25 -0
- package/dist/types/loaders/micro-agent.d.ts.map +1 -0
- package/dist/types/loaders/worker-agent.d.ts +8 -0
- package/dist/types/loaders/worker-agent.d.ts.map +1 -0
- package/package.json +67 -59
- package/src/cdn/lite.js +18 -0
- package/src/cdn/polyfills/lite.js +7 -0
- package/src/cdn/polyfills/pro.js +7 -0
- package/src/cdn/polyfills/spa.js +7 -0
- package/src/cdn/polyfills.js +17 -0
- package/src/cdn/pro.js +27 -0
- package/src/cdn/spa.js +28 -0
- package/src/cdn/worker.js +21 -0
- package/src/common/aggregate/aggregator.js +171 -0
- package/src/common/browser-version/firefox-version.js +10 -0
- package/src/common/browser-version/ios-version.js +11 -0
- package/src/common/config/config.js +12 -0
- package/src/common/config/state/configurable.js +26 -0
- package/src/common/config/state/info.js +49 -0
- package/src/common/config/state/init.js +56 -0
- package/src/common/config/state/loader-config.js +25 -0
- package/src/common/config/state/originals.js +3 -0
- package/src/common/config/state/runtime.js +47 -0
- package/src/common/constants/env.cdn.js +20 -0
- package/src/common/constants/env.js +23 -0
- package/src/common/constants/env.npm.js +21 -0
- package/src/common/context/shared-context.js +21 -0
- package/src/common/deny-list/deny-list.js +116 -0
- package/src/common/drain/drain.js +119 -0
- package/src/common/event-emitter/contextual-ee.js +159 -0
- package/src/common/event-emitter/contextual-ee.test.js +310 -0
- package/src/common/event-emitter/handle.js +17 -0
- package/src/common/event-emitter/handle.test.js +56 -0
- package/src/common/event-emitter/register-handler.js +25 -0
- package/src/common/event-emitter/register-handler.test.js +61 -0
- package/src/common/event-listener/event-listener-opts.js +41 -0
- package/src/common/harvest/harvest-scheduler.js +112 -0
- package/src/common/harvest/harvest.js +248 -0
- package/src/common/ids/id.js +32 -0
- package/src/common/ids/id.test.js +92 -0
- package/src/common/ids/unique-id.js +104 -0
- package/src/common/ids/unique-id.test.js +58 -0
- package/src/common/metrics/framework-detection.js +71 -0
- package/src/common/metrics/paint-metrics.js +6 -0
- package/src/common/serialize/bel-serializer.js +93 -0
- package/src/common/timing/nav-timing.js +90 -0
- package/src/common/timing/nav-timing.test.js +161 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +62 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/clean-url.test.js +25 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/encode.test.js +80 -0
- package/src/common/url/location.js +12 -0
- package/src/common/url/location.test.js +15 -0
- package/src/common/url/parse-url.js +70 -0
- package/src/common/url/parse-url.test.js +110 -0
- package/src/common/url/protocol.js +9 -0
- package/src/common/url/protocol.test.js +18 -0
- package/src/common/util/console.js +11 -0
- package/src/common/util/data-size.js +21 -0
- package/src/common/util/feature-flags.js +38 -0
- package/src/common/util/get-or-set.js +34 -0
- package/src/common/util/global-scope.js +47 -0
- package/src/common/util/map-own.js +22 -0
- package/src/common/util/map-own.test.js +52 -0
- package/src/common/util/obfuscate.js +73 -0
- package/src/common/util/s-hash.js +14 -0
- package/src/common/util/single.js +18 -0
- package/src/common/util/stringify.js +42 -0
- package/src/common/util/submit-data.js +101 -0
- package/src/common/util/traverse.js +36 -0
- package/src/common/util/user-agent.js +56 -0
- package/src/common/window/load.js +15 -0
- package/src/common/window/nreum.js +110 -0
- package/src/common/window/page-visibility.js +24 -0
- package/src/common/window/session-storage.js +75 -0
- package/src/common/window/supports-performance-observer.js +10 -0
- package/src/common/wrap/index.js +17 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +110 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +51 -0
- package/src/common/wrap/wrap-jsonp.js +136 -0
- package/src/common/wrap/wrap-mutation.js +58 -0
- package/src/common/wrap/wrap-promise.js +166 -0
- package/src/common/wrap/wrap-promise.test.js +140 -0
- package/src/common/wrap/wrap-raf.js +52 -0
- package/src/common/wrap/wrap-timer.js +69 -0
- package/src/common/wrap/wrap-xhr.js +214 -0
- package/src/features/ajax/aggregate/index.js +248 -0
- package/src/features/ajax/constants.js +3 -0
- package/src/features/ajax/index.js +1 -0
- package/src/features/ajax/instrument/distributed-tracing.js +166 -0
- package/src/features/ajax/instrument/index.js +380 -0
- package/src/features/ajax/instrument/response-size.js +18 -0
- package/src/features/jserrors/aggregate/canonical-function-name.js +14 -0
- package/src/features/jserrors/aggregate/canonical-function-name.test.js +13 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.js +231 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +297 -0
- package/src/features/jserrors/aggregate/format-stack-trace.js +30 -0
- package/src/features/jserrors/aggregate/format-stack-trace.test.js +39 -0
- package/src/features/jserrors/aggregate/index.js +310 -0
- package/src/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/src/features/jserrors/aggregate/string-hash-code.test.js +12 -0
- package/src/features/jserrors/constants.js +4 -0
- package/src/features/jserrors/index.js +1 -0
- package/src/features/jserrors/instrument/debug.js +36 -0
- package/src/features/jserrors/instrument/index.js +151 -0
- package/src/features/metrics/aggregate/index.js +133 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +14 -0
- package/src/features/metrics/instrument/workers-helper.js +113 -0
- package/src/features/page_action/aggregate/index.js +113 -0
- package/src/features/page_action/constants.js +3 -0
- package/src/features/page_action/index.js +1 -0
- package/src/features/page_action/instrument/index.js +15 -0
- package/src/features/page_view_event/aggregate/index.js +143 -0
- package/src/features/page_view_event/aggregate/initialized-features.js +31 -0
- package/src/features/page_view_event/constants.js +6 -0
- package/src/features/page_view_event/index.js +1 -0
- package/src/features/page_view_event/instrument/index.js +33 -0
- package/src/features/page_view_timing/aggregate/index.js +257 -0
- package/src/features/page_view_timing/constants.js +3 -0
- package/src/features/page_view_timing/first-paint.js +41 -0
- package/src/features/page_view_timing/index.js +1 -0
- package/src/features/page_view_timing/instrument/index.js +30 -0
- package/src/features/page_view_timing/long-tasks.js +60 -0
- package/src/features/session_trace/aggregate/index.js +413 -0
- package/src/features/session_trace/constants.js +15 -0
- package/src/features/session_trace/index.js +1 -0
- package/src/features/session_trace/instrument/index.js +127 -0
- package/src/features/spa/aggregate/index.js +738 -0
- package/src/features/spa/aggregate/interaction-node.js +85 -0
- package/src/features/spa/aggregate/interaction-node.test.js +17 -0
- package/src/features/spa/aggregate/interaction.js +112 -0
- package/src/features/spa/aggregate/serializer.js +198 -0
- package/src/features/spa/constants.js +36 -0
- package/src/features/spa/index.js +1 -0
- package/src/features/spa/instrument/index.js +114 -0
- package/src/features/utils/aggregate-base.js +7 -0
- package/src/features/utils/feature-base.js +51 -0
- package/src/features/utils/handler-cache.js +60 -0
- package/src/features/utils/instrument-base.js +68 -0
- package/src/features/utils/lazy-loader.js +37 -0
- package/src/index.js +15 -0
- package/src/loaders/agent.js +80 -0
- package/src/loaders/api/api.js +175 -0
- package/src/loaders/api/apiAsync.js +92 -0
- package/src/loaders/browser-agent.js +33 -0
- package/src/loaders/configure/configure.js +39 -0
- package/src/loaders/features/enabled-features.js +16 -0
- package/src/loaders/features/featureDependencies.js +26 -0
- package/src/loaders/features/features.js +25 -0
- package/src/loaders/micro-agent.js +84 -0
- package/src/loaders/worker-agent.js +24 -0
- package/dist/cjs/common/constants/environment-variables.js +0 -20
- package/dist/cjs/common/util/reduce.js +0 -22
- package/dist/cjs/common/window/top-level-callers.js +0 -23
- package/dist/esm/common/constants/environment-variables.js +0 -11
- package/dist/esm/common/util/reduce.js +0 -16
- package/dist/esm/common/window/top-level-callers.js +0 -17
- package/types.ts +0 -221
|
@@ -22,10 +22,12 @@ const wrapped = {};
|
|
|
22
22
|
*/
|
|
23
23
|
export function wrapPromise(sharedEE) {
|
|
24
24
|
const promiseEE = scopedEE(sharedEE);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
wrapped[promiseEE.debugId]
|
|
25
|
+
|
|
26
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
27
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
28
|
+
if (wrapped[promiseEE.debugId]) return promiseEE;
|
|
29
|
+
wrapped[promiseEE.debugId] = true; // otherwise, first feature to wrap promise
|
|
30
|
+
|
|
29
31
|
var getContext = getOrSetContext;
|
|
30
32
|
var promiseWrapper = wrapFn(promiseEE);
|
|
31
33
|
var prevPromiseObj = originals.PR;
|
|
@@ -67,8 +69,7 @@ export function wrapPromise(sharedEE) {
|
|
|
67
69
|
WrappedPromise[method] = function (subPromises) {
|
|
68
70
|
// use our own wrapped version of "Promise.all" and ".race" static fns
|
|
69
71
|
let finalized = false;
|
|
70
|
-
subPromises
|
|
71
|
-
// eslint-disable-next-line
|
|
72
|
+
Array.from(subPromises || []).forEach(sub => {
|
|
72
73
|
this.resolve(sub).then(setNrId(method === 'all'), setNrId(false));
|
|
73
74
|
});
|
|
74
75
|
const origFnCallWithThis = prevStaticFn.apply(this, arguments);
|
|
@@ -104,10 +105,13 @@ export function wrapPromise(sharedEE) {
|
|
|
104
105
|
|
|
105
106
|
// Note that this wrapping affects the same originals.PR (prototype) object.
|
|
106
107
|
const prevPromiseOrigThen = prevPromiseObj.prototype.then;
|
|
107
|
-
prevPromiseObj.prototype.then = function wrappedThen(
|
|
108
|
+
prevPromiseObj.prototype.then = function wrappedThen() {
|
|
108
109
|
var originalThis = this;
|
|
109
110
|
var ctx = getContext(originalThis);
|
|
110
111
|
ctx.promise = originalThis;
|
|
112
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
113
|
+
args[_key] = arguments[_key];
|
|
114
|
+
}
|
|
111
115
|
args[0] = promiseWrapper(args[0], 'cb-', ctx, null, false);
|
|
112
116
|
args[1] = promiseWrapper(args[1], 'cb-', ctx, null, false);
|
|
113
117
|
const origFnCallWithThis = prevPromiseOrigThen.apply(this, args);
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { faker } from '@faker-js/faker';
|
|
2
|
+
import { globalScope } from '../util/global-scope';
|
|
3
|
+
import { originals } from '../config/config';
|
|
4
|
+
jest.mock('./wrap-function', () => ({
|
|
5
|
+
__esModule: true,
|
|
6
|
+
createWrapperWithEmitter: jest.fn(() => fn => function () {
|
|
7
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
8
|
+
args[_key] = arguments[_key];
|
|
9
|
+
}
|
|
10
|
+
return fn.apply(null, args);
|
|
11
|
+
})
|
|
12
|
+
}));
|
|
13
|
+
jest.mock('../event-emitter/contextual-ee', () => ({
|
|
14
|
+
__esModule: true,
|
|
15
|
+
getOrSetContext: jest.fn(() => ({})),
|
|
16
|
+
ee: {
|
|
17
|
+
get: jest.fn(name => ({
|
|
18
|
+
debugId: name,
|
|
19
|
+
on: jest.fn(),
|
|
20
|
+
context: jest.fn(() => ({})),
|
|
21
|
+
emit: jest.fn()
|
|
22
|
+
}))
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
jest.mock('../config/config', () => ({
|
|
26
|
+
__esModule: true,
|
|
27
|
+
originals: {}
|
|
28
|
+
}));
|
|
29
|
+
jest.mock('../util/global-scope', () => ({
|
|
30
|
+
__esModule: true,
|
|
31
|
+
globalScope: {
|
|
32
|
+
NREUM: {}
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
let promiseConstructorCalls;
|
|
36
|
+
beforeEach(async () => {
|
|
37
|
+
promiseConstructorCalls = [];
|
|
38
|
+
|
|
39
|
+
// Proxy the global Promise to prevent the wrapping from
|
|
40
|
+
// messing with Jest internal promises
|
|
41
|
+
originals.PR = new Proxy(class extends Promise {}, {
|
|
42
|
+
construct(target, args) {
|
|
43
|
+
promiseConstructorCalls.push(args);
|
|
44
|
+
return Reflect.construct(target, args);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
(await import('./wrap-promise')).wrapPromise();
|
|
48
|
+
});
|
|
49
|
+
afterEach(() => {
|
|
50
|
+
jest.resetModules();
|
|
51
|
+
});
|
|
52
|
+
test('should wrap promise constructor', async () => {
|
|
53
|
+
const promiseInstance = new globalScope.Promise(jest.fn());
|
|
54
|
+
expect(promiseInstance).toBeInstanceOf(Promise);
|
|
55
|
+
expect(promiseConstructorCalls.length).toEqual(1);
|
|
56
|
+
expect(globalScope.Promise.toString()).toMatch(/\[native code\]/);
|
|
57
|
+
expect(globalScope.Promise.name).toEqual('Promise');
|
|
58
|
+
});
|
|
59
|
+
describe('all', () => {
|
|
60
|
+
test('should work with acceptable iterables', async () => {
|
|
61
|
+
const resolveValue = faker.datatype.uuid();
|
|
62
|
+
const customIterable = new CustomIterable([new globalScope.Promise(resolve => resolve(resolveValue))]);
|
|
63
|
+
const arrayIterable = [new globalScope.Promise(resolve => resolve(resolveValue))];
|
|
64
|
+
const setIterable = new Set();
|
|
65
|
+
setIterable.add(new globalScope.Promise(resolve => resolve(resolveValue)));
|
|
66
|
+
await expect(globalScope.Promise.all(customIterable)).resolves.toEqual([resolveValue]);
|
|
67
|
+
await expect(globalScope.Promise.all(arrayIterable)).resolves.toEqual([resolveValue]);
|
|
68
|
+
await expect(globalScope.Promise.all(setIterable)).resolves.toEqual([resolveValue]);
|
|
69
|
+
});
|
|
70
|
+
test.each([null, undefined])('should not try to iterate a non-iterable %s', async input => {
|
|
71
|
+
jest.spyOn(globalScope.Promise, 'resolve');
|
|
72
|
+
await expect(globalScope.Promise.all(input)).rejects.toThrow();
|
|
73
|
+
expect(globalScope.Promise.resolve).not.toHaveBeenCalled();
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('race', () => {
|
|
77
|
+
test('should work with acceptable iterables', async () => {
|
|
78
|
+
jest.spyOn(globalScope.Promise, 'resolve');
|
|
79
|
+
const resolveValue = faker.datatype.uuid();
|
|
80
|
+
const customIterable = new CustomIterable([new globalScope.Promise(resolve => resolve(resolveValue))]);
|
|
81
|
+
const arrayIterable = [new globalScope.Promise(resolve => resolve(resolveValue))];
|
|
82
|
+
const setIterable = new Set();
|
|
83
|
+
setIterable.add(new globalScope.Promise(resolve => resolve(resolveValue)));
|
|
84
|
+
await expect(globalScope.Promise.race(customIterable)).resolves.toEqual(resolveValue);
|
|
85
|
+
await expect(globalScope.Promise.race(arrayIterable)).resolves.toEqual(resolveValue);
|
|
86
|
+
await expect(globalScope.Promise.race(setIterable)).resolves.toEqual(resolveValue);
|
|
87
|
+
expect(globalScope.Promise.resolve).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
test.each([null, undefined])('should not try to iterate a non-iterable %s', async input => {
|
|
90
|
+
jest.spyOn(globalScope.Promise, 'resolve');
|
|
91
|
+
await expect(globalScope.Promise.race(input)).rejects.toThrow();
|
|
92
|
+
expect(globalScope.Promise.resolve).not.toHaveBeenCalled();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
class CustomIterable {
|
|
96
|
+
#iterables = [];
|
|
97
|
+
constructor(iterables) {
|
|
98
|
+
this.#iterables = iterables;
|
|
99
|
+
}
|
|
100
|
+
[Symbol.iterator]() {
|
|
101
|
+
return {
|
|
102
|
+
index: 0,
|
|
103
|
+
iterables: this.#iterables,
|
|
104
|
+
next() {
|
|
105
|
+
return {
|
|
106
|
+
done: this.index >= this.iterables.length,
|
|
107
|
+
value: this.iterables[this.index++] || undefined
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
[Symbol.iterator]() {
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
11
|
-
import { createWrapperWithEmitter as wfn
|
|
11
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
12
12
|
import { isBrowserScope } from '../util/global-scope';
|
|
13
13
|
const wrapped = {};
|
|
14
14
|
const RAF_NAME = 'requestAnimationFrame';
|
|
@@ -21,12 +21,12 @@ const RAF_NAME = 'requestAnimationFrame';
|
|
|
21
21
|
*/
|
|
22
22
|
export function wrapRaf(sharedEE) {
|
|
23
23
|
const ee = scopedEE(sharedEE);
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
|
|
25
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
26
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
27
|
+
if (!isBrowserScope || wrapped[ee.debugId]++) return ee;
|
|
28
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap RAF
|
|
29
|
+
|
|
30
30
|
var wrapFn = wfn(ee);
|
|
31
31
|
wrapFn.inPlace(window, [RAF_NAME], 'raf-');
|
|
32
32
|
ee.on('raf-start', function (args) {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { ee as baseEE } from '../event-emitter/contextual-ee';
|
|
11
|
-
import { createWrapperWithEmitter as wfn
|
|
11
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
12
12
|
import { globalScope } from '../util/global-scope';
|
|
13
13
|
const wrapped = {};
|
|
14
14
|
const SET_TIMEOUT = 'setTimeout';
|
|
@@ -28,12 +28,12 @@ const TIMER_FNS = [SET_TIMEOUT, 'setImmediate', SET_INTERVAL, CLEAR_TIMEOUT, 'cl
|
|
|
28
28
|
//eslint-disable-next-line
|
|
29
29
|
export function wrapTimer(sharedEE) {
|
|
30
30
|
const ee = scopedEE(sharedEE);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
|
|
32
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
33
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
34
|
+
if (wrapped[ee.debugId]++) return ee;
|
|
35
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap timer
|
|
36
|
+
|
|
37
37
|
var wrapFn = wfn(ee);
|
|
38
38
|
wrapFn.inPlace(globalScope, TIMER_FNS.slice(0, 2), SET_TIMEOUT + DASH);
|
|
39
39
|
wrapFn.inPlace(globalScope, TIMER_FNS.slice(2, 3), SET_INTERVAL + DASH);
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* This module is used by: ajax, jserrors, spa.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { wrapEvents
|
|
10
|
+
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
|
-
import { createWrapperWithEmitter as wfn
|
|
13
|
+
import { createWrapperWithEmitter as wfn } from './wrap-function';
|
|
14
14
|
import { originals } from '../config/config';
|
|
15
15
|
import { globalScope } from '../util/global-scope';
|
|
16
16
|
import { warn } from '../util/console';
|
|
@@ -27,12 +27,11 @@ const XHR_PROPS = ['open', 'send']; // these are the specific funcs being wrappe
|
|
|
27
27
|
export function wrapXhr(sharedEE) {
|
|
28
28
|
var baseEE = sharedEE || contextualEE;
|
|
29
29
|
const ee = scopedEE(baseEE);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
wrapped[ee.debugId] = 1; // <- otherwise, first feature to wrap XHR
|
|
30
|
+
|
|
31
|
+
// Notice if our wrapping never ran yet, the falsy NaN will not early return; but if it has,
|
|
32
|
+
// then we increment the count to track # of feats using this at runtime.
|
|
33
|
+
if (wrapped[ee.debugId]++) return ee;
|
|
34
|
+
wrapped[ee.debugId] = 1; // otherwise, first feature to wrap XHR
|
|
36
35
|
|
|
37
36
|
wrapEvents(baseEE); // wrap-events patches XMLHttpRequest.prototype.addEventListener for us
|
|
38
37
|
var wrapFn = wfn(ee);
|
|
@@ -55,7 +55,7 @@ export class Aggregate extends AggregateBase {
|
|
|
55
55
|
onFinished: onEventsHarvestFinished,
|
|
56
56
|
getPayload: prepareHarvest
|
|
57
57
|
}, this);
|
|
58
|
-
ee.on(
|
|
58
|
+
ee.on("drain-".concat(this.featureName), () => {
|
|
59
59
|
scheduler.startTimer(harvestTimeSeconds);
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -23,7 +23,8 @@ var origRequest = originals.REQ;
|
|
|
23
23
|
var origXHR = globalScope.XMLHttpRequest;
|
|
24
24
|
export class Instrument extends InstrumentBase {
|
|
25
25
|
static featureName = FEATURE_NAME;
|
|
26
|
-
constructor(agentIdentifier, aggregator
|
|
26
|
+
constructor(agentIdentifier, aggregator) {
|
|
27
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
27
28
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
28
29
|
|
|
29
30
|
// Very unlikely, but in case the existing XMLHttpRequest.prototype object on the page couldn't be wrapped.
|
|
@@ -19,10 +19,11 @@ test.each([{
|
|
|
19
19
|
input: '<anonymous>',
|
|
20
20
|
expected: undefined,
|
|
21
21
|
title: 'Return undefined ending is non-alphanumeric'
|
|
22
|
-
}])('$title',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
}])('$title', _ref => {
|
|
23
|
+
let {
|
|
24
|
+
input,
|
|
25
|
+
expected
|
|
26
|
+
} = _ref;
|
|
26
27
|
const result = canonicalFunctionName(input);
|
|
27
28
|
expect(result).toEqual(expected);
|
|
28
29
|
});
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
// INTERNET EXPLORER:
|
|
57
57
|
// ex.message = ...
|
|
58
58
|
// ex.name = ReferenceError
|
|
59
|
-
import { reduce } from '../../../common/util/reduce';
|
|
60
59
|
import { formatStackTrace } from './format-stack-trace';
|
|
61
60
|
var debug = false;
|
|
62
61
|
var classNameRegex = /function (.+?)\s*\(/;
|
|
@@ -113,7 +112,7 @@ function computeStackTraceFromStackProp(ex) {
|
|
|
113
112
|
if (!ex.stack) {
|
|
114
113
|
return null;
|
|
115
114
|
}
|
|
116
|
-
var errorInfo =
|
|
115
|
+
var errorInfo = ex.stack.split('\n').reduce(parseStackProp, {
|
|
117
116
|
frames: [],
|
|
118
117
|
stackLines: [],
|
|
119
118
|
wrapperSeen: false
|
|
@@ -144,7 +144,7 @@ describe('errors without stack property and with line property', () => {
|
|
|
144
144
|
mode: 'sourceline',
|
|
145
145
|
name: mockError.name,
|
|
146
146
|
message: mockError.message,
|
|
147
|
-
stackString:
|
|
147
|
+
stackString: "".concat(mockError.name, ": ").concat(mockError.message, "\n at ").concat(sourceURL, ":").concat(mockError.line)
|
|
148
148
|
}));
|
|
149
149
|
expect(result.frames.length).toEqual(1);
|
|
150
150
|
expect(result.frames).toContainEqual(expect.objectContaining({
|
|
@@ -170,7 +170,7 @@ describe('errors without stack property and with line property', () => {
|
|
|
170
170
|
mode: 'sourceline',
|
|
171
171
|
name: mockError.name,
|
|
172
172
|
message: mockError.message,
|
|
173
|
-
stackString:
|
|
173
|
+
stackString: "".concat(mockError.name, ": ").concat(mockError.message, "\n at ").concat(sourceURL, ":").concat(mockError.line, ":").concat(mockError.column)
|
|
174
174
|
}));
|
|
175
175
|
expect(result.frames.length).toEqual(1);
|
|
176
176
|
expect(result.frames).toContainEqual(expect.objectContaining({
|
|
@@ -191,7 +191,7 @@ describe('errors without stack property and with line property', () => {
|
|
|
191
191
|
mode: 'sourceline',
|
|
192
192
|
name: mockError.name,
|
|
193
193
|
message: mockError.message,
|
|
194
|
-
stackString:
|
|
194
|
+
stackString: "RangeError: ".concat(mockError.message, "\n in evaluated code")
|
|
195
195
|
}));
|
|
196
196
|
expect(result.frames.length).toEqual(1);
|
|
197
197
|
expect(result.frames).toContainEqual(expect.objectContaining({
|
|
@@ -230,7 +230,7 @@ describe('errors that are messages only or primitives', () => {
|
|
|
230
230
|
expect(result).toEqual(expect.objectContaining({
|
|
231
231
|
mode: 'nameonly',
|
|
232
232
|
name: mockError.name,
|
|
233
|
-
stackString:
|
|
233
|
+
stackString: "".concat(mockError.name, ": undefined"),
|
|
234
234
|
frames: []
|
|
235
235
|
}));
|
|
236
236
|
});
|
|
@@ -246,7 +246,7 @@ describe('errors that are messages only or primitives', () => {
|
|
|
246
246
|
mode: 'nameonly',
|
|
247
247
|
name: mockError.name,
|
|
248
248
|
message: mockError.message,
|
|
249
|
-
stackString:
|
|
249
|
+
stackString: "".concat(mockError.name, ": ").concat(mockError.message),
|
|
250
250
|
frames: []
|
|
251
251
|
}));
|
|
252
252
|
});
|
|
@@ -13,16 +13,17 @@ describe('formatStackTrace', () => {
|
|
|
13
13
|
input: ['line 1', 'line 2', ''],
|
|
14
14
|
expected: 'line 1\nline 2',
|
|
15
15
|
title: 'Strips ending empty stack frame'
|
|
16
|
-
}])('$title',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
}])('$title', _ref => {
|
|
17
|
+
let {
|
|
18
|
+
input,
|
|
19
|
+
expected
|
|
20
|
+
} = _ref;
|
|
20
21
|
const result = formatStackTrace(input);
|
|
21
22
|
expect(result).toEqual(expected);
|
|
22
23
|
});
|
|
23
24
|
test('truncates the middle of the stack lines when more than 100', () => {
|
|
24
25
|
const input = Array.apply(null, Array(200)).map(() => faker.datatype.uuid());
|
|
25
|
-
const expected = input.slice(0, 50).join('\n') +
|
|
26
|
+
const expected = input.slice(0, 50).join('\n') + "\n< ...truncated ".concat(input.length - 100, " lines... >\n") + input.slice(-50).join('\n');
|
|
26
27
|
const result = formatStackTrace(input);
|
|
27
28
|
expect(result).toEqual(expected);
|
|
28
29
|
});
|
|
@@ -20,11 +20,12 @@ import { AggregateBase } from '../../utils/aggregate-base';
|
|
|
20
20
|
import { FEATURE_NAME } from '../constants';
|
|
21
21
|
import { drain } from '../../../common/drain/drain';
|
|
22
22
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
23
|
-
import { onWindowLoad } from '../../../common/window/load';
|
|
24
23
|
export class Aggregate extends AggregateBase {
|
|
25
24
|
static featureName = FEATURE_NAME;
|
|
26
25
|
constructor(agentIdentifier, aggregator) {
|
|
26
|
+
var _this;
|
|
27
27
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
28
|
+
_this = this;
|
|
28
29
|
this.stackReported = {};
|
|
29
30
|
this.pageviewReported = {};
|
|
30
31
|
this.errorCache = {};
|
|
@@ -36,16 +37,24 @@ export class Aggregate extends AggregateBase {
|
|
|
36
37
|
|
|
37
38
|
// this will need to change to match whatever ee we use in the instrument
|
|
38
39
|
this.ee.on('interactionDiscarded', interaction => this.onInteractionDiscarded(interaction));
|
|
39
|
-
register('err',
|
|
40
|
-
|
|
40
|
+
register('err', function () {
|
|
41
|
+
return _this.storeError(...arguments);
|
|
42
|
+
}, this.featureName, this.ee);
|
|
43
|
+
register('ierr', function () {
|
|
44
|
+
return _this.storeError(...arguments);
|
|
45
|
+
}, this.featureName, this.ee);
|
|
41
46
|
const harvestTimeSeconds = getConfigurationValue(this.agentIdentifier, 'jserrors.harvestTimeSeconds') || 10;
|
|
42
47
|
const scheduler = new HarvestScheduler('jserrors', {
|
|
43
|
-
onFinished: (
|
|
48
|
+
onFinished: function () {
|
|
49
|
+
return _this.onHarvestFinished(...arguments);
|
|
50
|
+
}
|
|
44
51
|
}, this);
|
|
45
|
-
scheduler.harvest.on('jserrors', (
|
|
52
|
+
scheduler.harvest.on('jserrors', function () {
|
|
53
|
+
return _this.onHarvestStarted(...arguments);
|
|
54
|
+
});
|
|
46
55
|
|
|
47
56
|
// Don't start harvesting until "drain" for this feat has been called (which currently requires RUM response).
|
|
48
|
-
this.ee.on(
|
|
57
|
+
this.ee.on("drain-".concat(this.featureName), () => {
|
|
49
58
|
if (!this.blocked) scheduler.startTimer(harvestTimeSeconds); // and only if ingest will accept jserror payloads
|
|
50
59
|
});
|
|
51
60
|
|
|
@@ -89,7 +98,7 @@ export class Aggregate extends AggregateBase {
|
|
|
89
98
|
}
|
|
90
99
|
}
|
|
91
100
|
nameHash(params) {
|
|
92
|
-
return stringHashCode(
|
|
101
|
+
return stringHashCode("".concat(params.exceptionClass, "_").concat(params.message, "_").concat(params.stack_trace || params.browser_stack_hash));
|
|
93
102
|
}
|
|
94
103
|
getBucketName(params, customParams) {
|
|
95
104
|
return this.nameHash(params) + ':' + stringHashCode(stringify(customParams));
|
|
@@ -141,17 +150,29 @@ export class Aggregate extends AggregateBase {
|
|
|
141
150
|
storeError(err, time, internal, customAttributes) {
|
|
142
151
|
// are we in an interaction
|
|
143
152
|
time = time || now();
|
|
144
|
-
|
|
153
|
+
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
154
|
+
let filterOutput;
|
|
155
|
+
if (!internal && agentRuntime.onerror) {
|
|
156
|
+
filterOutput = agentRuntime.onerror(err);
|
|
157
|
+
if (filterOutput && !(typeof filterOutput.group === 'string' && filterOutput.group.length)) {
|
|
158
|
+
// All truthy values mean don't report (store) the error, per backwards-compatible usage,
|
|
159
|
+
// - EXCEPT if a fingerprinting label is returned, via an object with key of 'group' and value of non-empty string
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// Again as with previous usage, all falsey values would include the error.
|
|
163
|
+
}
|
|
164
|
+
|
|
145
165
|
var stackInfo = this.canonicalizeStackURLs(computeStackTrace(err));
|
|
146
166
|
var canonicalStack = this.buildCanonicalStackString(stackInfo);
|
|
147
|
-
|
|
167
|
+
const params = {
|
|
148
168
|
stackHash: stringHashCode(canonicalStack),
|
|
149
169
|
exceptionClass: stackInfo.name,
|
|
150
170
|
request_uri: globalScope?.location.pathname
|
|
151
171
|
};
|
|
152
|
-
if (stackInfo.message)
|
|
153
|
-
|
|
154
|
-
|
|
172
|
+
if (stackInfo.message) params.message = '' + stackInfo.message;
|
|
173
|
+
// Notice if filterOutput isn't false|undefined OR our specified object, this func would've returned already (so it's unnecessary to req-check group).
|
|
174
|
+
// Do not modify the name ('errorGroup') of params without DEM approval!
|
|
175
|
+
if (filterOutput?.group) params.errorGroup = filterOutput.group;
|
|
155
176
|
|
|
156
177
|
/**
|
|
157
178
|
* The bucketHash is different from the params.stackHash because the params.stackHash is based on the canonicalized
|
|
@@ -159,14 +180,14 @@ export class Aggregate extends AggregateBase {
|
|
|
159
180
|
* the canonical stack trace excludes items like the column number increasing the hit-rate of different errors potentially
|
|
160
181
|
* bucketing and ultimately resulting in the loss of data in NR1.
|
|
161
182
|
*/
|
|
162
|
-
var bucketHash = stringHashCode(
|
|
183
|
+
var bucketHash = stringHashCode("".concat(stackInfo.name, "_").concat(stackInfo.message, "_").concat(stackInfo.stackString));
|
|
163
184
|
if (!this.stackReported[bucketHash]) {
|
|
164
185
|
this.stackReported[bucketHash] = true;
|
|
165
186
|
params.stack_trace = truncateSize(stackInfo.stackString);
|
|
166
187
|
} else {
|
|
167
188
|
params.browser_stack_hash = stringHashCode(stackInfo.stackString);
|
|
168
189
|
}
|
|
169
|
-
params.releaseIds = stringify(
|
|
190
|
+
params.releaseIds = stringify(agentRuntime.releaseIds);
|
|
170
191
|
|
|
171
192
|
// When debugging stack canonicalization/hashing, uncomment these lines for
|
|
172
193
|
// more output in the test logs
|
|
@@ -15,10 +15,11 @@ test.each([{
|
|
|
15
15
|
input: 'lksjdflksjdf',
|
|
16
16
|
expected: 32668720,
|
|
17
17
|
title: 'Return valid hash of string'
|
|
18
|
-
}])('$title',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
}])('$title', _ref => {
|
|
19
|
+
let {
|
|
20
|
+
input,
|
|
21
|
+
expected
|
|
22
|
+
} = _ref;
|
|
22
23
|
const result = stringHashCode(input);
|
|
23
24
|
expect(result).toEqual(expected);
|
|
24
25
|
});
|
|
@@ -18,16 +18,16 @@ import { getRuntime } from '../../../common/config/config';
|
|
|
18
18
|
import { stringify } from '../../../common/util/stringify';
|
|
19
19
|
export class Instrument extends InstrumentBase {
|
|
20
20
|
static featureName = FEATURE_NAME;
|
|
21
|
-
constructor(agentIdentifier, aggregator
|
|
21
|
+
constructor(agentIdentifier, aggregator) {
|
|
22
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
22
23
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
23
24
|
// skipNext counter to keep track of uncaught
|
|
24
25
|
// errors that will be the same as caught errors.
|
|
25
26
|
this.skipNext = 0;
|
|
26
|
-
this.origOnerror = globalScope.onerror;
|
|
27
27
|
try {
|
|
28
|
+
// this try-catch can be removed when IE11 is completely unsupported & gone
|
|
28
29
|
this.removeOnAbort = new AbortController();
|
|
29
|
-
}
|
|
30
|
-
catch (e) {}
|
|
30
|
+
} catch (e) {}
|
|
31
31
|
const thisInstrument = this;
|
|
32
32
|
thisInstrument.ee.on('fn-start', function (args, obj, methodName) {
|
|
33
33
|
if (thisInstrument.abortHandler) thisInstrument.skipNext += 1;
|
|
@@ -49,12 +49,9 @@ export class Instrument extends InstrumentBase {
|
|
|
49
49
|
handle('ierr', [e, now(), true], undefined, FEATURE_NAMES.jserrors, thisInstrument.ee);
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.onerrorHandler(...args);
|
|
56
|
-
return false;
|
|
57
|
-
};
|
|
52
|
+
// Replace global error handler with our own.
|
|
53
|
+
this.origOnerror = globalScope.onerror;
|
|
54
|
+
globalScope.onerror = this.onerrorHandler.bind(this);
|
|
58
55
|
globalScope.addEventListener('unhandledrejection', e => {
|
|
59
56
|
/** rejections can contain data of any type -- this is an effort to keep the message human readable */
|
|
60
57
|
const err = castReasonToError(e.reason);
|
|
@@ -87,6 +84,7 @@ export class Instrument extends InstrumentBase {
|
|
|
87
84
|
* @returns
|
|
88
85
|
*/
|
|
89
86
|
onerrorHandler(message, filename, lineno, column, errorObj) {
|
|
87
|
+
if (typeof this.origOnerror === 'function') this.origOnerror(...arguments);
|
|
90
88
|
try {
|
|
91
89
|
if (this.skipNext) this.skipNext -= 1;else notice(errorObj || new UncaughtException(message, filename, lineno), true, this.ee);
|
|
92
90
|
} catch (e) {
|
|
@@ -96,8 +94,7 @@ export class Instrument extends InstrumentBase {
|
|
|
96
94
|
// do nothing
|
|
97
95
|
}
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
return false;
|
|
97
|
+
return false; // maintain default behavior of the error event of Window
|
|
101
98
|
}
|
|
102
99
|
}
|
|
103
100
|
|
|
@@ -5,9 +5,9 @@ import { AggregateBase } from '../../utils/aggregate-base';
|
|
|
5
5
|
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL } from '../constants';
|
|
6
6
|
import { drain } from '../../../common/drain/drain';
|
|
7
7
|
import { getFrameworks } from '../../../common/metrics/framework-detection';
|
|
8
|
-
import {
|
|
8
|
+
import { isFileProtocol } from '../../../common/url/protocol';
|
|
9
9
|
import { getRules, validateRules } from '../../../common/util/obfuscate';
|
|
10
|
-
import { VERSION } from
|
|
10
|
+
import { VERSION } from "../../../common/constants/env.npm";
|
|
11
11
|
import { onDOMContentLoaded } from '../../../common/window/load';
|
|
12
12
|
import { windowAddEventListener } from '../../../common/event-listener/event-listener-opts';
|
|
13
13
|
import { isBrowserScope } from '../../../common/util/global-scope';
|
|
@@ -58,14 +58,14 @@ export class Aggregate extends AggregateBase {
|
|
|
58
58
|
singleChecks() {
|
|
59
59
|
// report generic info about the agent itself
|
|
60
60
|
// note the browser agent version
|
|
61
|
-
this.storeSupportabilityMetrics(
|
|
61
|
+
this.storeSupportabilityMetrics("Generic/Version/".concat(VERSION, "/Detected"));
|
|
62
62
|
// report loaderType
|
|
63
63
|
const {
|
|
64
64
|
distMethod,
|
|
65
65
|
loaderType
|
|
66
66
|
} = getRuntime(this.agentIdentifier);
|
|
67
|
-
if (loaderType) this.storeSupportabilityMetrics(
|
|
68
|
-
if (distMethod) this.storeSupportabilityMetrics(
|
|
67
|
+
if (loaderType) this.storeSupportabilityMetrics("Generic/LoaderType/".concat(loaderType, "/Detected"));
|
|
68
|
+
if (distMethod) this.storeSupportabilityMetrics("Generic/DistMethod/".concat(distMethod, "/Detected"));
|
|
69
69
|
|
|
70
70
|
// frameworks on page
|
|
71
71
|
if (isBrowserScope) {
|
|
@@ -77,9 +77,8 @@ export class Aggregate extends AggregateBase {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// file protocol detection
|
|
80
|
-
if (
|
|
80
|
+
if (isFileProtocol()) {
|
|
81
81
|
this.storeSupportabilityMetrics('Generic/FileProtocol/Detected');
|
|
82
|
-
protocol.supportabilityMetricSent = true;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
84
|
// obfuscation rules detection
|
|
@@ -103,6 +102,7 @@ export class Aggregate extends AggregateBase {
|
|
|
103
102
|
// TODO - these SMs are to be removed when we implement the actual resources feature
|
|
104
103
|
try {
|
|
105
104
|
if (this.resourcesSent) return;
|
|
105
|
+
const agentRuntime = getRuntime(this.agentIdentifier);
|
|
106
106
|
// make sure this only gets sent once
|
|
107
107
|
this.resourcesSent = true;
|
|
108
108
|
// differentiate between internal+external and ajax+non-ajax
|
|
@@ -122,6 +122,16 @@ export class Aggregate extends AggregateBase {
|
|
|
122
122
|
if (isAjax(entry)) this.storeSupportabilityMetrics('Generic/Resources/Ajax/External');else this.storeSupportabilityMetrics('Generic/Resources/Non-Ajax/External');
|
|
123
123
|
}
|
|
124
124
|
});
|
|
125
|
+
|
|
126
|
+
// Capture per-agent bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
|
|
127
|
+
Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
|
|
128
|
+
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/BytesSent"), agentRuntime.bytesSent[endpoint]);
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
|
|
132
|
+
if (agentRuntime.ptid) {
|
|
133
|
+
this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()));
|
|
134
|
+
}
|
|
125
135
|
} catch (e) {
|
|
126
136
|
// do nothing
|
|
127
137
|
}
|
|
@@ -5,7 +5,8 @@ import { handle } from '../../../common/event-emitter/handle';
|
|
|
5
5
|
import { FEATURE_NAMES } from '../../../loaders/features/features';
|
|
6
6
|
export class Instrument extends InstrumentBase {
|
|
7
7
|
static featureName = FEATURE_NAME;
|
|
8
|
-
constructor(agentIdentifier, aggregator
|
|
8
|
+
constructor(agentIdentifier, aggregator) {
|
|
9
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
9
10
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
10
11
|
insertSupportMetrics(tag => handle(SUPPORTABILITY_METRIC_CHANNEL, [tag], undefined, FEATURE_NAMES.metrics, this.ee));
|
|
11
12
|
this.importAggregator();
|