@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
package/README.md
CHANGED
|
@@ -1,258 +1,174 @@
|
|
|
1
|
-
[](https://opensource.newrelic.com/oss-category/#community-plus)
|
|
2
2
|
|
|
3
3
|
# New Relic Browser Agent
|
|
4
4
|
|
|
5
|
-
The New Relic
|
|
5
|
+
The New Relic browser agent instruments your web application or site and provides observability into performance, errors, and other behaviors.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
- The instructions on this page pertain to installing the browser agent as an NPM package (currently in pre-release).
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- The browser agent is also generally available as a copy-paste JavaScript snippet and via auto-injection by backend apps. See *[Install the browser agent](https://docs.newrelic.com/docs/browser/browser-monitoring/installation/install-browser-monitoring-agent/)* for info on these alternatives.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- For questions and feedback on this pre-release package, please visit the [Explorer's Hub](https://forum.newrelic.com/s/), New Relic's community support forum.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
npm install @newrelic/browser-agent
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
or [yarn](https://yarnpkg.com/)
|
|
13
|
+
- Looking to contribute to the browser agent code base? See [DEVELOPING.md](DEVELOPING.md) for instructions on building and testing the browser agent library, and [CONTRIBUTING.md](CONTRIBUTING.md) for general guidance.
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
yarn add @newrelic/browser-agent
|
|
21
|
-
```
|
|
15
|
+
## Adding the agent package to your project
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
To make the agent available to your application, install via [NPM](https://docs.npmjs.com/cli/v8/commands/npm-install) or [Yarn](https://classic.yarnpkg.com/lang/en/docs/cli/install/).
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
```shell
|
|
20
|
+
$ npm install @newrelic/browser-agent --save
|
|
21
|
+
```
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
```shell
|
|
24
|
+
$ yarn add @newrelic/browser-agent
|
|
25
|
+
```
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
## Creating an app in New Relic One
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
<script src="https://unpkg.com/@newrelic/browser-agent/dist/bundled/es6/index.js"></script>
|
|
33
|
-
```
|
|
29
|
+
Before instrumenting your app using the NPM package, a Browser App should be configured in New Relic One. This may be done with or without a corresponding APM agent. Once the app has been created, the Copy/Paste JavaScript code on the app's *Application settings* page will contain the configuration values needed to define options when instantiating the agent via the NPM package.
|
|
34
30
|
|
|
35
|
-
|
|
31
|
+
1. If a browser app does not already exist, create one:
|
|
32
|
+
- From the *New Relic One* navigation panel, click *Add Data*.
|
|
33
|
+
- Select the *Browser monitoring* data source.
|
|
34
|
+
- Choose the *APM* or *Copy/Paste* method.
|
|
35
|
+
- Select or name your app and click *Enable*.
|
|
36
|
+
2. From the navigation panel, select *Browser* to view brower apps.
|
|
37
|
+
3. Select the desired app and navigate to the *Application settings* page.
|
|
38
|
+
4. From the *Copy/Paste JavaScript* box, copy the configuration values assigned to the `NREUM` object (`init`, `info`, and `loader_config`). You will use these configuration values when instantiating the agent using the NPM package.
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
<script src="https://unpkg.com/@newrelic/browser-agent/dist/bundled/es5/index.js"></script>
|
|
39
|
-
```
|
|
40
|
+
## Instantiating the agent
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
For best results, import and instantiate the `BrowserAgent` class as close to the top of the `head` element of your app's HTML output as possible. The specific location and method will vary based on your application's architecture or framework.
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
Populate the `options` parameter using configuration values found in the the *Copy/Paste JavaScript* box in your browser app's *Application settings* page in New Relic One.
|
|
44
45
|
|
|
45
46
|
```javascript
|
|
46
|
-
|
|
47
|
-
// initialize the agent as close to
|
|
48
|
-
// the top level of the application as possible
|
|
49
|
-
import NR from '@newrelic/browser-agent'
|
|
47
|
+
import { BrowserAgent } from '@newrelic/browser-agent/loaders/browser-agent'
|
|
50
48
|
|
|
49
|
+
// Populate using values in copy-paste JavaScript snippet.
|
|
51
50
|
const options = {
|
|
52
|
-
|
|
51
|
+
init: { ... }, // NREUM.init
|
|
52
|
+
info: { ... }, // NREUM.info
|
|
53
|
+
loader_config: { ...} // NREUM.loader_config
|
|
53
54
|
}
|
|
54
|
-
const nr = new NR()
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
})
|
|
56
|
+
// The agent loader code executes immediately on instantiation.
|
|
57
|
+
new BrowserAgent(options)
|
|
59
58
|
```
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
```javascript
|
|
63
|
-
// << SomeComponent.js >>
|
|
64
|
-
// notice handled errors
|
|
65
|
-
try {
|
|
66
|
-
...
|
|
67
|
-
} catch (err){
|
|
68
|
-
nr.noticeError(err)
|
|
69
|
-
}
|
|
60
|
+
## Turning off features at runtime
|
|
70
61
|
|
|
71
|
-
|
|
72
|
-
```
|
|
62
|
+
Features may be turned off at runtime, which may have a meaningful peformance impact in some cases.
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
```html
|
|
77
|
-
<head>
|
|
78
|
-
<!-- Download and initialize as soon as possible to avoid missing early events -->
|
|
79
|
-
<script src="https://unpkg.com/@newrelic/browser-agent/bundled"></script>
|
|
80
|
-
<script>
|
|
81
|
-
const { BrowserAgent } = NRBA;
|
|
82
|
-
const options = {
|
|
83
|
-
// See 'Configuring your application'
|
|
84
|
-
}
|
|
85
|
-
const agent = new BrowserAgent()
|
|
86
|
-
agent.start(options).then(() => {
|
|
87
|
-
console.log("Browser Agent Initialized!")
|
|
88
|
-
})
|
|
89
|
-
</script>
|
|
90
|
-
</head>
|
|
91
|
-
```
|
|
64
|
+
In the example below, the `page_view_timing` and `session_trace` features are disabled.
|
|
92
65
|
|
|
93
|
-
### Notice Errors after Setup
|
|
94
66
|
```javascript
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
67
|
+
const options = {
|
|
68
|
+
info: { ... },
|
|
69
|
+
loader_config: { ... },
|
|
70
|
+
init: {
|
|
71
|
+
page_view_timing: { enabled: false },
|
|
72
|
+
session_trace: { enabled: false },
|
|
99
73
|
...
|
|
100
|
-
}
|
|
101
|
-
nr.noticeError(err)
|
|
74
|
+
}
|
|
102
75
|
}
|
|
103
|
-
|
|
104
|
-
// thrown errors *anywhere* on the page will be captured if `auto` is enabled
|
|
105
76
|
```
|
|
106
77
|
|
|
107
|
-
|
|
78
|
+
The following features may be disabled by adding `init` entries as shown above. Note that the `page_view_event` feature may not be disabled.
|
|
108
79
|
|
|
109
|
-
|
|
80
|
+
- `ajax`
|
|
81
|
+
- `jserrors`
|
|
82
|
+
- `metrics`
|
|
83
|
+
- `page_action`
|
|
84
|
+
- `page_view_timing`
|
|
85
|
+
- `session_trace`
|
|
86
|
+
- `spa`
|
|
110
87
|
|
|
111
|
-
|
|
112
|
-
// ---- App.js ----
|
|
113
|
-
// Initialize as close to top of page as possible
|
|
114
|
-
import { BrowserAgent } from '@newrelic/browser-agent'
|
|
115
|
-
const options1 = {
|
|
116
|
-
// see 'Configuring your application'
|
|
117
|
-
licenseKey: 'abc',
|
|
118
|
-
applicationID: '123',
|
|
119
|
-
beacon: 'bam.nr-data.net'
|
|
120
|
-
}
|
|
121
|
-
const agent1 = new BrowserAgent()
|
|
122
|
-
agent1.features.errors.enabled = true // this is enabled by default, but just for visibility
|
|
123
|
-
agent1.start(options1).then(() => {
|
|
124
|
-
console.log("Browser Agent (options1) Initialized!")
|
|
125
|
-
})
|
|
88
|
+
See the [New Relic documentation site](https://docs.newrelic.com/docs/browser/browser-monitoring/getting-started/introduction-browser-monitoring/) for information on the above features.
|
|
126
89
|
|
|
127
|
-
const options2 = {
|
|
128
|
-
// see 'Configuring your application'
|
|
129
|
-
licenseKey: 'xyz',
|
|
130
|
-
applicationID: '987',
|
|
131
|
-
beacon: 'bam.nr-data.net'
|
|
132
|
-
}
|
|
133
|
-
const agent2 = new BrowserAgent()
|
|
134
|
-
agent2.features.errors.auto = false // do not capture global errors on this instance
|
|
135
|
-
agent2.start(options2).then(() => {
|
|
136
|
-
console.log("Browser Agent (options2) Initialized!")
|
|
137
|
-
})
|
|
138
90
|
|
|
139
|
-
|
|
140
|
-
// thrown errors *anywhere* on the page will be captured if `auto` is enabled in your instance
|
|
141
|
-
// agent2 has disabled `auto`, and will not capture globally thrown errors
|
|
142
|
-
|
|
143
|
-
// ---- NavBarComponent.js ----
|
|
144
|
-
class MyComponent() {
|
|
145
|
-
try {
|
|
146
|
-
...
|
|
147
|
-
} catch(err) {
|
|
148
|
-
agent1.noticeError(err)
|
|
149
|
-
// agent1 instance
|
|
150
|
-
// reports the error to applicationID '123', licenseKey 'abc'
|
|
151
|
-
}
|
|
152
|
-
}
|
|
91
|
+
## Composing a custom agent with selected feature modules
|
|
153
92
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
...
|
|
158
|
-
} catch(err) {
|
|
159
|
-
agent2.noticeError(err)
|
|
160
|
-
// agent2 instance
|
|
161
|
-
// reports to applicationID '987', licenseKey 'xyz'
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
93
|
+
The examples above use the `BrowserAgent` class, which is the best option for most use cases. The class makes all browser agent features available but provides the ability to turn off individual features selectively.
|
|
94
|
+
|
|
95
|
+
Using the base `Agent` class, it is also possible to compose a custom agent by passing an array called `features` in the `options` object, containing only the desired feature modules. Depending on which features are included, this may yield a smaller loader script and improved performance.
|
|
165
96
|
|
|
166
|
-
|
|
97
|
+
The example below includes three feature modules: `Metrics`, `PageViewEvent`, and `PageViewTiming`.
|
|
167
98
|
|
|
168
|
-
|
|
99
|
+
```javascript
|
|
100
|
+
import { Agent } from '@newrelic/browser-agent/loaders/agent'
|
|
101
|
+
import { Metrics } from '@newrelic/browser-agent/features/metrics'
|
|
102
|
+
import { PageViewEvent } from '@newrelic/browser-agent/features/page_view_event'
|
|
103
|
+
import { PageViewTiming } from '@newrelic/browser-agent/features/page_view_timing'
|
|
169
104
|
|
|
170
|
-
```js
|
|
171
105
|
const options = {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// ... other configurations
|
|
106
|
+
info: { ... },
|
|
107
|
+
loader_config: { ... },
|
|
108
|
+
init: { ... }
|
|
176
109
|
}
|
|
177
|
-
nr.start(options)
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### Get application ID, license key, beacon
|
|
181
|
-
|
|
182
|
-
You can find `licenseKey`, `applicationID` and `beacon` values in the New Relic UI's Browser Application **Settings** page ([one.newrelic.com](https://one.newrelic.com) > Browser > (select an app) > Settings > Application settings.)
|
|
183
|
-
|
|
184
|
-

|
|
185
|
-
|
|
186
|
-
## Features
|
|
187
|
-
|
|
188
|
-
|Feature|Subfeature|Default|Description|
|
|
189
|
-
|-|-|-|-|
|
|
190
|
-
|errors |enabled |true|Enable's `noticeError` method|
|
|
191
|
-
|errors |auto |false|Reports all global errors |
|
|
192
|
-
|
|
193
|
-
> Features must be set before calling the .start() method.
|
|
194
|
-
|
|
195
|
-
### JavaScript Errors
|
|
196
|
-
|
|
197
|
-
This NPM package can currently capture JavaScript Error reporting in two ways. These errors will be reported to the appId & licenseKey specified in your [configuration](#configuring-your-application).
|
|
198
|
-
|
|
199
|
-
```js
|
|
200
|
-
import { BrowserAgent } from '@newrelic/browser-agent'
|
|
201
|
-
const browserAgent = new BrowserAgent()
|
|
202
|
-
|
|
203
|
-
// enable noticeError() API scoped to applicationID (enabled by default)
|
|
204
|
-
browserAgent.features.errors.enabled = true
|
|
205
|
-
|
|
206
|
-
// report global errors to applicationID (enabled by default)
|
|
207
|
-
browserAgent.features.errors.auto = true
|
|
208
|
-
|
|
209
|
-
// configure features before starting the agent
|
|
210
|
-
browserAgent.start(options)
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### Capture JavaScript errors via API
|
|
214
110
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
111
|
+
new Agent({
|
|
112
|
+
...options,
|
|
113
|
+
features: [
|
|
114
|
+
Metrics,
|
|
115
|
+
PageViewEvent,
|
|
116
|
+
PageViewTiming
|
|
117
|
+
]
|
|
118
|
+
})
|
|
218
119
|
```
|
|
219
120
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
### Automatically capture global JavaScript errors
|
|
121
|
+
The following feature modules are available for inclusion in the `features` array:
|
|
223
122
|
|
|
224
123
|
```javascript
|
|
225
|
-
|
|
124
|
+
import { Ajax } from '@newrelic/browser-agent/features/ajax';
|
|
125
|
+
import { JSErrors } from '@newrelic/browser-agent/features/jserrors';
|
|
126
|
+
import { Metrics } from '@newrelic/browser-agent/features/metrics';
|
|
127
|
+
import { PageAction } from '@newrelic/browser-agent/features/page_action';
|
|
128
|
+
import { PageViewEvent } from '@newrelic/browser-agent/features/page_view_event';
|
|
129
|
+
import { PageViewTiming } from '@newrelic/browser-agent/features/page_view_timing';
|
|
130
|
+
import { SessionTrace } from '@newrelic/browser-agent/features/session_trace';
|
|
131
|
+
import { Spa } from '@newrelic/browser-agent/features/spa';
|
|
226
132
|
```
|
|
227
133
|
|
|
228
|
-
|
|
229
|
-
|
|
134
|
+
## Supported Browsers
|
|
230
135
|
|
|
231
|
-
|
|
136
|
+
Our supported browser list can be accessed [here](https://docs.newrelic.com/docs/browser/new-relic-browser/getting-started/compatibility-requirements-browser-monitoring/#browser-types).
|
|
232
137
|
|
|
233
|
-
|
|
138
|
+
If you desire more control over how the agent is built, our package also includes the source code. The source code is written to target the latest ECMAScript standards (ES2022). Please note that if you import the browser agent source code instead of the transpiled distribution code, you may need to alter your project's build system to apply transformations to the browser agent source code. Without these transforms, the code produced by your project's build system may not be compatible with your desired target browsers. Below is an example of how to import the source code.
|
|
234
139
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
| Page Actions | API | API | `None` |
|
|
242
|
-
| Session Traces | Auto | Auto | `None` |
|
|
243
|
-
| Browser Interactions (SPA) | Auto, API | Auto, API | `None` |
|
|
244
|
-
| Multiple Configurable Instances of Browser Agent on One Page | No | No | `Yes` |
|
|
245
|
-
| Configurable Code Splitting | No | No | `Yes` |
|
|
246
|
-
| IDE Code Completion and Typings | No | No | `Yes` |
|
|
140
|
+
```javascript
|
|
141
|
+
// Note the /src/ in the import paths below
|
|
142
|
+
import { Agent } from '@newrelic/browser-agent/src/loaders/agent'
|
|
143
|
+
import { Metrics } from '@newrelic/browser-agent/src/features/metrics'
|
|
144
|
+
import { PageViewEvent } from '@newrelic/browser-agent/src/features/page_view_event'
|
|
145
|
+
import { PageViewTiming } from '@newrelic/browser-agent/src/features/page_view_timing'
|
|
247
146
|
|
|
147
|
+
const options = {
|
|
148
|
+
info: { ... },
|
|
149
|
+
loader_config: { ... },
|
|
150
|
+
init: { ... }
|
|
151
|
+
}
|
|
248
152
|
|
|
249
|
-
|
|
153
|
+
new Agent({
|
|
154
|
+
...options,
|
|
155
|
+
features: [
|
|
156
|
+
Metrics,
|
|
157
|
+
PageViewEvent,
|
|
158
|
+
PageViewTiming
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
```
|
|
250
162
|
|
|
251
|
-
|
|
163
|
+
Neither the browser agent development team nor the New Relic support teams can support the numerous build systems that exist in the JavaScript ecosystem. If you run into issues, you may be asked to revert to importing from the transpiled distribution code.
|
|
252
164
|
|
|
253
|
-
|
|
165
|
+
**DON'T** mix imports between the browser agent source code and transpiled distribution code. The below will break.
|
|
254
166
|
|
|
255
|
-
|
|
167
|
+
```javascript
|
|
168
|
+
// THIS IS BAD - do not do this
|
|
169
|
+
import { Agent } from '@newrelic/browser-agent/loaders/agent'
|
|
170
|
+
import { Metrics } from '@newrelic/browser-agent/src/features/metrics'
|
|
171
|
+
```
|
|
256
172
|
|
|
257
173
|
## License
|
|
258
174
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _agent = require("../loaders/agent");
|
|
4
|
+
var _instrument = require("../features/page_view_event/instrument");
|
|
5
|
+
var _instrument2 = require("../features/page_view_timing/instrument");
|
|
6
|
+
var _instrument3 = require("../features/metrics/instrument");
|
|
7
|
+
/**
|
|
8
|
+
* @file Creates a "Lite" agent loader bundle composed of the core Agent and a subset of available feature modules.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
new _agent.Agent({
|
|
12
|
+
features: [_instrument.Instrument, _instrument2.Instrument, _instrument3.Instrument],
|
|
13
|
+
loaderType: 'lite'
|
|
14
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/stable/promise");
|
|
4
|
+
require("core-js/stable/array/includes");
|
|
5
|
+
require("core-js/stable/array/from");
|
|
6
|
+
require("core-js/stable/array/find");
|
|
7
|
+
require("core-js/stable/array/some");
|
|
8
|
+
require("core-js/stable/object/assign");
|
|
9
|
+
require("core-js/stable/object/entries");
|
|
10
|
+
require("core-js/stable/object/values");
|
|
11
|
+
require("core-js/stable/map");
|
|
12
|
+
require("core-js/stable/reflect");
|
|
13
|
+
require("core-js/stable/set");
|
|
14
|
+
require("core-js/stable/weak-set");
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _agent = require("../loaders/agent");
|
|
4
|
+
var _instrument = require("../features/page_view_event/instrument");
|
|
5
|
+
var _instrument2 = require("../features/page_view_timing/instrument");
|
|
6
|
+
var _instrument3 = require("../features/metrics/instrument");
|
|
7
|
+
var _instrument4 = require("../features/jserrors/instrument");
|
|
8
|
+
var _instrument5 = require("../features/ajax/instrument");
|
|
9
|
+
var _instrument6 = require("../features/session_trace/instrument");
|
|
10
|
+
var _instrument7 = require("../features/page_action/instrument");
|
|
11
|
+
/**
|
|
12
|
+
* @file Creates a "Pro" agent loader bundle composed of the core Agent and all available feature modules except `spa`.
|
|
13
|
+
* This excludes collection of BrowserInteraction and BrowserTiming events.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
new _agent.Agent({
|
|
17
|
+
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument7.Instrument, _instrument4.Instrument],
|
|
18
|
+
loaderType: 'pro'
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _agent = require("../loaders/agent");
|
|
4
|
+
var _instrument = require("../features/page_view_event/instrument");
|
|
5
|
+
var _instrument2 = require("../features/page_view_timing/instrument");
|
|
6
|
+
var _instrument3 = require("../features/metrics/instrument");
|
|
7
|
+
var _instrument4 = require("../features/jserrors/instrument");
|
|
8
|
+
var _instrument5 = require("../features/ajax/instrument");
|
|
9
|
+
var _instrument6 = require("../features/session_trace/instrument");
|
|
10
|
+
var _instrument7 = require("../features/spa/instrument");
|
|
11
|
+
var _instrument8 = require("../features/page_action/instrument");
|
|
12
|
+
/**
|
|
13
|
+
* @file Creates a "SPA" agent loader bundle composed of the core agent and all available feature modules.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
new _agent.Agent({
|
|
17
|
+
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument7.Instrument],
|
|
18
|
+
loaderType: 'spa'
|
|
19
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _agent = require("../loaders/agent");
|
|
4
|
+
var _instrument = require("../features/metrics/instrument");
|
|
5
|
+
var _instrument2 = require("../features/jserrors/instrument");
|
|
6
|
+
var _instrument3 = require("../features/ajax/instrument");
|
|
7
|
+
var _instrument4 = require("../features/page_action/instrument");
|
|
8
|
+
/**
|
|
9
|
+
* @file Creates a "Worker" agent loader bundle composed of the core Agent and the subset of feature modules applicable
|
|
10
|
+
* in a service worker context.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
new _agent.Agent({
|
|
14
|
+
features: [_instrument.Instrument, _instrument2.Instrument, _instrument3.Instrument, _instrument4.Instrument],
|
|
15
|
+
loaderType: 'worker'
|
|
16
|
+
});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Aggregator = void 0;
|
|
7
|
+
var _sharedContext = require("../context/shared-context");
|
|
8
|
+
var _mapOwn = require("../util/map-own");
|
|
9
|
+
/*
|
|
10
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
11
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
class Aggregator extends _sharedContext.SharedContext {
|
|
15
|
+
constructor(parent) {
|
|
16
|
+
super(parent);
|
|
17
|
+
this.aggregatedData = {};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Items with the same type and name get aggregated together
|
|
21
|
+
// params are example data from the aggregated items
|
|
22
|
+
// metrics are the numeric values to be aggregated
|
|
23
|
+
|
|
24
|
+
store(type, name, params, newMetrics, customParams) {
|
|
25
|
+
var bucket = this.getBucket(type, name, params, customParams);
|
|
26
|
+
bucket.metrics = aggregateMetrics(newMetrics, bucket.metrics);
|
|
27
|
+
return bucket;
|
|
28
|
+
}
|
|
29
|
+
merge(type, name, metrics, params, customParams) {
|
|
30
|
+
var bucket = this.getBucket(type, name, params, customParams);
|
|
31
|
+
if (!bucket.metrics) {
|
|
32
|
+
bucket.metrics = metrics;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
var oldMetrics = bucket.metrics;
|
|
36
|
+
oldMetrics.count += metrics.count;
|
|
37
|
+
|
|
38
|
+
// iterate through each new metric and merge
|
|
39
|
+
(0, _mapOwn.mapOwn)(metrics, function (key, value) {
|
|
40
|
+
// count is a special case handled above
|
|
41
|
+
if (key === 'count') return;
|
|
42
|
+
var oldMetric = oldMetrics[key];
|
|
43
|
+
var newMetric = metrics[key];
|
|
44
|
+
|
|
45
|
+
// handling the case where newMetric is a single-value first
|
|
46
|
+
if (newMetric && !newMetric.c) {
|
|
47
|
+
oldMetrics[key] = updateMetric(newMetric.t, oldMetric);
|
|
48
|
+
} else {
|
|
49
|
+
// newMetric is a metric object
|
|
50
|
+
oldMetrics[key] = mergeMetric(newMetric, oldMetrics[key]);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
storeMetric(type, name, params, value) {
|
|
55
|
+
var bucket = this.getBucket(type, name, params);
|
|
56
|
+
bucket.stats = updateMetric(value, bucket.stats);
|
|
57
|
+
return bucket;
|
|
58
|
+
}
|
|
59
|
+
getBucket(type, name, params, customParams) {
|
|
60
|
+
if (!this.aggregatedData[type]) this.aggregatedData[type] = {};
|
|
61
|
+
var bucket = this.aggregatedData[type][name];
|
|
62
|
+
if (!bucket) {
|
|
63
|
+
bucket = this.aggregatedData[type][name] = {
|
|
64
|
+
params: params || {}
|
|
65
|
+
};
|
|
66
|
+
if (customParams) {
|
|
67
|
+
bucket.custom = customParams;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return bucket;
|
|
71
|
+
}
|
|
72
|
+
get(type, name) {
|
|
73
|
+
// if name is passed, get a single bucket
|
|
74
|
+
if (name) return this.aggregatedData[type] && this.aggregatedData[type][name];
|
|
75
|
+
// else, get all buckets of that type
|
|
76
|
+
return this.aggregatedData[type];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// Like get, but for many types and it deletes the retrieved content from the aggregatedData
|
|
80
|
+
take(types) {
|
|
81
|
+
var results = {};
|
|
82
|
+
var type = '';
|
|
83
|
+
var hasData = false;
|
|
84
|
+
for (var i = 0; i < types.length; i++) {
|
|
85
|
+
type = types[i];
|
|
86
|
+
results[type] = toArray(this.aggregatedData[type]);
|
|
87
|
+
if (results[type].length) hasData = true;
|
|
88
|
+
delete this.aggregatedData[type];
|
|
89
|
+
}
|
|
90
|
+
return hasData ? results : null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.Aggregator = Aggregator;
|
|
94
|
+
function aggregateMetrics(newMetrics, oldMetrics) {
|
|
95
|
+
if (!oldMetrics) oldMetrics = {
|
|
96
|
+
count: 0
|
|
97
|
+
};
|
|
98
|
+
oldMetrics.count += 1;
|
|
99
|
+
(0, _mapOwn.mapOwn)(newMetrics, function (key, value) {
|
|
100
|
+
oldMetrics[key] = updateMetric(value, oldMetrics[key]);
|
|
101
|
+
});
|
|
102
|
+
return oldMetrics;
|
|
103
|
+
}
|
|
104
|
+
function updateMetric(value, metric) {
|
|
105
|
+
// when there is no value, then send only count
|
|
106
|
+
if (value == null) {
|
|
107
|
+
return updateCounterMetric(metric);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// When there is only one data point, the c (count), min, max, and sos (sum of squares) params are superfluous.
|
|
111
|
+
if (!metric) return {
|
|
112
|
+
t: value
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
// but on the second data point, we need to calculate the other values before aggregating in new values
|
|
116
|
+
if (!metric.c) {
|
|
117
|
+
metric = createMetricObject(metric.t);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// at this point, metric is always uncondensed
|
|
121
|
+
metric.c += 1;
|
|
122
|
+
metric.t += value;
|
|
123
|
+
metric.sos += value * value;
|
|
124
|
+
if (value > metric.max) metric.max = value;
|
|
125
|
+
if (value < metric.min) metric.min = value;
|
|
126
|
+
return metric;
|
|
127
|
+
}
|
|
128
|
+
function updateCounterMetric(metric) {
|
|
129
|
+
if (!metric) {
|
|
130
|
+
metric = {
|
|
131
|
+
c: 1
|
|
132
|
+
};
|
|
133
|
+
} else {
|
|
134
|
+
metric.c++;
|
|
135
|
+
}
|
|
136
|
+
return metric;
|
|
137
|
+
}
|
|
138
|
+
function mergeMetric(newMetric, oldMetric) {
|
|
139
|
+
if (!oldMetric) return newMetric;
|
|
140
|
+
if (!oldMetric.c) {
|
|
141
|
+
// oldMetric is a single-value
|
|
142
|
+
oldMetric = createMetricObject(oldMetric.t);
|
|
143
|
+
}
|
|
144
|
+
oldMetric.min = Math.min(newMetric.min, oldMetric.min);
|
|
145
|
+
oldMetric.max = Math.max(newMetric.max, oldMetric.max);
|
|
146
|
+
oldMetric.t += newMetric.t;
|
|
147
|
+
oldMetric.sos += newMetric.sos;
|
|
148
|
+
oldMetric.c += newMetric.c;
|
|
149
|
+
return oldMetric;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// take a value and create a metric object
|
|
153
|
+
function createMetricObject(value) {
|
|
154
|
+
return {
|
|
155
|
+
t: value,
|
|
156
|
+
min: value,
|
|
157
|
+
max: value,
|
|
158
|
+
sos: value * value,
|
|
159
|
+
c: 1
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
function toArray(obj) {
|
|
163
|
+
if (typeof obj !== 'object') return [];
|
|
164
|
+
return (0, _mapOwn.mapOwn)(obj, getValue);
|
|
165
|
+
}
|
|
166
|
+
function getValue(key, value) {
|
|
167
|
+
return value;
|
|
168
|
+
}
|