@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
|
@@ -15,16 +15,17 @@ describe('formatStackTrace', () => {
|
|
|
15
15
|
input: ['line 1', 'line 2', ''],
|
|
16
16
|
expected: 'line 1\nline 2',
|
|
17
17
|
title: 'Strips ending empty stack frame'
|
|
18
|
-
}])('$title',
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
}])('$title', _ref => {
|
|
19
|
+
let {
|
|
20
|
+
input,
|
|
21
|
+
expected
|
|
22
|
+
} = _ref;
|
|
22
23
|
const result = (0, _formatStackTrace.formatStackTrace)(input);
|
|
23
24
|
expect(result).toEqual(expected);
|
|
24
25
|
});
|
|
25
26
|
test('truncates the middle of the stack lines when more than 100', () => {
|
|
26
27
|
const input = Array.apply(null, Array(200)).map(() => _faker.faker.datatype.uuid());
|
|
27
|
-
const expected = input.slice(0, 50).join('\n') +
|
|
28
|
+
const expected = input.slice(0, 50).join('\n') + "\n< ...truncated ".concat(input.length - 100, " lines... >\n") + input.slice(-50).join('\n');
|
|
28
29
|
const result = (0, _formatStackTrace.formatStackTrace)(input);
|
|
29
30
|
expect(result).toEqual(expected);
|
|
30
31
|
});
|
|
@@ -21,7 +21,6 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
21
21
|
var _constants = require("../constants");
|
|
22
22
|
var _drain = require("../../../common/drain/drain");
|
|
23
23
|
var _features = require("../../../loaders/features/features");
|
|
24
|
-
var _load = require("../../../common/window/load");
|
|
25
24
|
/*
|
|
26
25
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
27
26
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -30,7 +29,9 @@ var _load = require("../../../common/window/load");
|
|
|
30
29
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
31
30
|
static featureName = _constants.FEATURE_NAME;
|
|
32
31
|
constructor(agentIdentifier, aggregator) {
|
|
32
|
+
var _this;
|
|
33
33
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
34
|
+
_this = this;
|
|
34
35
|
this.stackReported = {};
|
|
35
36
|
this.pageviewReported = {};
|
|
36
37
|
this.errorCache = {};
|
|
@@ -42,16 +43,24 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
42
43
|
|
|
43
44
|
// this will need to change to match whatever ee we use in the instrument
|
|
44
45
|
this.ee.on('interactionDiscarded', interaction => this.onInteractionDiscarded(interaction));
|
|
45
|
-
(0, _registerHandler.registerHandler)('err',
|
|
46
|
-
|
|
46
|
+
(0, _registerHandler.registerHandler)('err', function () {
|
|
47
|
+
return _this.storeError(...arguments);
|
|
48
|
+
}, this.featureName, this.ee);
|
|
49
|
+
(0, _registerHandler.registerHandler)('ierr', function () {
|
|
50
|
+
return _this.storeError(...arguments);
|
|
51
|
+
}, this.featureName, this.ee);
|
|
47
52
|
const harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'jserrors.harvestTimeSeconds') || 10;
|
|
48
53
|
const scheduler = new _harvestScheduler.HarvestScheduler('jserrors', {
|
|
49
|
-
onFinished: (
|
|
54
|
+
onFinished: function () {
|
|
55
|
+
return _this.onHarvestFinished(...arguments);
|
|
56
|
+
}
|
|
50
57
|
}, this);
|
|
51
|
-
scheduler.harvest.on('jserrors', (
|
|
58
|
+
scheduler.harvest.on('jserrors', function () {
|
|
59
|
+
return _this.onHarvestStarted(...arguments);
|
|
60
|
+
});
|
|
52
61
|
|
|
53
62
|
// Don't start harvesting until "drain" for this feat has been called (which currently requires RUM response).
|
|
54
|
-
this.ee.on(
|
|
63
|
+
this.ee.on("drain-".concat(this.featureName), () => {
|
|
55
64
|
if (!this.blocked) scheduler.startTimer(harvestTimeSeconds); // and only if ingest will accept jserror payloads
|
|
56
65
|
});
|
|
57
66
|
|
|
@@ -95,7 +104,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
106
|
nameHash(params) {
|
|
98
|
-
return (0, _stringHashCode.stringHashCode)(
|
|
107
|
+
return (0, _stringHashCode.stringHashCode)("".concat(params.exceptionClass, "_").concat(params.message, "_").concat(params.stack_trace || params.browser_stack_hash));
|
|
99
108
|
}
|
|
100
109
|
getBucketName(params, customParams) {
|
|
101
110
|
return this.nameHash(params) + ':' + (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(customParams));
|
|
@@ -147,17 +156,29 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
147
156
|
storeError(err, time, internal, customAttributes) {
|
|
148
157
|
// are we in an interaction
|
|
149
158
|
time = time || (0, _now.now)();
|
|
150
|
-
|
|
159
|
+
const agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
160
|
+
let filterOutput;
|
|
161
|
+
if (!internal && agentRuntime.onerror) {
|
|
162
|
+
filterOutput = agentRuntime.onerror(err);
|
|
163
|
+
if (filterOutput && !(typeof filterOutput.group === 'string' && filterOutput.group.length)) {
|
|
164
|
+
// All truthy values mean don't report (store) the error, per backwards-compatible usage,
|
|
165
|
+
// - EXCEPT if a fingerprinting label is returned, via an object with key of 'group' and value of non-empty string
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// Again as with previous usage, all falsey values would include the error.
|
|
169
|
+
}
|
|
170
|
+
|
|
151
171
|
var stackInfo = this.canonicalizeStackURLs((0, _computeStackTrace.computeStackTrace)(err));
|
|
152
172
|
var canonicalStack = this.buildCanonicalStackString(stackInfo);
|
|
153
|
-
|
|
173
|
+
const params = {
|
|
154
174
|
stackHash: (0, _stringHashCode.stringHashCode)(canonicalStack),
|
|
155
175
|
exceptionClass: stackInfo.name,
|
|
156
176
|
request_uri: _globalScope.globalScope?.location.pathname
|
|
157
177
|
};
|
|
158
|
-
if (stackInfo.message)
|
|
159
|
-
|
|
160
|
-
|
|
178
|
+
if (stackInfo.message) params.message = '' + stackInfo.message;
|
|
179
|
+
// 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).
|
|
180
|
+
// Do not modify the name ('errorGroup') of params without DEM approval!
|
|
181
|
+
if (filterOutput?.group) params.errorGroup = filterOutput.group;
|
|
161
182
|
|
|
162
183
|
/**
|
|
163
184
|
* The bucketHash is different from the params.stackHash because the params.stackHash is based on the canonicalized
|
|
@@ -165,14 +186,14 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
165
186
|
* the canonical stack trace excludes items like the column number increasing the hit-rate of different errors potentially
|
|
166
187
|
* bucketing and ultimately resulting in the loss of data in NR1.
|
|
167
188
|
*/
|
|
168
|
-
var bucketHash = (0, _stringHashCode.stringHashCode)(
|
|
189
|
+
var bucketHash = (0, _stringHashCode.stringHashCode)("".concat(stackInfo.name, "_").concat(stackInfo.message, "_").concat(stackInfo.stackString));
|
|
169
190
|
if (!this.stackReported[bucketHash]) {
|
|
170
191
|
this.stackReported[bucketHash] = true;
|
|
171
192
|
params.stack_trace = (0, _formatStackTrace.truncateSize)(stackInfo.stackString);
|
|
172
193
|
} else {
|
|
173
194
|
params.browser_stack_hash = (0, _stringHashCode.stringHashCode)(stackInfo.stackString);
|
|
174
195
|
}
|
|
175
|
-
params.releaseIds = (0, _stringify.stringify)(
|
|
196
|
+
params.releaseIds = (0, _stringify.stringify)(agentRuntime.releaseIds);
|
|
176
197
|
|
|
177
198
|
// When debugging stack canonicalization/hashing, uncomment these lines for
|
|
178
199
|
// more output in the test logs
|
|
@@ -17,10 +17,11 @@ test.each([{
|
|
|
17
17
|
input: 'lksjdflksjdf',
|
|
18
18
|
expected: 32668720,
|
|
19
19
|
title: 'Return valid hash of string'
|
|
20
|
-
}])('$title',
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}])('$title', _ref => {
|
|
21
|
+
let {
|
|
22
|
+
input,
|
|
23
|
+
expected
|
|
24
|
+
} = _ref;
|
|
24
25
|
const result = (0, _stringHashCode.stringHashCode)(input);
|
|
25
26
|
expect(result).toEqual(expected);
|
|
26
27
|
});
|
|
@@ -25,16 +25,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
|
|
26
26
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
27
27
|
static featureName = _constants.FEATURE_NAME;
|
|
28
|
-
constructor(agentIdentifier, aggregator
|
|
28
|
+
constructor(agentIdentifier, aggregator) {
|
|
29
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
29
30
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
30
31
|
// skipNext counter to keep track of uncaught
|
|
31
32
|
// errors that will be the same as caught errors.
|
|
32
33
|
this.skipNext = 0;
|
|
33
|
-
this.origOnerror = _globalScope.globalScope.onerror;
|
|
34
34
|
try {
|
|
35
|
+
// this try-catch can be removed when IE11 is completely unsupported & gone
|
|
35
36
|
this.removeOnAbort = new AbortController();
|
|
36
|
-
}
|
|
37
|
-
catch (e) {}
|
|
37
|
+
} catch (e) {}
|
|
38
38
|
const thisInstrument = this;
|
|
39
39
|
thisInstrument.ee.on('fn-start', function (args, obj, methodName) {
|
|
40
40
|
if (thisInstrument.abortHandler) thisInstrument.skipNext += 1;
|
|
@@ -56,12 +56,9 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
56
56
|
(0, _handle.handle)('ierr', [e, (0, _now.now)(), true], undefined, _features.FEATURE_NAMES.jserrors, thisInstrument.ee);
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
//
|
|
60
|
-
_globalScope.globalScope.onerror
|
|
61
|
-
|
|
62
|
-
this.onerrorHandler(...args);
|
|
63
|
-
return false;
|
|
64
|
-
};
|
|
59
|
+
// Replace global error handler with our own.
|
|
60
|
+
this.origOnerror = _globalScope.globalScope.onerror;
|
|
61
|
+
_globalScope.globalScope.onerror = this.onerrorHandler.bind(this);
|
|
65
62
|
_globalScope.globalScope.addEventListener('unhandledrejection', e => {
|
|
66
63
|
/** rejections can contain data of any type -- this is an effort to keep the message human readable */
|
|
67
64
|
const err = castReasonToError(e.reason);
|
|
@@ -94,6 +91,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
94
91
|
* @returns
|
|
95
92
|
*/
|
|
96
93
|
onerrorHandler(message, filename, lineno, column, errorObj) {
|
|
94
|
+
if (typeof this.origOnerror === 'function') this.origOnerror(...arguments);
|
|
97
95
|
try {
|
|
98
96
|
if (this.skipNext) this.skipNext -= 1;else notice(errorObj || new UncaughtException(message, filename, lineno), true, this.ee);
|
|
99
97
|
} catch (e) {
|
|
@@ -103,8 +101,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
103
101
|
// do nothing
|
|
104
102
|
}
|
|
105
103
|
}
|
|
106
|
-
|
|
107
|
-
return false;
|
|
104
|
+
return false; // maintain default behavior of the error event of Window
|
|
108
105
|
}
|
|
109
106
|
}
|
|
110
107
|
|
|
@@ -13,7 +13,7 @@ var _drain = require("../../../common/drain/drain");
|
|
|
13
13
|
var _frameworkDetection = require("../../../common/metrics/framework-detection");
|
|
14
14
|
var _protocol = require("../../../common/url/protocol");
|
|
15
15
|
var _obfuscate = require("../../../common/util/obfuscate");
|
|
16
|
-
var
|
|
16
|
+
var _env = require("../../../common/constants/env.npm");
|
|
17
17
|
var _load = require("../../../common/window/load");
|
|
18
18
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
19
19
|
var _globalScope = require("../../../common/util/global-scope");
|
|
@@ -64,14 +64,14 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
64
64
|
singleChecks() {
|
|
65
65
|
// report generic info about the agent itself
|
|
66
66
|
// note the browser agent version
|
|
67
|
-
this.storeSupportabilityMetrics(
|
|
67
|
+
this.storeSupportabilityMetrics("Generic/Version/".concat(_env.VERSION, "/Detected"));
|
|
68
68
|
// report loaderType
|
|
69
69
|
const {
|
|
70
70
|
distMethod,
|
|
71
71
|
loaderType
|
|
72
72
|
} = (0, _config.getRuntime)(this.agentIdentifier);
|
|
73
|
-
if (loaderType) this.storeSupportabilityMetrics(
|
|
74
|
-
if (distMethod) this.storeSupportabilityMetrics(
|
|
73
|
+
if (loaderType) this.storeSupportabilityMetrics("Generic/LoaderType/".concat(loaderType, "/Detected"));
|
|
74
|
+
if (distMethod) this.storeSupportabilityMetrics("Generic/DistMethod/".concat(distMethod, "/Detected"));
|
|
75
75
|
|
|
76
76
|
// frameworks on page
|
|
77
77
|
if (_globalScope.isBrowserScope) {
|
|
@@ -83,9 +83,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
// file protocol detection
|
|
86
|
-
if (_protocol.
|
|
86
|
+
if ((0, _protocol.isFileProtocol)()) {
|
|
87
87
|
this.storeSupportabilityMetrics('Generic/FileProtocol/Detected');
|
|
88
|
-
_protocol.protocol.supportabilityMetricSent = true;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
// obfuscation rules detection
|
|
@@ -109,6 +108,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
109
108
|
// TODO - these SMs are to be removed when we implement the actual resources feature
|
|
110
109
|
try {
|
|
111
110
|
if (this.resourcesSent) return;
|
|
111
|
+
const agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
112
112
|
// make sure this only gets sent once
|
|
113
113
|
this.resourcesSent = true;
|
|
114
114
|
// differentiate between internal+external and ajax+non-ajax
|
|
@@ -128,6 +128,16 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
128
128
|
if (isAjax(entry)) this.storeSupportabilityMetrics('Generic/Resources/Ajax/External');else this.storeSupportabilityMetrics('Generic/Resources/Non-Ajax/External');
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
|
+
|
|
132
|
+
// Capture per-agent bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
|
|
133
|
+
Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
|
|
134
|
+
this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/BytesSent"), agentRuntime.bytesSent[endpoint]);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
|
|
138
|
+
if (agentRuntime.ptid) {
|
|
139
|
+
this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()));
|
|
140
|
+
}
|
|
131
141
|
} catch (e) {
|
|
132
142
|
// do nothing
|
|
133
143
|
}
|
|
@@ -11,7 +11,8 @@ var _handle = require("../../../common/event-emitter/handle");
|
|
|
11
11
|
var _features = require("../../../loaders/features/features");
|
|
12
12
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
13
13
|
static featureName = _constants.FEATURE_NAME;
|
|
14
|
-
constructor(agentIdentifier, aggregator
|
|
14
|
+
constructor(agentIdentifier, aggregator) {
|
|
15
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
15
16
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
16
17
|
(0, _workersHelper.insertSupportMetrics)(tag => (0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, [tag], undefined, _features.FEATURE_NAMES.metrics, this.ee));
|
|
17
18
|
this.importAggregator();
|
|
@@ -94,7 +94,10 @@ function insertSupportMetrics(report) {
|
|
|
94
94
|
* @returns Refer to ServiceWorkerContainer.register()
|
|
95
95
|
*/
|
|
96
96
|
function extendServiceCreation(origFunc) {
|
|
97
|
-
return (
|
|
97
|
+
return function () {
|
|
98
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
99
|
+
args[_key] = arguments[_key];
|
|
100
|
+
}
|
|
98
101
|
reportWorkerCreationAttempt('Service', args[1]?.type);
|
|
99
102
|
return origFunc.apply(navigator.serviceWorker, args); // register() has to be rebound to the ServiceWorkerContainer object
|
|
100
103
|
};
|
|
@@ -104,18 +107,18 @@ function insertSupportMetrics(report) {
|
|
|
104
107
|
function reportUnavailable(workerType) {
|
|
105
108
|
if (_globalScope.isWorkerScope) return; // assume that the main browser window has already reported unsupported worker APIs (once per page life);
|
|
106
109
|
// on top of that, not all workers are available inside a certain worker per se--e.g. no sharedWorker() inside Worker
|
|
107
|
-
report(
|
|
110
|
+
report("Workers/".concat(workerType, "/Unavailable"));
|
|
108
111
|
}
|
|
109
112
|
function reportWorkerCreationAttempt(workerType, optionType) {
|
|
110
113
|
if (optionType === 'module') {
|
|
111
|
-
report(
|
|
114
|
+
report("Workers/".concat(workerType, "/Module"));
|
|
112
115
|
} else {
|
|
113
|
-
report(
|
|
116
|
+
report("Workers/".concat(workerType, "/Classic"));
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
function handleInsertionError(e, workerType) {
|
|
117
120
|
// indicates the browser version doesn't support how code is injected, such as Proxy API
|
|
118
|
-
report(
|
|
119
|
-
(0, _console.warn)(
|
|
121
|
+
report("Workers/".concat(workerType, "/SM/Unsupported")); // expected to be niche & for older borderline-ES6 browser versions
|
|
122
|
+
(0, _console.warn)("NR Agent: Unable to capture ".concat(workerType, " workers."), e);
|
|
120
123
|
}
|
|
121
124
|
}
|
|
@@ -22,7 +22,9 @@ var _globalScope = require("../../../common/util/global-scope");
|
|
|
22
22
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
23
23
|
static featureName = _constants.FEATURE_NAME;
|
|
24
24
|
constructor(agentIdentifier, aggregator) {
|
|
25
|
+
var _this;
|
|
25
26
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
27
|
+
_this = this;
|
|
26
28
|
this.eventsPerMinute = 240;
|
|
27
29
|
this.harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_action.harvestTimeSeconds') || (0, _config.getConfigurationValue)(this.agentIdentifier, 'ins.harvestTimeSeconds') || 30;
|
|
28
30
|
this.eventsPerHarvest = this.eventsPerMinute * this.harvestTimeSeconds / 60;
|
|
@@ -32,12 +34,18 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
32
34
|
this.att = (0, _config.getInfo)(this.agentIdentifier).jsAttributes; // per-agent, aggregators-shared info context
|
|
33
35
|
|
|
34
36
|
if (_globalScope.isBrowserScope && document.referrer) this.referrerUrl = (0, _cleanUrl.cleanURL)(document.referrer);
|
|
35
|
-
(0, _registerHandler.registerHandler)('api-addPageAction',
|
|
37
|
+
(0, _registerHandler.registerHandler)('api-addPageAction', function () {
|
|
38
|
+
return _this.addPageAction(...arguments);
|
|
39
|
+
}, this.featureName, this.ee);
|
|
36
40
|
var scheduler = new _harvestScheduler.HarvestScheduler('ins', {
|
|
37
|
-
onFinished: (
|
|
41
|
+
onFinished: function () {
|
|
42
|
+
return _this.onHarvestFinished(...arguments);
|
|
43
|
+
}
|
|
38
44
|
}, this);
|
|
39
|
-
scheduler.harvest.on('ins', (
|
|
40
|
-
|
|
45
|
+
scheduler.harvest.on('ins', function () {
|
|
46
|
+
return _this.onHarvestStarted(...arguments);
|
|
47
|
+
});
|
|
48
|
+
this.ee.on("drain-".concat(this.featureName), () => {
|
|
41
49
|
if (!this.blocked) scheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
42
50
|
});
|
|
43
51
|
|
|
@@ -13,7 +13,8 @@ var _constants = require("../constants");
|
|
|
13
13
|
|
|
14
14
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
15
15
|
static featureName = _constants.FEATURE_NAME;
|
|
16
|
-
constructor(agentIdentifier, aggregator
|
|
16
|
+
constructor(agentIdentifier, aggregator) {
|
|
17
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
17
18
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
18
19
|
this.importAggregator();
|
|
19
20
|
}
|
|
@@ -34,10 +34,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
34
34
|
|
|
35
35
|
/* Time To First Byte
|
|
36
36
|
This listener must record these values *before* PVE's aggregate sends RUM. */
|
|
37
|
-
(0, _webVitals.onTTFB)(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
(0, _webVitals.onTTFB)(_ref => {
|
|
38
|
+
let {
|
|
39
|
+
value,
|
|
40
|
+
entries
|
|
41
|
+
} = _ref;
|
|
41
42
|
if (this.alreadySent) return;
|
|
42
43
|
this.alreadySent = true;
|
|
43
44
|
agentRuntime[CONSTANTS.TTFB] = Math.round(value); // this is our "backend" duration; web-vitals will ensure it's lower bounded at 0
|
|
@@ -98,12 +99,23 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
98
99
|
chunksForQueryString.push((0, _encode.param)('ac', info.account));
|
|
99
100
|
chunksForQueryString.push((0, _encode.param)('pr', info.product));
|
|
100
101
|
chunksForQueryString.push((0, _encode.param)('af', (0, _initializedFeatures.getActivatedFeaturesFlags)(this.agentIdentifier).join(',')));
|
|
101
|
-
if (_globalScope.globalScope.performance
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
102
|
+
if (_globalScope.globalScope.performance) {
|
|
103
|
+
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
104
|
+
// Navigation Timing level 2 API that replaced PerformanceTiming & PerformanceNavigation
|
|
105
|
+
const navTimingEntry = _globalScope.globalScope?.performance?.getEntriesByType('navigation')?.[0];
|
|
106
|
+
const perf = {
|
|
107
|
+
timing: (0, _navTiming.addPT)(agentRuntime.offset, navTimingEntry, {}),
|
|
108
|
+
navigation: (0, _navTiming.addPN)(navTimingEntry, {})
|
|
109
|
+
};
|
|
110
|
+
chunksForQueryString.push((0, _encode.param)('perf', (0, _stringify.stringify)(perf)));
|
|
111
|
+
} else if (typeof PerformanceTiming !== 'undefined') {
|
|
112
|
+
// Safari pre-15 did not support level 2 timing
|
|
113
|
+
const perf = {
|
|
114
|
+
timing: (0, _navTiming.addPT)(agentRuntime.offset, _globalScope.globalScope.performance.timing, {}, true),
|
|
115
|
+
navigation: (0, _navTiming.addPN)(_globalScope.globalScope.performance.navigation, {})
|
|
116
|
+
};
|
|
117
|
+
chunksForQueryString.push((0, _encode.param)('perf', (0, _stringify.stringify)(perf)));
|
|
118
|
+
}
|
|
107
119
|
}
|
|
108
120
|
try {
|
|
109
121
|
// PVTiming sends these too, albeit using web-vitals and slightly different; it's unknown why they're duplicated, but PVT should be the truth
|
|
@@ -124,6 +136,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
124
136
|
var customJsAttributes = (0, _stringify.stringify)(info.jsAttributes);
|
|
125
137
|
chunksForQueryString.push((0, _encode.param)('ja', customJsAttributes === '{}' ? null : customJsAttributes));
|
|
126
138
|
var queryString = (0, _encode.fromArray)(chunksForQueryString, agentRuntime.maxBytes);
|
|
139
|
+
|
|
140
|
+
// Capture bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
|
|
141
|
+
agentRuntime.bytesSent[protocol] = (agentRuntime.bytesSent[protocol] || 0) + queryString?.length || 0;
|
|
127
142
|
const isValidJsonp = _submitData.submitData.jsonp(this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + queryString, jsonp);
|
|
128
143
|
// Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
|
|
129
144
|
// ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
|
|
@@ -16,7 +16,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
17
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
18
18
|
static featureName = CONSTANTS.FEATURE_NAME;
|
|
19
|
-
constructor(agentIdentifier, aggregator
|
|
19
|
+
constructor(agentIdentifier, aggregator) {
|
|
20
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
20
21
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
21
22
|
if ((typeof PerformanceNavigationTiming === 'undefined' || _iosVersion.isiOS) && typeof PerformanceTiming !== 'undefined') {
|
|
22
23
|
// For majority browser versions in which PNT exists, we can get load timings later from the nav entry (in the aggregate portion). At minimum, PT should exist for main window.
|