@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,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Defines `InstrumentBase` to be used as the super of the Instrument classes implemented by each feature.
|
|
3
|
+
* Inherits and executes the `checkConfiguration` method from [FeatureBase]{@link ./feature-base}, which also
|
|
4
|
+
* exposes the `blocked` property.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { registerDrain } from '../../common/drain/drain'
|
|
8
|
+
import { FeatureBase } from './feature-base'
|
|
9
|
+
import { onWindowLoad } from '../../common/window/load'
|
|
10
|
+
import { isWorkerScope } from '../../common/util/global-scope'
|
|
11
|
+
import { warn } from '../../common/util/console'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base class for instrumenting a feature.
|
|
15
|
+
* @extends FeatureBase
|
|
16
|
+
*/
|
|
17
|
+
export class InstrumentBase extends FeatureBase {
|
|
18
|
+
/**
|
|
19
|
+
* Instantiate InstrumentBase.
|
|
20
|
+
* @param {string} agentIdentifier - The unique ID of the instantiated agent (relative to global scope).
|
|
21
|
+
* @param {Aggregator} aggregator - The shared Aggregator that will handle batching and reporting of data.
|
|
22
|
+
* @param {string} featureName - The name of the feature module (used to construct file path).
|
|
23
|
+
* @param {boolean} [auto=true] - Determines whether the feature should automatically register to have the draining
|
|
24
|
+
* of its pooled instrumentation data handled by the agent's centralized drain functionality, rather than draining
|
|
25
|
+
* immediately. Primarily useful for fine-grained control in tests.
|
|
26
|
+
*/
|
|
27
|
+
constructor (agentIdentifier, aggregator, featureName, auto = true) {
|
|
28
|
+
super(agentIdentifier, aggregator, featureName)
|
|
29
|
+
this.hasAggregator = false
|
|
30
|
+
this.auto = auto
|
|
31
|
+
|
|
32
|
+
/** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */
|
|
33
|
+
this.abortHandler
|
|
34
|
+
|
|
35
|
+
if (auto) registerDrain(agentIdentifier, featureName)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Lazy-load the latter part of the feature: its aggregator. This method is called by the first part of the feature
|
|
40
|
+
* (the instrumentation) when instrumentation is complete.
|
|
41
|
+
*/
|
|
42
|
+
importAggregator () {
|
|
43
|
+
if (this.hasAggregator || !this.auto) return
|
|
44
|
+
this.hasAggregator = true
|
|
45
|
+
|
|
46
|
+
const importLater = async () => {
|
|
47
|
+
/**
|
|
48
|
+
* Note this try-catch differs from the one in Agent.start() in that it's placed later in a page's lifecycle and
|
|
49
|
+
* it's only responsible for aborting its one specific feature, rather than all.
|
|
50
|
+
*/
|
|
51
|
+
try {
|
|
52
|
+
const { lazyLoader } = await import(/* webpackChunkName: "lazy-loader" */ './lazy-loader')
|
|
53
|
+
const { Aggregate } = await lazyLoader(this.featureName, 'aggregate')
|
|
54
|
+
new Aggregate(this.agentIdentifier, this.aggregator)
|
|
55
|
+
} catch (e) {
|
|
56
|
+
warn(`Downloading ${this.featureName} failed...`)
|
|
57
|
+
this.abortHandler?.() // undo any important alterations made to the page
|
|
58
|
+
|
|
59
|
+
// not supported yet but nice to do: "abort" this agent's EE for this feature specifically
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// For regular web pages, we want to wait and lazy-load the aggregator only after all page resources are loaded.
|
|
64
|
+
// Non-browser scopes (i.e. workers) have no `window.load` event, so the aggregator can be lazy-loaded immediately.
|
|
65
|
+
if (isWorkerScope) importLater()
|
|
66
|
+
else onWindowLoad(() => importLater(), true)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Centralizes the lazy loading of agent feature aggregate and instrument sources.
|
|
5
|
+
*
|
|
6
|
+
* This function uses two defined switch cases to allow us to easily name our chunks and re-use these
|
|
7
|
+
* chunks for different agent types. We do not use template strings or string concatenation here because
|
|
8
|
+
* doing so makes it much more difficult to name the chunks and forces Webpack to "guess" what the chunks
|
|
9
|
+
* should be.
|
|
10
|
+
* @param featureName Name of the feature to import such as ajax or session_trace
|
|
11
|
+
* @param featurePart Name of the feature part to load; should be either instrument or aggregate
|
|
12
|
+
* @returns {Promise<InstrumentBase|AggregateBase|null>}
|
|
13
|
+
*/
|
|
14
|
+
export function lazyLoader (featureName, featurePart) {
|
|
15
|
+
if (featurePart === 'aggregate') {
|
|
16
|
+
switch (featureName) {
|
|
17
|
+
case FEATURE_NAMES.ajax:
|
|
18
|
+
return import(/* webpackChunkName: "ajax-aggregate" */ '../ajax/aggregate')
|
|
19
|
+
case FEATURE_NAMES.jserrors:
|
|
20
|
+
return import(/* webpackChunkName: "jserrors-aggregate" */ '../jserrors/aggregate')
|
|
21
|
+
case FEATURE_NAMES.metrics:
|
|
22
|
+
return import(/* webpackChunkName: "metrics-aggregate" */ '../metrics/aggregate')
|
|
23
|
+
case FEATURE_NAMES.pageAction:
|
|
24
|
+
return import(/* webpackChunkName: "page_action-aggregate" */ '../page_action/aggregate')
|
|
25
|
+
case FEATURE_NAMES.pageViewEvent:
|
|
26
|
+
return import(/* webpackChunkName: "page_view_event-aggregate" */ '../page_view_event/aggregate')
|
|
27
|
+
case FEATURE_NAMES.pageViewTiming:
|
|
28
|
+
return import(/* webpackChunkName: "page_view_timing-aggregate" */ '../page_view_timing/aggregate')
|
|
29
|
+
case FEATURE_NAMES.sessionTrace:
|
|
30
|
+
return import(/* webpackChunkName: "session_trace-aggregate" */ '../session_trace/aggregate')
|
|
31
|
+
case FEATURE_NAMES.spa:
|
|
32
|
+
return import(/* webpackChunkName: "spa-aggregate" */ '../spa/aggregate')
|
|
33
|
+
default:
|
|
34
|
+
throw new Error(`Attempted to load unsupported agent feature: ${featureName} ${featurePart}`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { Agent } from './loaders/agent'
|
|
2
|
+
export { BrowserAgent } from './loaders/browser-agent'
|
|
3
|
+
export { WorkerAgent } from './loaders/worker-agent'
|
|
4
|
+
|
|
5
|
+
/** IN-PROGRESS -- DOES NOT CURRENTLY WORK CORRECTLY */
|
|
6
|
+
// export { MicroAgent } from './loaders/micro-agent'
|
|
7
|
+
|
|
8
|
+
export { Ajax } from './features/ajax'
|
|
9
|
+
export { JSErrors } from './features/jserrors'
|
|
10
|
+
export { Metrics } from './features/metrics'
|
|
11
|
+
export { PageAction } from './features/page_action'
|
|
12
|
+
export { PageViewEvent } from './features/page_view_event'
|
|
13
|
+
export { PageViewTiming } from './features/page_view_timing'
|
|
14
|
+
export { SessionTrace } from './features/session_trace'
|
|
15
|
+
export { Spa } from './features/spa'
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// loader files
|
|
2
|
+
import { getEnabledFeatures } from './features/enabled-features'
|
|
3
|
+
import { configure } from './configure/configure'
|
|
4
|
+
import { getFeatureDependencyNames } from './features/featureDependencies'
|
|
5
|
+
import { featurePriority, FEATURE_NAMES } from './features/features'
|
|
6
|
+
// required features
|
|
7
|
+
import { Instrument as PageViewEvent } from '../features/page_view_event/instrument'
|
|
8
|
+
// common files
|
|
9
|
+
import { Aggregator } from '../common/aggregate/aggregator'
|
|
10
|
+
import { gosNREUM, gosNREUMInitializedAgents } from '../common/window/nreum'
|
|
11
|
+
import { generateRandomHexString } from '../common/ids/unique-id'
|
|
12
|
+
import { getConfiguration, getInfo, getLoaderConfig, getRuntime } from '../common/config/config'
|
|
13
|
+
import { warn } from '../common/util/console'
|
|
14
|
+
import { stringify } from '../common/util/stringify'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A flexible class that may be used to compose an agent from a select subset of feature modules. In applications
|
|
18
|
+
* sensitive to network load, this may result in smaller builds with slightly lower performance impact.
|
|
19
|
+
*/
|
|
20
|
+
export class Agent {
|
|
21
|
+
constructor (options, agentIdentifier = generateRandomHexString(16)) {
|
|
22
|
+
this.agentIdentifier = agentIdentifier
|
|
23
|
+
this.sharedAggregator = new Aggregator({ agentIdentifier: this.agentIdentifier })
|
|
24
|
+
this.features = {}
|
|
25
|
+
|
|
26
|
+
this.desiredFeatures = new Set(options.features || []) // expected to be a list of static Instrument/InstrumentBase classes, see "spa.js" for example
|
|
27
|
+
|
|
28
|
+
// For Now... ALL agents must make the rum call whether the page_view_event feature was enabled or not.
|
|
29
|
+
// NR1 creates an index on the rum call, and if not seen for a few days, will remove the browser app!
|
|
30
|
+
// Future work is being planned to evaluate removing this behavior from the backend, but for now we must ensure this call is made
|
|
31
|
+
this.desiredFeatures.add(PageViewEvent)
|
|
32
|
+
|
|
33
|
+
Object.assign(this, configure(this.agentIdentifier, options, options.loaderType || 'agent'))
|
|
34
|
+
|
|
35
|
+
this.start()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
get config () {
|
|
39
|
+
return {
|
|
40
|
+
info: getInfo(this.agentIdentifier),
|
|
41
|
+
init: getConfiguration(this.agentIdentifier),
|
|
42
|
+
loader_config: getLoaderConfig(this.agentIdentifier),
|
|
43
|
+
runtime: getRuntime(this.agentIdentifier)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
start () {
|
|
48
|
+
const NR_FEATURES_REF_NAME = 'features'
|
|
49
|
+
// Attempt to initialize all the requested features (sequentially in prio order & synchronously), with any failure aborting the whole process.
|
|
50
|
+
try {
|
|
51
|
+
const enabledFeatures = getEnabledFeatures(this.agentIdentifier)
|
|
52
|
+
const featuresToStart = Array.from(this.desiredFeatures)
|
|
53
|
+
featuresToStart.sort((a, b) => featurePriority[a.featureName] - featurePriority[b.featureName])
|
|
54
|
+
featuresToStart.forEach(f => {
|
|
55
|
+
// pageViewEvent must be enabled because RUM calls are not optional. See comment in constructor and PR 428.
|
|
56
|
+
if (enabledFeatures[f.featureName] || f.featureName === FEATURE_NAMES.pageViewEvent) {
|
|
57
|
+
const dependencies = getFeatureDependencyNames(f.featureName)
|
|
58
|
+
const hasAllDeps = dependencies.every(x => enabledFeatures[x])
|
|
59
|
+
if (!hasAllDeps) warn(`${f.featureName} is enabled but one or more dependent features has been disabled (${stringify(dependencies)}). This may cause unintended consequences or missing data...`)
|
|
60
|
+
this.features[f.featureName] = new f(this.agentIdentifier, this.sharedAggregator)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
63
|
+
gosNREUMInitializedAgents(this.agentIdentifier, this.features, NR_FEATURES_REF_NAME)
|
|
64
|
+
} catch (err) {
|
|
65
|
+
warn('Failed to initialize all enabled instrument classes (agent aborted) -', err)
|
|
66
|
+
for (const featName in this.features) { // this.features hold only features that have been instantiated
|
|
67
|
+
this.features[featName].abortHandler?.()
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const newrelic = gosNREUM()
|
|
71
|
+
delete newrelic.initializedAgents[this.agentIdentifier]?.['api'] // prevent further calls to agent-specific APIs (see "configure.js")
|
|
72
|
+
delete newrelic.initializedAgents[this.agentIdentifier]?.[NR_FEATURES_REF_NAME] // GC mem used internally by features
|
|
73
|
+
delete this.sharedAggregator
|
|
74
|
+
// Keep the initialized agent object with its configs for troubleshooting purposes.
|
|
75
|
+
newrelic.ee?.abort() // set flag and clear global backlog
|
|
76
|
+
delete newrelic.ee?.get(this.agentIdentifier) // clear this agent's own backlog too
|
|
77
|
+
return false
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
import { FEATURE_NAMES } from '../features/features'
|
|
6
|
+
import { getRuntime, setInfo, getInfo } from '../../common/config/config'
|
|
7
|
+
import { handle } from '../../common/event-emitter/handle'
|
|
8
|
+
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
9
|
+
import { now } from '../../common/timing/now'
|
|
10
|
+
import { drain, registerDrain } from '../../common/drain/drain'
|
|
11
|
+
import { onWindowLoad } from '../../common/window/load'
|
|
12
|
+
import { isBrowserScope, isWorkerScope } from '../../common/util/global-scope'
|
|
13
|
+
import { warn } from '../../common/util/console'
|
|
14
|
+
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants'
|
|
15
|
+
import { gosCDN } from '../../common/window/nreum'
|
|
16
|
+
import { putInBrowserStorage, removeFromBrowserStorage } from '../../common/window/session-storage'
|
|
17
|
+
|
|
18
|
+
export const CUSTOM_ATTR_GROUP = 'CUSTOM/' // the subgroup items should be stored under in storage API
|
|
19
|
+
|
|
20
|
+
export function setTopLevelCallers () {
|
|
21
|
+
const nr = gosCDN()
|
|
22
|
+
const funcs = [
|
|
23
|
+
'setErrorHandler', 'finished', 'addToTrace', 'inlineHit', 'addRelease',
|
|
24
|
+
'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute',
|
|
25
|
+
'interaction', 'noticeError', 'setUserId'
|
|
26
|
+
]
|
|
27
|
+
funcs.forEach(f => {
|
|
28
|
+
nr[f] = (...args) => caller(f, ...args)
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
function caller (fnName, ...args) {
|
|
32
|
+
let returnVals = []
|
|
33
|
+
Object.values(nr.initializedAgents).forEach(val => {
|
|
34
|
+
if (val.exposed && val.api[fnName]) {
|
|
35
|
+
returnVals.push(val.api[fnName](...args))
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
return returnVals.length > 1 ? returnsVals : returnVals[0]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function setAPI (agentIdentifier, forceDrain) {
|
|
43
|
+
if (!forceDrain) registerDrain(agentIdentifier, 'api')
|
|
44
|
+
const apiInterface = {}
|
|
45
|
+
var instanceEE = ee.get(agentIdentifier)
|
|
46
|
+
var tracerEE = instanceEE.get('tracer')
|
|
47
|
+
|
|
48
|
+
var asyncApiFns = [
|
|
49
|
+
'setErrorHandler',
|
|
50
|
+
'finished',
|
|
51
|
+
'addToTrace',
|
|
52
|
+
'inlineHit',
|
|
53
|
+
'addRelease'
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
var prefix = 'api-'
|
|
57
|
+
var spaPrefix = prefix + 'ixn-'
|
|
58
|
+
|
|
59
|
+
// Setup stub functions that queue calls for later processing.
|
|
60
|
+
asyncApiFns.forEach(fnName => apiInterface[fnName] = apiCall(prefix, fnName, true, 'api'))
|
|
61
|
+
|
|
62
|
+
apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.pageAction)
|
|
63
|
+
apiInterface.setCurrentRouteName = apiCall(prefix, 'routeName', true, FEATURE_NAMES.spa)
|
|
64
|
+
|
|
65
|
+
apiInterface.setPageViewName = function (name, host) {
|
|
66
|
+
if (typeof name !== 'string') return
|
|
67
|
+
if (name.charAt(0) !== '/') name = '/' + name
|
|
68
|
+
getRuntime(agentIdentifier).customTransaction = (host || 'http://custom.transaction') + name
|
|
69
|
+
return apiCall(prefix, 'setPageViewName', true)()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Attach the key-value attribute onto agent payloads. All browser events in NR will be affected.
|
|
74
|
+
* @param {string} key
|
|
75
|
+
* @param {string|number|null} value - null indicates the key should be removed or erased
|
|
76
|
+
* @param {string} apiName
|
|
77
|
+
* @param {boolean} addToBrowserStorage - whether this attribute should be stored in browser storage API and retrieved by the next agent context or initialization
|
|
78
|
+
* @returns @see apiCall
|
|
79
|
+
*/
|
|
80
|
+
function appendJsAttribute (key, value, apiName, addToBrowserStorage) {
|
|
81
|
+
const currentInfo = getInfo(agentIdentifier)
|
|
82
|
+
if (value === null) {
|
|
83
|
+
delete currentInfo.jsAttributes[key]
|
|
84
|
+
if (isBrowserScope) removeFromBrowserStorage(key, CUSTOM_ATTR_GROUP) // addToBrowserStorage flag isn't needed to unset keys from storage
|
|
85
|
+
} else {
|
|
86
|
+
setInfo(agentIdentifier, { ...currentInfo, jsAttributes: { ...currentInfo.jsAttributes, [key]: value } })
|
|
87
|
+
if (isBrowserScope && addToBrowserStorage) putInBrowserStorage(key, value, CUSTOM_ATTR_GROUP)
|
|
88
|
+
}
|
|
89
|
+
return apiCall(prefix, apiName, true)()
|
|
90
|
+
}
|
|
91
|
+
apiInterface.setCustomAttribute = function (name, value, persistAttribute = false) {
|
|
92
|
+
if (typeof name !== 'string') {
|
|
93
|
+
warn(`Failed to execute setCustomAttribute.\nName must be a string type, but a type of <${typeof name}> was provided.`)
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
if (!(['string', 'number'].includes(typeof value) || value === null)) {
|
|
97
|
+
warn(`Failed to execute setCustomAttribute.\nNon-null value must be a string or number type, but a type of <${typeof value}> was provided.`)
|
|
98
|
+
return
|
|
99
|
+
}
|
|
100
|
+
return appendJsAttribute(name, value, 'setCustomAttribute', persistAttribute)
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Attach the 'enduser.id' attribute onto agent payloads. This may be used in NR queries to group all browser events by specific users.
|
|
104
|
+
* @param {string} value - unique user identifier; a null user id suggests none should exist
|
|
105
|
+
* @returns @see apiCall
|
|
106
|
+
*/
|
|
107
|
+
apiInterface.setUserId = function (value) {
|
|
108
|
+
if (!(typeof value === 'string' || value === null)) {
|
|
109
|
+
warn(`Failed to execute setUserId.\nNon-null value must be a string type, but a type of <${typeof value}> was provided.`)
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
return appendJsAttribute('enduser.id', value, 'setUserId', true)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
apiInterface.interaction = function () {
|
|
116
|
+
return new InteractionHandle().get()
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function InteractionHandle () { }
|
|
120
|
+
|
|
121
|
+
var InteractionApiProto = InteractionHandle.prototype = {
|
|
122
|
+
createTracer: function (name, cb) {
|
|
123
|
+
var contextStore = {}
|
|
124
|
+
var ixn = this
|
|
125
|
+
var hasCb = typeof cb === 'function'
|
|
126
|
+
handle(spaPrefix + 'tracer', [now(), name, contextStore], ixn, FEATURE_NAMES.spa, instanceEE)
|
|
127
|
+
return function () {
|
|
128
|
+
tracerEE.emit((hasCb ? '' : 'no-') + 'fn-start', [now(), ixn, hasCb], contextStore)
|
|
129
|
+
if (hasCb) {
|
|
130
|
+
try {
|
|
131
|
+
return cb.apply(this, arguments)
|
|
132
|
+
} catch (err) {
|
|
133
|
+
tracerEE.emit('fn-err', [arguments, this, typeof err == 'string' ? new Error(err) : err], contextStore)
|
|
134
|
+
// the error came from outside the agent, so don't swallow
|
|
135
|
+
throw err
|
|
136
|
+
} finally {
|
|
137
|
+
tracerEE.emit('fn-end', [now()], contextStore)
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
void ['actionText', 'setName', 'setAttribute', 'save', 'ignore', 'onEnd', 'getContext', 'end', 'get'].forEach(name => {
|
|
145
|
+
InteractionApiProto[name] = apiCall(spaPrefix, name, undefined, FEATURE_NAMES.spa)
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
function apiCall (prefix, name, notSpa, bufferGroup) {
|
|
149
|
+
return function () {
|
|
150
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/' + name + '/called'], undefined, FEATURE_NAMES.metrics, instanceEE)
|
|
151
|
+
if (bufferGroup) handle(prefix + name, [now(), ...arguments], notSpa ? null : this, bufferGroup, instanceEE) // no bufferGroup means only the SM is emitted
|
|
152
|
+
return notSpa ? void 0 : this
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
apiInterface.noticeError = function (err, customAttributes) {
|
|
157
|
+
if (typeof err === 'string') err = new Error(err)
|
|
158
|
+
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/noticeError/called'], undefined, FEATURE_NAMES.metrics, instanceEE)
|
|
159
|
+
handle('err', [err, now(), false, customAttributes], undefined, FEATURE_NAMES.jserrors, instanceEE)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// theres no window.load event on non-browser scopes, lazy load immediately
|
|
163
|
+
if (isWorkerScope) lazyLoad()
|
|
164
|
+
// try to stay out of the way of the window.load event, lazy load once that has finished.
|
|
165
|
+
else onWindowLoad(() => lazyLoad(), true)
|
|
166
|
+
|
|
167
|
+
function lazyLoad () {
|
|
168
|
+
import(/* webpackChunkName: "async-api" */'./apiAsync').then(({ setAPI }) => {
|
|
169
|
+
setAPI(agentIdentifier)
|
|
170
|
+
drain(agentIdentifier, 'api')
|
|
171
|
+
}).catch(() => warn('Downloading runtime APIs failed...'))
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
return apiInterface
|
|
175
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from '../features/features'
|
|
2
|
+
import { getConfigurationValue, getInfo, getRuntime } from '../../common/config/config'
|
|
3
|
+
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
4
|
+
import { handle } from '../../common/event-emitter/handle'
|
|
5
|
+
import { registerHandler } from '../../common/event-emitter/register-handler'
|
|
6
|
+
import { single } from '../../common/util/single'
|
|
7
|
+
import { submitData } from '../../common/util/submit-data'
|
|
8
|
+
import { isBrowserScope } from '../../common/util/global-scope'
|
|
9
|
+
import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants'
|
|
10
|
+
|
|
11
|
+
export function setAPI (agentIdentifier) {
|
|
12
|
+
var instanceEE = ee.get(agentIdentifier)
|
|
13
|
+
var cycle = 0
|
|
14
|
+
|
|
15
|
+
var scheme = (getConfigurationValue(agentIdentifier, 'ssl') === false) ? 'http' : 'https'
|
|
16
|
+
|
|
17
|
+
var api = {
|
|
18
|
+
finished: single(finished),
|
|
19
|
+
setErrorHandler: setErrorHandler,
|
|
20
|
+
addToTrace: addToTrace,
|
|
21
|
+
inlineHit: inlineHit,
|
|
22
|
+
addRelease: addRelease
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Hook all of the api functions up to the queues/stubs created in loader/api.js
|
|
26
|
+
Object.entries(api).forEach(([fnName, fnCall]) => registerHandler('api-' + fnName, fnCall, 'api', instanceEE))
|
|
27
|
+
|
|
28
|
+
// All API functions get passed the time they were called as their
|
|
29
|
+
// first parameter. These functions can be called asynchronously.
|
|
30
|
+
|
|
31
|
+
function finished (t, providedTime) {
|
|
32
|
+
var time = providedTime ? providedTime - getRuntime(agentIdentifier).offset : t
|
|
33
|
+
handle(CUSTOM_METRIC_CHANNEL, ['finished', { time }], undefined, FEATURE_NAMES.metrics, instanceEE)
|
|
34
|
+
addToTrace(t, { name: 'finished', start: time + getRuntime(agentIdentifier).offset, origin: 'nr' })
|
|
35
|
+
handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.pageAction, instanceEE)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function addToTrace (t, evt) {
|
|
39
|
+
if (!(evt && typeof evt === 'object' && evt.name && evt.start)) return
|
|
40
|
+
|
|
41
|
+
var report = {
|
|
42
|
+
n: evt.name,
|
|
43
|
+
s: evt.start - getRuntime(agentIdentifier).offset,
|
|
44
|
+
e: (evt.end || evt.start) - getRuntime(agentIdentifier).offset,
|
|
45
|
+
o: evt.origin || '',
|
|
46
|
+
t: 'api'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
handle('bstApi', [report], undefined, FEATURE_NAMES.sessionTrace, instanceEE)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// NREUM.inlineHit(request_name, queue_time, app_time, total_be_time, dom_time, fe_time)
|
|
53
|
+
//
|
|
54
|
+
// request_name - the 'web page' name or service name
|
|
55
|
+
// queue_time - the amount of time spent in the app tier queue
|
|
56
|
+
// app_time - the amount of time spent in the application code
|
|
57
|
+
// total_be_time - the total roundtrip time of the remote service call
|
|
58
|
+
// dom_time - the time spent processing the result of the service call (or user defined)
|
|
59
|
+
// fe_time - the time spent rendering the result of the service call (or user defined)
|
|
60
|
+
function inlineHit (t, request_name, queue_time, app_time, total_be_time, dom_time, fe_time) {
|
|
61
|
+
if (!isBrowserScope) return
|
|
62
|
+
|
|
63
|
+
request_name = window.encodeURIComponent(request_name)
|
|
64
|
+
cycle += 1
|
|
65
|
+
|
|
66
|
+
const agentInfo = getInfo(agentIdentifier)
|
|
67
|
+
if (!agentInfo.beacon) return
|
|
68
|
+
|
|
69
|
+
var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey
|
|
70
|
+
|
|
71
|
+
url += '?a=' + agentInfo.applicationID + '&'
|
|
72
|
+
url += 't=' + request_name + '&'
|
|
73
|
+
url += 'qt=' + ~~queue_time + '&'
|
|
74
|
+
url += 'ap=' + ~~app_time + '&'
|
|
75
|
+
url += 'be=' + ~~total_be_time + '&'
|
|
76
|
+
url += 'dc=' + ~~dom_time + '&'
|
|
77
|
+
url += 'fe=' + ~~fe_time + '&'
|
|
78
|
+
url += 'c=' + cycle
|
|
79
|
+
|
|
80
|
+
submitData.img(url)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function setErrorHandler (t, handler) {
|
|
84
|
+
getRuntime(agentIdentifier).onerror = handler
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var releaseCount = 0
|
|
88
|
+
function addRelease (t, name, id) {
|
|
89
|
+
if (++releaseCount > 10) return
|
|
90
|
+
getRuntime(agentIdentifier).releaseIds[name.slice(-200)] = ('' + id).slice(-200)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Agent } from './agent'
|
|
2
|
+
|
|
3
|
+
import { Instrument as InstrumentPageViewEvent } from '../features/page_view_event/instrument'
|
|
4
|
+
import { Instrument as InstrumentPageViewTiming } from '../features/page_view_timing/instrument'
|
|
5
|
+
import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
|
|
6
|
+
import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
|
|
7
|
+
import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
|
|
8
|
+
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
|
|
9
|
+
import { Instrument as InstrumentSpa } from '../features/spa/instrument'
|
|
10
|
+
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* An agent class with all feature modules available. Features may be disabled and enabled via runtime configuration.
|
|
14
|
+
* The BrowserAgent class is the most convenient and reliable option for most use cases.
|
|
15
|
+
*/
|
|
16
|
+
export class BrowserAgent extends Agent {
|
|
17
|
+
constructor (args) {
|
|
18
|
+
super({
|
|
19
|
+
...args,
|
|
20
|
+
features: [
|
|
21
|
+
InstrumentXhr,
|
|
22
|
+
InstrumentPageViewEvent,
|
|
23
|
+
InstrumentPageViewTiming,
|
|
24
|
+
InstrumentSessionTrace,
|
|
25
|
+
InstrumentMetrics,
|
|
26
|
+
InstrumentPageAction,
|
|
27
|
+
InstrumentErrors,
|
|
28
|
+
InstrumentSpa
|
|
29
|
+
],
|
|
30
|
+
loaderType: 'browser-agent'
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { setAPI, setTopLevelCallers, CUSTOM_ATTR_GROUP } from '../api/api'
|
|
2
|
+
import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum'
|
|
3
|
+
import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config'
|
|
4
|
+
import { activateFeatures, activatedFeatures } from '../../common/util/feature-flags'
|
|
5
|
+
import { isBrowserScope, isWorkerScope } from '../../common/util/global-scope'
|
|
6
|
+
import { getAllStorageItemsOfGroup } from '../../common/window/session-storage'
|
|
7
|
+
|
|
8
|
+
export function configure (agentIdentifier, opts = {}, loaderType, forceDrain) {
|
|
9
|
+
let { init, info, loader_config, runtime = { loaderType }, exposed = true } = opts
|
|
10
|
+
const nr = gosCDN()
|
|
11
|
+
if (!info) {
|
|
12
|
+
init = nr.init
|
|
13
|
+
info = nr.info
|
|
14
|
+
loader_config = nr.loader_config
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
info.jsAttributes ??= {}
|
|
18
|
+
if (isWorkerScope) { // add a default attr to all worker payloads
|
|
19
|
+
info.jsAttributes.isWorker = true
|
|
20
|
+
}
|
|
21
|
+
if (isBrowserScope) { // retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
|
|
22
|
+
let prevPageSessionJsAttrs = getAllStorageItemsOfGroup(CUSTOM_ATTR_GROUP)
|
|
23
|
+
Object.assign(info.jsAttributes, prevPageSessionJsAttrs)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setInfo(agentIdentifier, info)
|
|
27
|
+
setConfiguration(agentIdentifier, init || {})
|
|
28
|
+
setLoaderConfig(agentIdentifier, loader_config || {})
|
|
29
|
+
setRuntime(agentIdentifier, runtime)
|
|
30
|
+
|
|
31
|
+
setTopLevelCallers()
|
|
32
|
+
const api = setAPI(agentIdentifier, forceDrain)
|
|
33
|
+
gosNREUMInitializedAgents(agentIdentifier, api, 'api')
|
|
34
|
+
gosNREUMInitializedAgents(agentIdentifier, exposed, 'exposed')
|
|
35
|
+
addToNREUM('activatedFeatures', activatedFeatures)
|
|
36
|
+
addToNREUM('setToken', (flags) => activateFeatures(flags, agentIdentifier))
|
|
37
|
+
|
|
38
|
+
return api
|
|
39
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from './features'
|
|
2
|
+
import { getConfigurationValue, getRuntime } from '../../common/config/config'
|
|
3
|
+
|
|
4
|
+
const featureNames = Object.values(FEATURE_NAMES)
|
|
5
|
+
|
|
6
|
+
function isEnabled (name, agentIdentifier) {
|
|
7
|
+
return getConfigurationValue(agentIdentifier, `${name}.enabled`) !== false
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getEnabledFeatures (agentIdentifier) {
|
|
11
|
+
const enabledFeatures = {}
|
|
12
|
+
featureNames.forEach(featureName => {
|
|
13
|
+
enabledFeatures[featureName] = isEnabled(featureName, agentIdentifier)
|
|
14
|
+
})
|
|
15
|
+
return enabledFeatures
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FEATURE_NAMES } from './features'
|
|
2
|
+
|
|
3
|
+
export function getFeatureDependencyNames (feature) {
|
|
4
|
+
switch (feature) {
|
|
5
|
+
case FEATURE_NAMES.ajax:
|
|
6
|
+
return [FEATURE_NAMES.jserrors]
|
|
7
|
+
case FEATURE_NAMES.sessionTrace:
|
|
8
|
+
return [FEATURE_NAMES.ajax, FEATURE_NAMES.pageViewEvent]
|
|
9
|
+
case FEATURE_NAMES.pageViewTiming:
|
|
10
|
+
return [FEATURE_NAMES.pageViewEvent] // this could change if we disconnect window load timings
|
|
11
|
+
default:
|
|
12
|
+
return []
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getFrozenAttributes (feature) {
|
|
17
|
+
switch (feature) {
|
|
18
|
+
// right now, jserrors is the only feature that can have "on" or "off" page-level auto-instrumentation...
|
|
19
|
+
// page_action is always "off" (no instr)
|
|
20
|
+
// as new API/manual implementation methods are added, this list can likely be pruned
|
|
21
|
+
case FEATURE_NAMES.jserrors:
|
|
22
|
+
return []
|
|
23
|
+
default:
|
|
24
|
+
return ['auto']
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export const FEATURE_NAMES = {
|
|
2
|
+
ajax: 'ajax',
|
|
3
|
+
jserrors: 'jserrors',
|
|
4
|
+
metrics: 'metrics',
|
|
5
|
+
pageAction: 'page_action',
|
|
6
|
+
pageViewEvent: 'page_view_event',
|
|
7
|
+
pageViewTiming: 'page_view_timing',
|
|
8
|
+
sessionTrace: 'session_trace',
|
|
9
|
+
spa: 'spa'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The order in which features will be instrumented. This is the traditional order. It's unclear if the order of
|
|
14
|
+
* wrapping events has any ramifications, so we are enforcing this order intentionally for now.
|
|
15
|
+
*/
|
|
16
|
+
export const featurePriority = {
|
|
17
|
+
[FEATURE_NAMES.pageViewEvent]: 1,
|
|
18
|
+
[FEATURE_NAMES.pageViewTiming]: 2,
|
|
19
|
+
[FEATURE_NAMES.metrics]: 3,
|
|
20
|
+
[FEATURE_NAMES.jserrors]: 4,
|
|
21
|
+
[FEATURE_NAMES.ajax]: 5,
|
|
22
|
+
[FEATURE_NAMES.sessionTrace]: 6,
|
|
23
|
+
[FEATURE_NAMES.pageAction]: 7,
|
|
24
|
+
[FEATURE_NAMES.spa]: 8
|
|
25
|
+
}
|