@newrelic/browser-agent 0.0.9 → 0.1.230
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 +113 -197
- package/dist/cjs/cdn/lite.js +14 -0
- package/dist/cjs/cdn/polyfills/lite.js +4 -0
- package/dist/cjs/cdn/polyfills/pro.js +4 -0
- package/dist/cjs/cdn/polyfills/spa.js +4 -0
- package/dist/cjs/cdn/polyfills.js +14 -0
- package/dist/cjs/cdn/pro.js +19 -0
- package/dist/cjs/cdn/spa.js +19 -0
- package/dist/cjs/cdn/worker.js +16 -0
- package/dist/cjs/common/aggregate/aggregator.js +168 -0
- package/dist/cjs/common/browser-version/firefox-version.js +17 -0
- package/dist/cjs/common/browser-version/ios-version.js +18 -0
- package/dist/cjs/common/config/config.js +76 -0
- package/dist/cjs/common/config/state/configurable.js +33 -0
- package/dist/cjs/common/config/state/info.js +50 -0
- package/dist/cjs/common/config/state/init.js +86 -0
- package/dist/cjs/common/config/state/loader-config.js +28 -0
- package/dist/cjs/common/config/state/originals.js +9 -0
- package/dist/cjs/common/config/state/runtime.js +51 -0
- package/dist/cjs/common/constants/environment-variables.js +20 -0
- package/dist/cjs/common/context/shared-context.js +26 -0
- package/dist/cjs/common/deny-list/deny-list.js +108 -0
- package/dist/cjs/common/drain/drain.js +132 -0
- package/dist/cjs/common/event-emitter/contextual-ee.js +149 -0
- package/dist/cjs/common/event-emitter/handle.js +24 -0
- package/dist/cjs/common/event-emitter/register-handler.js +24 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +48 -0
- package/dist/cjs/common/harvest/harvest-scheduler.js +112 -0
- package/dist/cjs/common/harvest/harvest.js +247 -0
- package/dist/cjs/common/ids/id.js +30 -0
- package/dist/cjs/common/ids/unique-id.js +84 -0
- package/dist/cjs/common/metrics/framework-detection.js +72 -0
- package/dist/cjs/common/metrics/paint-metrics.js +13 -0
- package/dist/cjs/common/serialize/bel-serializer.js +89 -0
- package/dist/cjs/common/timing/nav-timing.js +77 -0
- package/dist/cjs/common/timing/now.js +15 -0
- package/dist/cjs/common/unload/eol.js +69 -0
- package/dist/cjs/common/url/clean-url.js +16 -0
- package/dist/cjs/common/url/encode.js +79 -0
- package/dist/cjs/common/url/location.js +14 -0
- package/dist/cjs/common/url/parse-url.js +66 -0
- package/dist/cjs/common/url/protocol.js +25 -0
- package/dist/cjs/common/util/console.js +17 -0
- package/dist/cjs/common/util/data-size.js +25 -0
- package/dist/cjs/common/util/feature-flags.js +42 -0
- package/dist/cjs/common/util/get-or-set.js +39 -0
- package/dist/cjs/common/util/global-scope.js +56 -0
- package/dist/cjs/common/util/map-own.js +31 -0
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +76 -0
- package/dist/cjs/common/util/s-hash.js +19 -0
- package/dist/cjs/common/util/single.js +23 -0
- package/dist/cjs/common/util/stringify.js +47 -0
- package/dist/cjs/common/util/submit-data.js +107 -0
- package/dist/cjs/common/util/traverse.js +41 -0
- package/dist/cjs/common/util/user-agent.js +57 -0
- package/dist/cjs/common/window/load.js +19 -0
- package/dist/cjs/common/window/nreum.js +107 -0
- package/dist/cjs/common/window/page-visibility.js +29 -0
- package/dist/cjs/common/window/session-storage.js +87 -0
- package/dist/cjs/common/window/supports-performance-observer.js +15 -0
- package/dist/cjs/common/wrap/index.js +75 -0
- package/dist/cjs/common/wrap/wrap-console.js +54 -0
- package/dist/cjs/common/wrap/wrap-events.js +108 -0
- package/dist/cjs/common/wrap/wrap-fetch.js +112 -0
- package/dist/cjs/common/wrap/wrap-function.js +255 -0
- package/dist/cjs/common/wrap/wrap-history.js +56 -0
- package/dist/cjs/common/wrap/wrap-jsonp.js +129 -0
- package/dist/cjs/common/wrap/wrap-mutation.js +61 -0
- package/dist/cjs/common/wrap/wrap-promise.js +163 -0
- package/dist/cjs/common/wrap/wrap-raf.js +55 -0
- package/dist/cjs/common/wrap/wrap-timer.js +70 -0
- package/dist/cjs/common/wrap/wrap-xhr.js +206 -0
- package/dist/cjs/features/ajax/aggregate/index.js +226 -0
- package/dist/cjs/features/ajax/constants.js +9 -0
- package/dist/cjs/features/ajax/index.js +12 -0
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +145 -0
- package/dist/cjs/features/ajax/instrument/index.js +339 -0
- package/dist/cjs/features/ajax/instrument/response-size.js +26 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +18 -0
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +31 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +215 -0
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +257 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.js +36 -0
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +40 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +288 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.js +23 -0
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +27 -0
- package/dist/cjs/features/jserrors/constants.js +11 -0
- package/dist/cjs/features/jserrors/index.js +12 -0
- package/dist/cjs/features/jserrors/instrument/debug.js +40 -0
- package/dist/cjs/features/jserrors/instrument/index.js +155 -0
- package/dist/cjs/features/metrics/aggregate/index.js +147 -0
- package/dist/cjs/features/metrics/constants.js +17 -0
- package/dist/cjs/features/metrics/index.js +12 -0
- package/dist/cjs/features/metrics/instrument/index.js +46 -0
- package/dist/cjs/features/metrics/instrument/workers-helper.js +124 -0
- package/dist/cjs/features/page_action/aggregate/index.js +120 -0
- package/dist/cjs/features/page_action/constants.js +9 -0
- package/dist/cjs/features/page_action/index.js +12 -0
- package/dist/cjs/features/page_action/instrument/index.js +22 -0
- package/dist/cjs/features/page_view_event/aggregate/index.js +137 -0
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +39 -0
- package/dist/cjs/features/page_view_event/constants.js +15 -0
- package/dist/cjs/features/page_view_event/index.js +12 -0
- package/dist/cjs/features/page_view_event/instrument/index.js +39 -0
- package/dist/cjs/features/page_view_timing/aggregate/index.js +284 -0
- package/dist/cjs/features/page_view_timing/constants.js +9 -0
- package/dist/cjs/features/page_view_timing/first-paint.js +50 -0
- package/dist/cjs/features/page_view_timing/index.js +12 -0
- package/dist/cjs/features/page_view_timing/instrument/index.js +37 -0
- package/dist/cjs/features/page_view_timing/long-tasks.js +75 -0
- package/dist/cjs/features/session_trace/aggregate/index.js +415 -0
- package/dist/cjs/features/session_trace/constants.js +32 -0
- package/dist/cjs/features/session_trace/index.js +12 -0
- package/dist/cjs/features/session_trace/instrument/index.js +134 -0
- package/dist/cjs/features/spa/aggregate/index.js +684 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.js +84 -0
- package/dist/cjs/features/spa/aggregate/interaction-node.test.js +16 -0
- package/dist/cjs/features/spa/aggregate/interaction.js +98 -0
- package/dist/cjs/features/spa/aggregate/serializer.js +147 -0
- package/dist/cjs/features/spa/constants.js +53 -0
- package/dist/cjs/features/spa/index.js +12 -0
- package/dist/cjs/features/spa/instrument/index.js +115 -0
- package/dist/cjs/features/utils/aggregate-base.js +13 -0
- package/dist/cjs/features/utils/feature-base.js +58 -0
- package/dist/cjs/features/utils/handler-cache.js +64 -0
- package/dist/cjs/features/utils/instrument-base.js +72 -0
- package/dist/cjs/features/utils/lazy-loader.js +44 -0
- package/dist/cjs/index.js +81 -58
- package/dist/cjs/loaders/agent.js +87 -0
- package/dist/cjs/loaders/api/api.js +174 -0
- package/dist/cjs/loaders/api/apiAsync.js +94 -0
- package/dist/cjs/loaders/browser-agent.js +29 -0
- package/dist/cjs/loaders/configure/configure.js +53 -0
- package/dist/cjs/loaders/features/enabled-features.js +19 -0
- package/dist/cjs/loaders/features/featureDependencies.js +32 -0
- package/dist/cjs/loaders/features/features.js +33 -0
- package/dist/cjs/loaders/micro-agent.js +98 -0
- package/dist/cjs/loaders/worker-agent.js +24 -0
- package/dist/esm/cdn/lite.js +12 -0
- package/dist/esm/cdn/polyfills/lite.js +7 -0
- package/dist/esm/cdn/polyfills/pro.js +7 -0
- package/dist/esm/cdn/polyfills/spa.js +7 -0
- package/dist/esm/cdn/polyfills.js +17 -0
- package/dist/esm/cdn/pro.js +17 -0
- package/dist/esm/cdn/spa.js +17 -0
- package/dist/esm/cdn/worker.js +14 -0
- package/dist/esm/common/aggregate/aggregator.js +161 -0
- package/dist/esm/common/browser-version/firefox-version.js +10 -0
- package/dist/esm/common/browser-version/ios-version.js +10 -0
- package/dist/esm/common/config/config.js +11 -0
- package/dist/esm/common/config/state/configurable.js +26 -0
- package/dist/esm/common/config/state/info.js +42 -0
- package/dist/esm/common/config/state/init.js +78 -0
- package/dist/esm/common/config/state/loader-config.js +21 -0
- package/dist/esm/common/config/state/originals.js +2 -0
- package/dist/esm/common/config/state/runtime.js +42 -0
- package/dist/esm/common/constants/environment-variables.js +11 -0
- package/dist/esm/common/context/shared-context.js +19 -0
- package/dist/esm/common/deny-list/deny-list.js +101 -0
- package/dist/esm/common/drain/drain.js +125 -0
- package/dist/esm/common/event-emitter/contextual-ee.js +142 -0
- package/dist/esm/common/event-emitter/handle.js +16 -0
- package/dist/esm/common/event-emitter/register-handler.js +19 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +41 -0
- package/dist/esm/common/harvest/harvest-scheduler.js +106 -0
- package/dist/esm/common/harvest/harvest.js +239 -0
- package/dist/esm/common/ids/id.js +23 -0
- package/dist/esm/common/ids/unique-id.js +75 -0
- package/dist/esm/common/metrics/framework-detection.js +66 -0
- package/dist/esm/common/metrics/paint-metrics.js +6 -0
- package/dist/esm/common/serialize/bel-serializer.js +80 -0
- package/dist/esm/common/timing/nav-timing.js +67 -0
- package/dist/esm/common/timing/now.js +9 -0
- package/dist/esm/common/unload/eol.js +62 -0
- package/dist/esm/common/url/clean-url.js +10 -0
- package/dist/esm/common/url/encode.js +71 -0
- package/dist/esm/common/url/location.js +8 -0
- package/dist/esm/common/url/parse-url.js +60 -0
- package/dist/esm/common/url/protocol.js +17 -0
- package/dist/esm/common/util/console.js +11 -0
- package/dist/esm/common/util/data-size.js +19 -0
- package/dist/esm/common/util/feature-flags.js +33 -0
- package/dist/esm/common/util/get-or-set.js +33 -0
- package/dist/esm/common/util/global-scope.js +44 -0
- package/dist/esm/common/util/map-own.js +24 -0
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +67 -0
- package/dist/esm/common/util/s-hash.js +13 -0
- package/dist/esm/common/util/single.js +16 -0
- package/dist/esm/common/util/stringify.js +42 -0
- package/dist/esm/common/util/submit-data.js +99 -0
- package/dist/esm/common/util/traverse.js +35 -0
- package/dist/esm/common/util/user-agent.js +48 -0
- package/dist/esm/common/window/load.js +12 -0
- package/dist/esm/common/window/nreum.js +91 -0
- package/dist/esm/common/window/page-visibility.js +24 -0
- package/dist/esm/common/window/session-storage.js +77 -0
- package/dist/esm/common/window/supports-performance-observer.js +9 -0
- package/dist/esm/common/wrap/index.js +15 -0
- package/dist/esm/common/wrap/wrap-console.js +46 -0
- package/dist/esm/common/wrap/wrap-events.js +100 -0
- package/dist/esm/common/wrap/wrap-fetch.js +103 -0
- package/dist/esm/common/wrap/wrap-function.js +244 -0
- package/dist/esm/common/wrap/wrap-history.js +48 -0
- package/dist/esm/common/wrap/wrap-jsonp.js +122 -0
- package/dist/esm/common/wrap/wrap-mutation.js +54 -0
- package/dist/esm/common/wrap/wrap-promise.js +156 -0
- package/dist/esm/common/wrap/wrap-raf.js +48 -0
- package/dist/esm/common/wrap/wrap-timer.js +63 -0
- package/dist/esm/common/wrap/wrap-xhr.js +199 -0
- package/dist/esm/features/ajax/aggregate/index.js +218 -0
- package/dist/esm/features/ajax/constants.js +2 -0
- package/dist/esm/features/ajax/index.js +1 -0
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +137 -0
- package/dist/esm/features/ajax/instrument/index.js +331 -0
- package/dist/esm/features/ajax/instrument/response-size.js +19 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -0
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +29 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +208 -0
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +255 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.js +29 -0
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +38 -0
- package/dist/esm/features/jserrors/aggregate/index.js +281 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +25 -0
- package/dist/esm/features/jserrors/constants.js +3 -0
- package/dist/esm/features/jserrors/index.js +1 -0
- package/dist/esm/features/jserrors/instrument/debug.js +38 -0
- package/dist/esm/features/jserrors/instrument/index.js +147 -0
- package/dist/esm/features/metrics/aggregate/index.js +140 -0
- package/dist/esm/features/metrics/constants.js +6 -0
- package/dist/esm/features/metrics/index.js +1 -0
- package/dist/esm/features/metrics/instrument/index.js +39 -0
- package/dist/esm/features/metrics/instrument/workers-helper.js +119 -0
- package/dist/esm/features/page_action/aggregate/index.js +113 -0
- package/dist/esm/features/page_action/constants.js +2 -0
- package/dist/esm/features/page_action/index.js +1 -0
- package/dist/esm/features/page_action/instrument/index.js +15 -0
- package/dist/esm/features/page_view_event/aggregate/index.js +128 -0
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +34 -0
- package/dist/esm/features/page_view_event/constants.js +5 -0
- package/dist/esm/features/page_view_event/index.js +1 -0
- package/dist/esm/features/page_view_event/instrument/index.js +30 -0
- package/dist/esm/features/page_view_timing/aggregate/index.js +277 -0
- package/dist/esm/features/page_view_timing/constants.js +2 -0
- package/dist/esm/features/page_view_timing/first-paint.js +43 -0
- package/dist/esm/features/page_view_timing/index.js +1 -0
- package/dist/esm/features/page_view_timing/instrument/index.js +29 -0
- package/dist/esm/features/page_view_timing/long-tasks.js +69 -0
- package/dist/esm/features/session_trace/aggregate/index.js +406 -0
- package/dist/esm/features/session_trace/constants.js +14 -0
- package/dist/esm/features/session_trace/index.js +1 -0
- package/dist/esm/features/session_trace/instrument/index.js +124 -0
- package/dist/esm/features/spa/aggregate/index.js +674 -0
- package/dist/esm/features/spa/aggregate/interaction-node.js +78 -0
- package/dist/esm/features/spa/aggregate/interaction-node.test.js +14 -0
- package/dist/esm/features/spa/aggregate/interaction.js +92 -0
- package/dist/esm/features/spa/aggregate/serializer.js +139 -0
- package/dist/esm/features/spa/constants.js +25 -0
- package/dist/esm/features/spa/index.js +1 -0
- package/dist/esm/features/spa/instrument/index.js +105 -0
- package/dist/esm/features/utils/aggregate-base.js +6 -0
- package/dist/esm/features/utils/feature-base.js +51 -0
- package/dist/esm/features/utils/handler-cache.js +57 -0
- package/dist/esm/features/utils/instrument-base.js +70 -0
- package/dist/esm/features/utils/lazy-loader.js +37 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/loaders/agent.js +78 -0
- package/dist/esm/loaders/api/api.js +168 -0
- package/dist/esm/loaders/api/apiAsync.js +88 -0
- package/dist/esm/loaders/browser-agent.js +23 -0
- package/dist/esm/loaders/configure/configure.js +47 -0
- package/dist/esm/loaders/features/enabled-features.js +13 -0
- package/dist/esm/loaders/features/featureDependencies.js +25 -0
- package/dist/esm/loaders/features/features.js +25 -0
- package/dist/esm/loaders/micro-agent.js +91 -0
- package/dist/esm/loaders/worker-agent.js +18 -0
- 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/environment-variables.d.ts +4 -0
- package/dist/types/common/constants/environment-variables.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 +2 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +5 -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 +5 -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 +2 -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 +7 -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 +12 -0
- package/dist/types/common/wrap/index.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-console.d.ts +16 -0
- package/dist/types/common/wrap/wrap-console.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 +7 -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 +33 -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 +231 -69
- 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 +10 -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 +45 -0
- package/src/common/constants/environment-variables.js +11 -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/handle.js +17 -0
- package/src/common/event-emitter/register-handler.js +25 -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 +23 -0
- package/src/common/ids/unique-id.js +81 -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 +70 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +63 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/location.js +8 -0
- package/src/common/url/parse-url.js +71 -0
- package/src/common/url/protocol.js +19 -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 +48 -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 +18 -0
- package/src/common/wrap/wrap-console.js +47 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +109 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +48 -0
- package/src/common/wrap/wrap-jsonp.js +134 -0
- package/src/common/wrap/wrap-mutation.js +55 -0
- package/src/common/wrap/wrap-promise.js +165 -0
- package/src/common/wrap/wrap-raf.js +50 -0
- package/src/common/wrap/wrap-timer.js +67 -0
- package/src/common/wrap/wrap-xhr.js +213 -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 +149 -0
- package/src/features/metrics/aggregate/index.js +134 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +44 -0
- package/src/features/metrics/instrument/workers-helper.js +110 -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 +134 -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 +246 -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 +410 -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 +126 -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 +112 -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/bundled/es5/index.js +0 -2
- package/dist/bundled/es5/index.js.map +0 -1
- package/dist/bundled/es6/index.js +0 -2
- package/dist/bundled/es6/index.js.map +0 -1
- package/dist/cjs/index.d.ts +0 -19
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/types.d.ts +0 -94
- package/dist/cjs/types.js +0 -28
- package/dist/cjs/types.js.map +0 -1
- package/dist/cjs/utils/api/api.d.ts +0 -10
- package/dist/cjs/utils/api/api.js +0 -40
- package/dist/cjs/utils/api/api.js.map +0 -1
- package/dist/cjs/utils/config/build-configs.d.ts +0 -6
- package/dist/cjs/utils/config/build-configs.js +0 -68
- package/dist/cjs/utils/config/build-configs.js.map +0 -1
- package/dist/cjs/utils/features/features.d.ts +0 -5
- package/dist/cjs/utils/features/features.js +0 -14
- package/dist/cjs/utils/features/features.js.map +0 -1
- package/dist/cjs/utils/features/initialize.d.ts +0 -5
- package/dist/cjs/utils/features/initialize.js +0 -51
- package/dist/cjs/utils/features/initialize.js.map +0 -1
- package/dist/es/index.d.ts +0 -19
- package/dist/es/index.js +0 -55
- package/dist/es/index.js.map +0 -1
- package/dist/es/types.d.ts +0 -94
- package/dist/es/types.js +0 -24
- package/dist/es/types.js.map +0 -1
- package/dist/es/utils/api/api.d.ts +0 -10
- package/dist/es/utils/api/api.js +0 -36
- package/dist/es/utils/api/api.js.map +0 -1
- package/dist/es/utils/config/build-configs.d.ts +0 -6
- package/dist/es/utils/config/build-configs.js +0 -64
- package/dist/es/utils/config/build-configs.js.map +0 -1
- package/dist/es/utils/features/features.d.ts +0 -5
- package/dist/es/utils/features/features.js +0 -10
- package/dist/es/utils/features/features.js.map +0 -1
- package/dist/es/utils/features/initialize.d.ts +0 -5
- package/dist/es/utils/features/initialize.js +0 -24
- package/dist/es/utils/features/initialize.js.map +0 -1
- package/dist/umd/index.d.ts +0 -19
- package/dist/umd/index.js +0 -69
- package/dist/umd/index.js.map +0 -1
- package/dist/umd/types.d.ts +0 -94
- package/dist/umd/types.js +0 -38
- package/dist/umd/types.js.map +0 -1
- package/dist/umd/utils/api/api.d.ts +0 -10
- package/dist/umd/utils/api/api.js +0 -50
- package/dist/umd/utils/api/api.js.map +0 -1
- package/dist/umd/utils/config/build-configs.d.ts +0 -6
- package/dist/umd/utils/config/build-configs.js +0 -78
- package/dist/umd/utils/config/build-configs.js.map +0 -1
- package/dist/umd/utils/features/features.d.ts +0 -5
- package/dist/umd/utils/features/features.js +0 -24
- package/dist/umd/utils/features/features.js.map +0 -1
- package/dist/umd/utils/features/initialize.d.ts +0 -5
- package/dist/umd/utils/features/initialize.js +0 -63
- package/dist/umd/utils/features/initialize.js.map +0 -1
- package/dist/webpack-analysis.html +0 -38
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { canonicalFunctionName } from './canonical-function-name'
|
|
7
|
+
import { cleanURL } from '../../../common/url/clean-url'
|
|
8
|
+
import { computeStackTrace } from './compute-stack-trace'
|
|
9
|
+
import { stringHashCode } from './string-hash-code'
|
|
10
|
+
import { truncateSize } from './format-stack-trace'
|
|
11
|
+
|
|
12
|
+
import { registerHandler as register } from '../../../common/event-emitter/register-handler'
|
|
13
|
+
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler'
|
|
14
|
+
import { stringify } from '../../../common/util/stringify'
|
|
15
|
+
import { handle } from '../../../common/event-emitter/handle'
|
|
16
|
+
import { mapOwn } from '../../../common/util/map-own'
|
|
17
|
+
import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config'
|
|
18
|
+
import { now } from '../../../common/timing/now'
|
|
19
|
+
import { globalScope } from '../../../common/util/global-scope'
|
|
20
|
+
|
|
21
|
+
import { AggregateBase } from '../../utils/aggregate-base'
|
|
22
|
+
import { FEATURE_NAME } from '../constants'
|
|
23
|
+
import { drain } from '../../../common/drain/drain'
|
|
24
|
+
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
25
|
+
|
|
26
|
+
export class Aggregate extends AggregateBase {
|
|
27
|
+
static featureName = FEATURE_NAME
|
|
28
|
+
constructor (agentIdentifier, aggregator) {
|
|
29
|
+
super(agentIdentifier, aggregator, FEATURE_NAME)
|
|
30
|
+
|
|
31
|
+
this.stackReported = {}
|
|
32
|
+
this.pageviewReported = {}
|
|
33
|
+
this.errorCache = {}
|
|
34
|
+
this.currentBody
|
|
35
|
+
this.errorOnPage = false
|
|
36
|
+
|
|
37
|
+
// this will need to change to match whatever ee we use in the instrument
|
|
38
|
+
this.ee.on('interactionSaved', (interaction) => this.onInteractionSaved(interaction))
|
|
39
|
+
|
|
40
|
+
// this will need to change to match whatever ee we use in the instrument
|
|
41
|
+
this.ee.on('interactionDiscarded', (interaction) => this.onInteractionDiscarded(interaction))
|
|
42
|
+
|
|
43
|
+
register('err', (...args) => this.storeError(...args), this.featureName, this.ee)
|
|
44
|
+
register('ierr', (...args) => this.storeError(...args), this.featureName, this.ee)
|
|
45
|
+
|
|
46
|
+
const harvestTimeSeconds = getConfigurationValue(this.agentIdentifier, 'jserrors.harvestTimeSeconds') || 10
|
|
47
|
+
|
|
48
|
+
const scheduler = new HarvestScheduler('jserrors', { onFinished: (...args) => this.onHarvestFinished(...args) }, this)
|
|
49
|
+
scheduler.harvest.on('jserrors', (...args) => this.onHarvestStarted(...args))
|
|
50
|
+
|
|
51
|
+
// Don't start harvesting until "drain" for this feat has been called (which currently requires RUM response).
|
|
52
|
+
this.ee.on(`drain-${this.featureName}`, () => {
|
|
53
|
+
if (!this.blocked) scheduler.startTimer(harvestTimeSeconds) // and only if ingest will accept jserror payloads
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// If RUM-call's response determines that customer lacks entitlements for the /jserror ingest endpoint, don't harvest at all.
|
|
57
|
+
register('block-err', () => {
|
|
58
|
+
this.blocked = true
|
|
59
|
+
scheduler.stopTimer(true)
|
|
60
|
+
}, this.featureName, this.ee)
|
|
61
|
+
|
|
62
|
+
drain(this.agentIdentifier, this.featureName)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
onHarvestStarted (options) {
|
|
66
|
+
// this gets rid of dependency in AJAX module
|
|
67
|
+
var body = this.aggregator.take(['err', 'ierr', 'xhr'])
|
|
68
|
+
|
|
69
|
+
if (options.retry) {
|
|
70
|
+
this.currentBody = body
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var payload = { body: body, qs: {} }
|
|
74
|
+
var releaseIds = stringify(getRuntime(this.agentIdentifier).releaseIds)
|
|
75
|
+
|
|
76
|
+
if (releaseIds !== '{}') {
|
|
77
|
+
payload.qs.ri = releaseIds
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (body && body.err && body.err.length && !this.errorOnPage) {
|
|
81
|
+
payload.qs.pve = '1'
|
|
82
|
+
this.errorOnPage = true
|
|
83
|
+
}
|
|
84
|
+
return payload
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
onHarvestFinished (result) {
|
|
88
|
+
if (result.retry && this.currentBody) {
|
|
89
|
+
mapOwn(this.currentBody, (key, value) => {
|
|
90
|
+
for (var i = 0; i < value.length; i++) {
|
|
91
|
+
var bucket = value[i]
|
|
92
|
+
var name = this.getBucketName(bucket.params, bucket.custom)
|
|
93
|
+
this.aggregator.merge(key, name, bucket.metrics, bucket.params, bucket.custom)
|
|
94
|
+
}
|
|
95
|
+
})
|
|
96
|
+
this.currentBody = null
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
nameHash (params) {
|
|
101
|
+
return stringHashCode(`${params.exceptionClass}_${params.message}_${params.stack_trace || params.browser_stack_hash}`)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getBucketName (params, customParams) {
|
|
105
|
+
return this.nameHash(params) + ':' + stringHashCode(stringify(customParams))
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
canonicalizeURL (url, cleanedOrigin) {
|
|
109
|
+
if (typeof url !== 'string') return ''
|
|
110
|
+
|
|
111
|
+
var cleanedURL = cleanURL(url)
|
|
112
|
+
if (cleanedURL === cleanedOrigin) {
|
|
113
|
+
return '<inline>'
|
|
114
|
+
} else {
|
|
115
|
+
return cleanedURL
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
buildCanonicalStackString (stackInfo, cleanedOrigin) {
|
|
120
|
+
var canonicalStack = ''
|
|
121
|
+
|
|
122
|
+
for (var i = 0; i < stackInfo.frames.length; i++) {
|
|
123
|
+
var frame = stackInfo.frames[i]
|
|
124
|
+
var func = canonicalFunctionName(frame.func)
|
|
125
|
+
|
|
126
|
+
if (canonicalStack) canonicalStack += '\n'
|
|
127
|
+
if (func) canonicalStack += func + '@'
|
|
128
|
+
if (typeof frame.url === 'string') canonicalStack += frame.url
|
|
129
|
+
if (frame.line) canonicalStack += ':' + frame.line
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return canonicalStack
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Strip query parameters and fragments from the stackString property of the
|
|
136
|
+
// given stackInfo, along with the 'url' properties of each frame in
|
|
137
|
+
// stackInfo.frames.
|
|
138
|
+
//
|
|
139
|
+
// Any URLs that are equivalent to the cleaned version of the origin will also
|
|
140
|
+
// be replaced with the string '<inline>'.
|
|
141
|
+
//
|
|
142
|
+
canonicalizeStackURLs (stackInfo) {
|
|
143
|
+
// Currently, loader.origin might contain a fragment, but we don't want to use it
|
|
144
|
+
// for comparing with frame URLs.
|
|
145
|
+
var cleanedOrigin = cleanURL(getRuntime(this.agentIdentifier).origin)
|
|
146
|
+
|
|
147
|
+
for (var i = 0; i < stackInfo.frames.length; i++) {
|
|
148
|
+
var frame = stackInfo.frames[i]
|
|
149
|
+
var originalURL = frame.url
|
|
150
|
+
var cleanedURL = this.canonicalizeURL(originalURL, cleanedOrigin)
|
|
151
|
+
if (cleanedURL && cleanedURL !== frame.url) {
|
|
152
|
+
frame.url = cleanedURL
|
|
153
|
+
stackInfo.stackString = stackInfo.stackString.split(originalURL).join(cleanedURL)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return stackInfo
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
storeError (err, time, internal, customAttributes) {
|
|
161
|
+
// are we in an interaction
|
|
162
|
+
time = time || now()
|
|
163
|
+
const agentRuntime = getRuntime(this.agentIdentifier)
|
|
164
|
+
let filterOutput
|
|
165
|
+
|
|
166
|
+
if (!internal && agentRuntime.onerror) {
|
|
167
|
+
filterOutput = agentRuntime.onerror(err)
|
|
168
|
+
if (filterOutput && !(typeof filterOutput.group === 'string' && filterOutput.group.length)) {
|
|
169
|
+
// All truthy values mean don't report (store) the error, per backwards-compatible usage,
|
|
170
|
+
// - EXCEPT if a fingerprinting label is returned, via an object with key of 'group' and value of non-empty string
|
|
171
|
+
return
|
|
172
|
+
}
|
|
173
|
+
// Again as with previous usage, all falsey values would include the error.
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
var stackInfo = this.canonicalizeStackURLs(computeStackTrace(err))
|
|
177
|
+
var canonicalStack = this.buildCanonicalStackString(stackInfo)
|
|
178
|
+
|
|
179
|
+
const params = {
|
|
180
|
+
stackHash: stringHashCode(canonicalStack),
|
|
181
|
+
exceptionClass: stackInfo.name,
|
|
182
|
+
request_uri: globalScope?.location.pathname
|
|
183
|
+
}
|
|
184
|
+
if (stackInfo.message) params.message = '' + stackInfo.message
|
|
185
|
+
// 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).
|
|
186
|
+
// Do not modify the name ('errorGroup') of params without DEM approval!
|
|
187
|
+
if (filterOutput?.group) params.errorGroup = filterOutput.group
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* The bucketHash is different from the params.stackHash because the params.stackHash is based on the canonicalized
|
|
191
|
+
* stack trace and is used downstream in NR1 to attempt to group the same errors across different browsers. However,
|
|
192
|
+
* the canonical stack trace excludes items like the column number increasing the hit-rate of different errors potentially
|
|
193
|
+
* bucketing and ultimately resulting in the loss of data in NR1.
|
|
194
|
+
*/
|
|
195
|
+
var bucketHash = stringHashCode(`${stackInfo.name}_${stackInfo.message}_${stackInfo.stackString}`)
|
|
196
|
+
|
|
197
|
+
if (!this.stackReported[bucketHash]) {
|
|
198
|
+
this.stackReported[bucketHash] = true
|
|
199
|
+
params.stack_trace = truncateSize(stackInfo.stackString)
|
|
200
|
+
} else {
|
|
201
|
+
params.browser_stack_hash = stringHashCode(stackInfo.stackString)
|
|
202
|
+
}
|
|
203
|
+
params.releaseIds = stringify(agentRuntime.releaseIds)
|
|
204
|
+
|
|
205
|
+
// When debugging stack canonicalization/hashing, uncomment these lines for
|
|
206
|
+
// more output in the test logs
|
|
207
|
+
// params.origStack = err.stack
|
|
208
|
+
// params.canonicalStack = canonicalStack
|
|
209
|
+
|
|
210
|
+
if (!this.pageviewReported[bucketHash]) {
|
|
211
|
+
params.pageview = 1
|
|
212
|
+
this.pageviewReported[bucketHash] = true
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
var type = internal ? 'ierr' : 'err'
|
|
216
|
+
var newMetrics = { time: time }
|
|
217
|
+
|
|
218
|
+
// stn and spa aggregators listen to this event - stn sends the error in its payload,
|
|
219
|
+
// and spa annotates the error with interaction info
|
|
220
|
+
handle('errorAgg', [type, bucketHash, params, newMetrics], undefined, FEATURE_NAMES.sessionTrace, this.ee)
|
|
221
|
+
handle('errorAgg', [type, bucketHash, params, newMetrics], undefined, FEATURE_NAMES.spa, this.ee)
|
|
222
|
+
|
|
223
|
+
// still send EE events for other features such as above, but stop this one from aggregating internal data
|
|
224
|
+
if (this.blocked) return
|
|
225
|
+
if (params._interactionId != null) {
|
|
226
|
+
// hold on to the error until the interaction finishes
|
|
227
|
+
this.errorCache[params._interactionId] = this.errorCache[params._interactionId] || []
|
|
228
|
+
this.errorCache[params._interactionId].push([type, bucketHash, params, newMetrics, att, customAttributes])
|
|
229
|
+
} else {
|
|
230
|
+
// store custom attributes
|
|
231
|
+
var customParams = {}
|
|
232
|
+
var att = getInfo(this.agentIdentifier).jsAttributes
|
|
233
|
+
mapOwn(att, setCustom)
|
|
234
|
+
if (customAttributes) {
|
|
235
|
+
mapOwn(customAttributes, setCustom)
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var jsAttributesHash = stringHashCode(stringify(customParams))
|
|
239
|
+
var aggregateHash = bucketHash + ':' + jsAttributesHash
|
|
240
|
+
this.aggregator.store(type, aggregateHash, params, newMetrics, customParams)
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function setCustom (key, val) {
|
|
244
|
+
customParams[key] = (val && typeof val === 'object' ? stringify(val) : val)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
onInteractionSaved (interaction) {
|
|
249
|
+
if (!this.errorCache[interaction.id] || this.blocked) return
|
|
250
|
+
|
|
251
|
+
this.errorCache[interaction.id].forEach((item) => {
|
|
252
|
+
var customParams = {}
|
|
253
|
+
var globalCustomParams = item[4]
|
|
254
|
+
var localCustomParams = item[5]
|
|
255
|
+
|
|
256
|
+
mapOwn(globalCustomParams, setCustom)
|
|
257
|
+
mapOwn(interaction.root.attrs.custom, setCustom)
|
|
258
|
+
mapOwn(localCustomParams, setCustom)
|
|
259
|
+
|
|
260
|
+
var params = item[2]
|
|
261
|
+
params.browserInteractionId = interaction.root.attrs.id
|
|
262
|
+
delete params._interactionId
|
|
263
|
+
|
|
264
|
+
if (params._interactionNodeId) {
|
|
265
|
+
params.parentNodeId = params._interactionNodeId.toString()
|
|
266
|
+
delete params._interactionNodeId
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
var hash = item[1] + interaction.root.attrs.id
|
|
270
|
+
var jsAttributesHash = stringHashCode(stringify(customParams))
|
|
271
|
+
var aggregateHash = hash + ':' + jsAttributesHash
|
|
272
|
+
|
|
273
|
+
this.aggregator.store(item[0], aggregateHash, params, item[3], customParams)
|
|
274
|
+
|
|
275
|
+
function setCustom (key, val) {
|
|
276
|
+
customParams[key] = (val && typeof val === 'object' ? stringify(val) : val)
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
delete this.errorCache[interaction.id]
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
onInteractionDiscarded (interaction) {
|
|
283
|
+
if (!this.errorCache || !this.errorCache[interaction.id] || this.blocked) return
|
|
284
|
+
|
|
285
|
+
this.errorCache[interaction.id].forEach((item) => {
|
|
286
|
+
var customParams = {}
|
|
287
|
+
var globalCustomParams = item[4]
|
|
288
|
+
var localCustomParams = item[5]
|
|
289
|
+
|
|
290
|
+
mapOwn(globalCustomParams, setCustom)
|
|
291
|
+
mapOwn(interaction.root.attrs.custom, setCustom)
|
|
292
|
+
mapOwn(localCustomParams, setCustom)
|
|
293
|
+
|
|
294
|
+
var params = item[2]
|
|
295
|
+
delete params._interactionId
|
|
296
|
+
delete params._interactionNodeId
|
|
297
|
+
|
|
298
|
+
var hash = item[1]
|
|
299
|
+
var jsAttributesHash = stringHashCode(stringify(customParams))
|
|
300
|
+
var aggregateHash = hash + ':' + jsAttributesHash
|
|
301
|
+
|
|
302
|
+
this.aggregator.store(item[0], aggregateHash, item[2], item[3], customParams)
|
|
303
|
+
|
|
304
|
+
function setCustom (key, val) {
|
|
305
|
+
customParams[key] = (val && typeof val === 'object' ? stringify(val) : val)
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
delete this.errorCache[interaction.id]
|
|
309
|
+
}
|
|
310
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function stringHashCode (string) {
|
|
7
|
+
var hash = 0
|
|
8
|
+
var charVal
|
|
9
|
+
|
|
10
|
+
if (!string || !string.length) return hash
|
|
11
|
+
for (var i = 0; i < string.length; i++) {
|
|
12
|
+
charVal = string.charCodeAt(i)
|
|
13
|
+
hash = ((hash << 5) - hash) + charVal
|
|
14
|
+
hash = hash | 0 // Convert to 32bit integer
|
|
15
|
+
}
|
|
16
|
+
return hash
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { stringHashCode } from './string-hash-code'
|
|
2
|
+
|
|
3
|
+
test.each([
|
|
4
|
+
{ input: undefined, expected: 0, title: 'Return 0 for undefined input' },
|
|
5
|
+
{ input: null, expected: 0, title: 'Return 0 for null input' },
|
|
6
|
+
{ input: '', expected: 0, title: 'Return 0 for empty string input' },
|
|
7
|
+
{ input: 'lksjdflksjdf', expected: 32668720, title: 'Return valid hash of string' }
|
|
8
|
+
])('$title', ({ input, expected }) => {
|
|
9
|
+
const result = stringHashCode(input)
|
|
10
|
+
|
|
11
|
+
expect(result).toEqual(expected)
|
|
12
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Instrument as JSErrors } from './instrument/index'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ee } from '../../../common/event-emitter/contextual-ee'
|
|
7
|
+
import { mapOwn } from '../../../common/util/map-own'
|
|
8
|
+
|
|
9
|
+
var flags = {}
|
|
10
|
+
var flagArr
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
flagArr = localStorage.getItem('__nr_flags').split(',')
|
|
14
|
+
if (console && typeof console.log === 'function') {
|
|
15
|
+
flags.console = true
|
|
16
|
+
if (flagArr.indexOf('dev') !== -1) flags.dev = true
|
|
17
|
+
if (flagArr.indexOf('nr_dev') !== -1) flags.nrDev = true
|
|
18
|
+
}
|
|
19
|
+
} catch (err) {
|
|
20
|
+
// no op
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (flags.nrDev) ee.on('internal-error', function (err) { log(err.stack) })
|
|
24
|
+
if (flags.dev) ee.on('fn-err', function (args, origThis, err) { log(err.stack) })
|
|
25
|
+
if (flags.dev) {
|
|
26
|
+
log('NR AGENT IN DEVELOPMENT MODE')
|
|
27
|
+
log('flags: ' + mapOwn(flags, function (key, val) { return key }).join(', '))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function log (message) {
|
|
31
|
+
try {
|
|
32
|
+
if (flags.console) log(message)
|
|
33
|
+
} catch (err) {
|
|
34
|
+
// no op
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { handle } from '../../../common/event-emitter/handle'
|
|
7
|
+
import { now } from '../../../common/timing/now'
|
|
8
|
+
import { getOrSet } from '../../../common/util/get-or-set'
|
|
9
|
+
import { wrapRaf, wrapTimer, wrapEvents, wrapXhr } from '../../../common/wrap'
|
|
10
|
+
import slice from 'lodash._slice'
|
|
11
|
+
import './debug'
|
|
12
|
+
import { InstrumentBase } from '../../utils/instrument-base'
|
|
13
|
+
import { FEATURE_NAME, NR_ERR_PROP } from '../constants'
|
|
14
|
+
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
15
|
+
import { globalScope } from '../../../common/util/global-scope'
|
|
16
|
+
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts'
|
|
17
|
+
import { getRuntime } from '../../../common/config/config'
|
|
18
|
+
import { stringify } from '../../../common/util/stringify'
|
|
19
|
+
|
|
20
|
+
export class Instrument extends InstrumentBase {
|
|
21
|
+
static featureName = FEATURE_NAME
|
|
22
|
+
constructor (agentIdentifier, aggregator, auto = true) {
|
|
23
|
+
super(agentIdentifier, aggregator, FEATURE_NAME, auto)
|
|
24
|
+
// skipNext counter to keep track of uncaught
|
|
25
|
+
// errors that will be the same as caught errors.
|
|
26
|
+
this.skipNext = 0
|
|
27
|
+
try { this.removeOnAbort = new AbortController() } // this try-catch can be removed when IE11 is completely unsupported & gone
|
|
28
|
+
catch (e) {}
|
|
29
|
+
|
|
30
|
+
const thisInstrument = this
|
|
31
|
+
thisInstrument.ee.on('fn-start', function (args, obj, methodName) {
|
|
32
|
+
if (thisInstrument.abortHandler) thisInstrument.skipNext += 1
|
|
33
|
+
})
|
|
34
|
+
thisInstrument.ee.on('fn-err', function (args, obj, err) {
|
|
35
|
+
if (thisInstrument.abortHandler && !err[NR_ERR_PROP]) {
|
|
36
|
+
getOrSet(err, NR_ERR_PROP, function getVal () {
|
|
37
|
+
return true
|
|
38
|
+
})
|
|
39
|
+
this.thrown = true
|
|
40
|
+
notice(err, undefined, thisInstrument.ee)
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
thisInstrument.ee.on('fn-end', function () {
|
|
44
|
+
if (!thisInstrument.abortHandler) return
|
|
45
|
+
if (!this.thrown && thisInstrument.skipNext > 0) thisInstrument.skipNext -= 1
|
|
46
|
+
})
|
|
47
|
+
thisInstrument.ee.on('internal-error', function (e) {
|
|
48
|
+
handle('ierr', [e, now(), true], undefined, FEATURE_NAMES.jserrors, thisInstrument.ee)
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// Replace global error handler with our own.
|
|
52
|
+
this.origOnerror = globalScope.onerror
|
|
53
|
+
globalScope.onerror = this.onerrorHandler.bind(this)
|
|
54
|
+
|
|
55
|
+
globalScope.addEventListener('unhandledrejection', (e) => {
|
|
56
|
+
/** rejections can contain data of any type -- this is an effort to keep the message human readable */
|
|
57
|
+
const err = castReasonToError(e.reason)
|
|
58
|
+
handle('err', [err, now(), false, { unhandledPromiseRejection: 1 }], undefined, FEATURE_NAMES.jserrors, this.ee)
|
|
59
|
+
}, eventListenerOpts(false, this.removeOnAbort?.signal))
|
|
60
|
+
|
|
61
|
+
wrapRaf(this.ee)
|
|
62
|
+
wrapTimer(this.ee)
|
|
63
|
+
wrapEvents(this.ee)
|
|
64
|
+
if (getRuntime(agentIdentifier).xhrWrappable) wrapXhr(this.ee)
|
|
65
|
+
|
|
66
|
+
this.abortHandler = this.#abort // we also use this as a flag to denote that the feature is active or on and handling errors
|
|
67
|
+
this.importAggregator()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Restoration and resource release tasks to be done if JS error loader is being aborted. Unwind changes to globals. */
|
|
71
|
+
#abort () {
|
|
72
|
+
this.removeOnAbort?.abort()
|
|
73
|
+
this.abortHandler = undefined // weakly allow this abort op to run only once
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* FF and Android browsers do not provide error info to the 'error' event callback,
|
|
78
|
+
* so we must use window.onerror
|
|
79
|
+
* @param {string} message
|
|
80
|
+
* @param {string} filename
|
|
81
|
+
* @param {number} lineno
|
|
82
|
+
* @param {number} column
|
|
83
|
+
* @param {Error | *} errorObj
|
|
84
|
+
* @returns
|
|
85
|
+
*/
|
|
86
|
+
onerrorHandler (message, filename, lineno, column, errorObj) {
|
|
87
|
+
if (typeof this.origOnerror === 'function') this.origOnerror(...arguments)
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
if (this.skipNext) this.skipNext -= 1
|
|
91
|
+
else notice(errorObj || new UncaughtException(message, filename, lineno), true, this.ee)
|
|
92
|
+
} catch (e) {
|
|
93
|
+
try {
|
|
94
|
+
handle('ierr', [e, now(), true], undefined, FEATURE_NAMES.jserrors, this.ee)
|
|
95
|
+
} catch (err) {
|
|
96
|
+
// do nothing
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return false // maintain default behavior of the error event of Window
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param {string} message
|
|
106
|
+
* @param {string} filename
|
|
107
|
+
* @param {number} lineno
|
|
108
|
+
*/
|
|
109
|
+
function UncaughtException (message, filename, lineno) {
|
|
110
|
+
this.message = message || 'Uncaught error with no additional information'
|
|
111
|
+
this.sourceURL = filename
|
|
112
|
+
this.line = lineno
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Adds a timestamp and emits the 'err' event, which the error aggregator listens for
|
|
117
|
+
* @param {Error} err
|
|
118
|
+
* @param {boolean} doNotStamp
|
|
119
|
+
* @param {ContextualEE} ee
|
|
120
|
+
*/
|
|
121
|
+
function notice (err, doNotStamp, ee) {
|
|
122
|
+
// by default add timestamp, unless specifically told not to
|
|
123
|
+
// this is to preserve existing behavior
|
|
124
|
+
var time = (!doNotStamp) ? now() : null
|
|
125
|
+
handle('err', [err, time], undefined, FEATURE_NAMES.jserrors, ee)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Attempts to cast an unhandledPromiseRejection reason (reject(...)) to an Error object
|
|
130
|
+
* @param {*} reason - The reason property from an unhandled promise rejection
|
|
131
|
+
* @returns {Error} - An Error object with the message as the casted reason
|
|
132
|
+
*/
|
|
133
|
+
function castReasonToError (reason) {
|
|
134
|
+
let prefix = 'Unhandled Promise Rejection: '
|
|
135
|
+
if (reason instanceof Error) {
|
|
136
|
+
try {
|
|
137
|
+
reason.message = prefix + reason.message
|
|
138
|
+
return reason
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return reason
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (typeof reason === 'undefined') return new Error(prefix)
|
|
144
|
+
try {
|
|
145
|
+
return new Error(prefix + stringify(reason))
|
|
146
|
+
} catch (err) {
|
|
147
|
+
return new Error(prefix)
|
|
148
|
+
}
|
|
149
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getRuntime } from '../../../common/config/config'
|
|
2
|
+
import { registerHandler } from '../../../common/event-emitter/register-handler'
|
|
3
|
+
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler'
|
|
4
|
+
import { AggregateBase } from '../../utils/aggregate-base'
|
|
5
|
+
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL } from '../constants'
|
|
6
|
+
import { drain } from '../../../common/drain/drain'
|
|
7
|
+
import { getFrameworks } from '../../../common/metrics/framework-detection'
|
|
8
|
+
import { protocol } from '../../../common/url/protocol'
|
|
9
|
+
import { getRules, validateRules } from '../../../common/util/obfuscate'
|
|
10
|
+
import { VERSION } from '../../../common/constants/environment-variables'
|
|
11
|
+
import { onDOMContentLoaded } from '../../../common/window/load'
|
|
12
|
+
import { windowAddEventListener } from '../../../common/event-listener/event-listener-opts'
|
|
13
|
+
import { isBrowserScope } from '../../../common/util/global-scope'
|
|
14
|
+
export class Aggregate extends AggregateBase {
|
|
15
|
+
static featureName = FEATURE_NAME
|
|
16
|
+
constructor (agentIdentifier, aggregator) {
|
|
17
|
+
super(agentIdentifier, aggregator, FEATURE_NAME)
|
|
18
|
+
let scheduler
|
|
19
|
+
|
|
20
|
+
// If RUM-call's response determines that customer lacks entitlements for the /jserror ingest endpoint, don't harvest at all.
|
|
21
|
+
registerHandler('block-err', () => {
|
|
22
|
+
this.blocked = true
|
|
23
|
+
if (scheduler) scheduler.aborted = true // RUM response may or may not have happened already before scheduler initialization below
|
|
24
|
+
}, this.featureName, this.ee)
|
|
25
|
+
|
|
26
|
+
// Allow features external to the metrics feature to capture SMs and CMs through the event emitter
|
|
27
|
+
registerHandler(SUPPORTABILITY_METRIC_CHANNEL, this.storeSupportabilityMetrics.bind(this), this.featureName, this.ee)
|
|
28
|
+
registerHandler(CUSTOM_METRIC_CHANNEL, this.storeEventMetrics.bind(this), this.featureName, this.ee)
|
|
29
|
+
|
|
30
|
+
this.singleChecks() // checks that are run only one time, at script load
|
|
31
|
+
this.eachSessionChecks() // the start of every time user engages with page
|
|
32
|
+
|
|
33
|
+
// *cli, Mar 23 - Per NR-94597, this feature should only harvest ONCE at the (potential) EoL time of the page.
|
|
34
|
+
scheduler = new HarvestScheduler('jserrors', { onUnload: () => this.unload() }, this)
|
|
35
|
+
scheduler.harvest.on('jserrors', () => ({ body: this.aggregator.take(['cm', 'sm']) }))
|
|
36
|
+
|
|
37
|
+
drain(this.agentIdentifier, this.featureName) // regardless if this is blocked or not, drain is needed to unblock other features from harvesting (counteract registerDrain)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
storeSupportabilityMetrics (name, value) {
|
|
41
|
+
if (this.blocked) return
|
|
42
|
+
const type = SUPPORTABILITY_METRIC
|
|
43
|
+
const params = { name }
|
|
44
|
+
this.aggregator.storeMetric(type, name, params, value)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
storeEventMetrics (name, metrics) {
|
|
48
|
+
if (this.blocked) return
|
|
49
|
+
const type = CUSTOM_METRIC
|
|
50
|
+
const params = { name }
|
|
51
|
+
this.aggregator.store(type, name, params, metrics)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
singleChecks () {
|
|
55
|
+
// report generic info about the agent itself
|
|
56
|
+
// note the browser agent version
|
|
57
|
+
this.storeSupportabilityMetrics(`Generic/Version/${VERSION}/Detected`)
|
|
58
|
+
// report loaderType
|
|
59
|
+
const { distMethod, loaderType } = getRuntime(this.agentIdentifier)
|
|
60
|
+
if (loaderType) this.storeSupportabilityMetrics(`Generic/LoaderType/${loaderType}/Detected`)
|
|
61
|
+
if (distMethod) this.storeSupportabilityMetrics(`Generic/DistMethod/${distMethod}/Detected`)
|
|
62
|
+
|
|
63
|
+
// frameworks on page
|
|
64
|
+
if (isBrowserScope) {
|
|
65
|
+
onDOMContentLoaded(() => {
|
|
66
|
+
getFrameworks().forEach(framework => {
|
|
67
|
+
this.storeSupportabilityMetrics('Framework/' + framework + '/Detected')
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// file protocol detection
|
|
73
|
+
if (protocol.isFileProtocol()) {
|
|
74
|
+
this.storeSupportabilityMetrics('Generic/FileProtocol/Detected')
|
|
75
|
+
protocol.supportabilityMetricSent = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// obfuscation rules detection
|
|
79
|
+
const rules = getRules(this.agentIdentifier)
|
|
80
|
+
if (rules.length > 0) this.storeSupportabilityMetrics('Generic/Obfuscate/Detected')
|
|
81
|
+
if (rules.length > 0 && !validateRules(rules)) this.storeSupportabilityMetrics('Generic/Obfuscate/Invalid')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
eachSessionChecks () {
|
|
85
|
+
if (!isBrowserScope) return
|
|
86
|
+
|
|
87
|
+
// [Temporary] Report restores from BFCache to NR1 while feature flag is in place in lieu of sending pageshow events.
|
|
88
|
+
windowAddEventListener('pageshow', (evt) => {
|
|
89
|
+
if (evt.persisted) { this.storeSupportabilityMetrics('Generic/BFCache/PageRestored') }
|
|
90
|
+
return
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
unload () {
|
|
95
|
+
// Page Resources detection for estimations with resources feature work
|
|
96
|
+
// TODO - these SMs are to be removed when we implement the actual resources feature
|
|
97
|
+
try {
|
|
98
|
+
if (this.resourcesSent) return
|
|
99
|
+
const agentRuntime = getRuntime(this.agentIdentifier)
|
|
100
|
+
// make sure this only gets sent once
|
|
101
|
+
this.resourcesSent = true
|
|
102
|
+
// differentiate between internal+external and ajax+non-ajax
|
|
103
|
+
const ajaxResources = ['beacon', 'fetch', 'xmlhttprequest']
|
|
104
|
+
const internalUrls = ['nr-data.net', 'newrelic.com', 'nr-local.net', 'localhost']
|
|
105
|
+
function isInternal (x) { return internalUrls.some(y => x.name.indexOf(y) >= 0) }
|
|
106
|
+
function isAjax (x) { return ajaxResources.includes(x.initiatorType) }
|
|
107
|
+
const allResources = performance?.getEntriesByType('resource') || []
|
|
108
|
+
allResources.forEach((entry) => {
|
|
109
|
+
if (isInternal(entry)) {
|
|
110
|
+
if (isAjax(entry)) this.storeSupportabilityMetrics('Generic/Resources/Ajax/Internal')
|
|
111
|
+
else this.storeSupportabilityMetrics('Generic/Resources/Non-Ajax/Internal')
|
|
112
|
+
} else {
|
|
113
|
+
if (isAjax(entry)) this.storeSupportabilityMetrics('Generic/Resources/Ajax/External')
|
|
114
|
+
else this.storeSupportabilityMetrics('Generic/Resources/Non-Ajax/External')
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
// Capture per-agent bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
|
|
119
|
+
Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
|
|
120
|
+
this.storeSupportabilityMetrics(
|
|
121
|
+
`PageSession/Endpoint/${endpoint.charAt(0).toUpperCase() + endpoint.slice(1)}/BytesSent`,
|
|
122
|
+
agentRuntime.bytesSent[endpoint]
|
|
123
|
+
)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
// Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
|
|
127
|
+
if (agentRuntime.ptid) {
|
|
128
|
+
this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()))
|
|
129
|
+
}
|
|
130
|
+
} catch (e) {
|
|
131
|
+
// do nothing
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
2
|
+
|
|
3
|
+
export const FEATURE_NAME = FEATURE_NAMES.metrics
|
|
4
|
+
export const SUPPORTABILITY_METRIC = 'sm'
|
|
5
|
+
export const CUSTOM_METRIC = 'cm'
|
|
6
|
+
export const SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics'
|
|
7
|
+
export const CUSTOM_METRIC_CHANNEL = 'storeEventMetrics'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Instrument as Metrics } from './instrument/index'
|