@newrelic/browser-agent 0.1.229 → 0.1.231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -2
- package/dist/cjs/common/browser-version/ios-version.js +4 -3
- package/dist/cjs/common/config/state/configurable.js +3 -2
- package/dist/cjs/common/config/state/info.js +1 -1
- package/dist/cjs/common/config/state/init.js +1 -1
- package/dist/cjs/common/config/state/loader-config.js +1 -1
- package/dist/cjs/common/config/state/runtime.js +6 -5
- package/dist/cjs/common/constants/env.cdn.js +29 -0
- package/dist/cjs/common/constants/env.js +32 -0
- package/dist/cjs/common/constants/env.npm.js +30 -0
- package/dist/cjs/common/context/shared-context.js +2 -1
- package/dist/cjs/common/drain/drain.js +9 -3
- package/dist/cjs/common/event-emitter/contextual-ee.test.js +282 -0
- package/dist/cjs/common/event-emitter/handle.test.js +58 -0
- package/dist/cjs/common/event-emitter/register-handler.test.js +55 -0
- package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
- package/dist/cjs/common/harvest/harvest-scheduler.js +2 -1
- package/dist/cjs/common/harvest/harvest.js +15 -4
- package/dist/cjs/common/ids/id.js +14 -6
- package/dist/cjs/common/ids/id.test.js +85 -0
- package/dist/cjs/common/ids/unique-id.js +75 -51
- package/dist/cjs/common/ids/unique-id.test.js +49 -0
- package/dist/cjs/common/timing/nav-timing.js +51 -30
- package/dist/cjs/common/timing/nav-timing.test.js +192 -0
- package/dist/cjs/common/url/clean-url.test.js +9 -0
- package/dist/cjs/common/url/encode.test.js +74 -0
- package/dist/cjs/common/url/location.js +4 -0
- package/dist/cjs/common/url/location.test.js +13 -0
- package/dist/cjs/common/url/parse-url.test.js +111 -0
- package/dist/cjs/common/url/protocol.js +2 -12
- package/dist/cjs/common/url/protocol.test.js +16 -0
- package/dist/cjs/common/util/console.js +2 -2
- package/dist/cjs/common/util/map-own.js +21 -14
- package/dist/cjs/common/util/map-own.test.js +49 -0
- package/dist/cjs/common/util/obfuscate.js +1 -1
- package/dist/cjs/common/util/submit-data.js +11 -3
- package/dist/cjs/common/window/page-visibility.js +4 -2
- package/dist/cjs/common/window/session-storage.js +56 -11
- package/dist/cjs/common/wrap/index.js +4 -4
- package/dist/cjs/common/wrap/wrap-events.js +10 -10
- package/dist/cjs/common/wrap/wrap-fetch.js +6 -8
- package/dist/cjs/common/wrap/wrap-function.js +4 -18
- package/dist/cjs/common/wrap/wrap-history.js +7 -6
- package/dist/cjs/common/wrap/wrap-jsonp.js +7 -6
- package/dist/cjs/common/wrap/wrap-mutation.js +7 -6
- package/dist/cjs/common/wrap/wrap-promise.js +11 -7
- package/dist/cjs/common/wrap/wrap-promise.test.js +119 -0
- package/dist/cjs/common/wrap/wrap-raf.js +6 -6
- package/dist/cjs/common/wrap/wrap-timer.js +6 -6
- package/dist/cjs/common/wrap/wrap-xhr.js +5 -6
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +2 -1
- package/dist/cjs/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/cjs/features/jserrors/aggregate/index.js +35 -14
- package/dist/cjs/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/cjs/features/jserrors/instrument/index.js +9 -12
- package/dist/cjs/features/metrics/aggregate/index.js +16 -6
- package/dist/cjs/features/metrics/instrument/index.js +2 -1
- package/dist/cjs/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/cjs/features/page_action/aggregate/index.js +12 -4
- package/dist/cjs/features/page_action/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +25 -10
- package/dist/cjs/features/page_view_event/instrument/index.js +2 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/cjs/features/page_view_timing/instrument/index.js +2 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +69 -26
- package/dist/cjs/features/session_trace/instrument/index.js +2 -1
- package/dist/cjs/features/spa/instrument/index.js +2 -1
- package/dist/cjs/features/utils/instrument-base.js +8 -3
- package/dist/cjs/features/utils/lazy-loader.js +1 -1
- package/dist/cjs/index.js +9 -9
- package/dist/cjs/loaders/agent.js +3 -2
- package/dist/cjs/loaders/api/api.js +90 -22
- package/dist/cjs/loaders/api/apiAsync.js +3 -3
- package/dist/cjs/loaders/configure/configure.js +13 -7
- package/dist/cjs/loaders/features/enabled-features.js +1 -1
- package/dist/cjs/loaders/micro-agent.js +20 -14
- package/dist/esm/common/browser-version/ios-version.js +4 -3
- package/dist/esm/common/config/state/configurable.js +3 -2
- package/dist/esm/common/config/state/info.js +1 -1
- package/dist/esm/common/config/state/init.js +1 -1
- package/dist/esm/common/config/state/loader-config.js +1 -1
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +20 -0
- package/dist/esm/common/constants/env.js +23 -0
- package/dist/esm/common/constants/env.npm.js +21 -0
- package/dist/esm/common/context/shared-context.js +2 -1
- package/dist/esm/common/drain/drain.js +9 -3
- package/dist/esm/common/event-emitter/contextual-ee.test.js +278 -0
- package/dist/esm/common/event-emitter/handle.test.js +54 -0
- package/dist/esm/common/event-emitter/register-handler.test.js +51 -0
- package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
- package/dist/esm/common/harvest/harvest-scheduler.js +2 -1
- package/dist/esm/common/harvest/harvest.js +14 -3
- package/dist/esm/common/ids/id.js +16 -6
- package/dist/esm/common/ids/id.test.js +81 -0
- package/dist/esm/common/ids/unique-id.js +75 -51
- package/dist/esm/common/ids/unique-id.test.js +44 -0
- package/dist/esm/common/timing/nav-timing.js +51 -29
- package/dist/esm/common/timing/nav-timing.test.js +190 -0
- package/dist/esm/common/url/clean-url.test.js +7 -0
- package/dist/esm/common/url/encode.test.js +70 -0
- package/dist/esm/common/url/location.js +4 -0
- package/dist/esm/common/url/location.test.js +11 -0
- package/dist/esm/common/url/parse-url.test.js +107 -0
- package/dist/esm/common/url/protocol.js +3 -12
- package/dist/esm/common/url/protocol.test.js +14 -0
- package/dist/esm/common/util/console.js +2 -2
- package/dist/esm/common/util/map-own.js +19 -13
- package/dist/esm/common/util/map-own.test.js +47 -0
- package/dist/esm/common/util/obfuscate.js +2 -2
- package/dist/esm/common/util/submit-data.js +11 -3
- package/dist/esm/common/window/page-visibility.js +4 -2
- package/dist/esm/common/window/session-storage.js +54 -13
- package/dist/esm/common/wrap/index.js +3 -3
- package/dist/esm/common/wrap/wrap-events.js +11 -11
- package/dist/esm/common/wrap/wrap-fetch.js +7 -9
- package/dist/esm/common/wrap/wrap-function.js +4 -17
- package/dist/esm/common/wrap/wrap-history.js +8 -7
- package/dist/esm/common/wrap/wrap-jsonp.js +8 -7
- package/dist/esm/common/wrap/wrap-mutation.js +7 -6
- package/dist/esm/common/wrap/wrap-promise.js +11 -7
- package/dist/esm/common/wrap/wrap-promise.test.js +115 -0
- package/dist/esm/common/wrap/wrap-raf.js +7 -7
- package/dist/esm/common/wrap/wrap-timer.js +7 -7
- package/dist/esm/common/wrap/wrap-xhr.js +7 -8
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +2 -1
- package/dist/esm/features/jserrors/aggregate/canonical-function-name.test.js +5 -4
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +1 -2
- package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +5 -5
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.test.js +6 -5
- package/dist/esm/features/jserrors/aggregate/index.js +35 -14
- package/dist/esm/features/jserrors/aggregate/string-hash-code.test.js +5 -4
- package/dist/esm/features/jserrors/instrument/index.js +9 -12
- package/dist/esm/features/metrics/aggregate/index.js +17 -7
- package/dist/esm/features/metrics/instrument/index.js +2 -1
- package/dist/esm/features/metrics/instrument/workers-helper.js +9 -6
- package/dist/esm/features/page_action/aggregate/index.js +12 -4
- package/dist/esm/features/page_action/instrument/index.js +2 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +25 -10
- package/dist/esm/features/page_view_event/instrument/index.js +2 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +90 -61
- package/dist/esm/features/page_view_timing/instrument/index.js +2 -1
- package/dist/esm/features/session_trace/aggregate/index.js +69 -26
- package/dist/esm/features/session_trace/instrument/index.js +2 -1
- package/dist/esm/features/spa/instrument/index.js +2 -1
- package/dist/esm/features/utils/instrument-base.js +3 -2
- package/dist/esm/features/utils/lazy-loader.js +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/loaders/agent.js +3 -2
- package/dist/esm/loaders/api/api.js +85 -21
- package/dist/esm/loaders/api/apiAsync.js +3 -3
- package/dist/esm/loaders/configure/configure.js +14 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +18 -13
- package/dist/types/cdn/lite.d.ts +2 -0
- package/dist/types/cdn/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/lite.d.ts +2 -0
- package/dist/types/cdn/polyfills/lite.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/pro.d.ts +2 -0
- package/dist/types/cdn/polyfills/pro.d.ts.map +1 -0
- package/dist/types/cdn/polyfills/spa.d.ts +2 -0
- package/dist/types/cdn/polyfills/spa.d.ts.map +1 -0
- package/dist/types/cdn/polyfills.d.ts +2 -0
- package/dist/types/cdn/polyfills.d.ts.map +1 -0
- package/dist/types/cdn/pro.d.ts +2 -0
- package/dist/types/cdn/pro.d.ts.map +1 -0
- package/dist/types/cdn/spa.d.ts +2 -0
- package/dist/types/cdn/spa.d.ts.map +1 -0
- package/dist/types/cdn/worker.d.ts +2 -0
- package/dist/types/cdn/worker.d.ts.map +1 -0
- package/dist/types/common/aggregate/aggregator.d.ts +11 -0
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -0
- package/dist/types/common/browser-version/firefox-version.d.ts +2 -0
- package/dist/types/common/browser-version/firefox-version.d.ts.map +1 -0
- package/dist/types/common/browser-version/ios-version.d.ts +3 -0
- package/dist/types/common/browser-version/ios-version.d.ts.map +1 -0
- package/dist/types/common/config/config.d.ts +13 -0
- package/dist/types/common/config/config.d.ts.map +1 -0
- package/dist/types/common/config/state/configurable.d.ts +4 -0
- package/dist/types/common/config/state/configurable.d.ts.map +1 -0
- package/dist/types/common/config/state/info.d.ts +4 -0
- package/dist/types/common/config/state/info.d.ts.map +1 -0
- package/dist/types/common/config/state/init.d.ts +4 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -0
- package/dist/types/common/config/state/loader-config.d.ts +3 -0
- package/dist/types/common/config/state/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/state/originals.d.ts +2 -0
- package/dist/types/common/config/state/originals.d.ts.map +1 -0
- package/dist/types/common/config/state/runtime.d.ts +3 -0
- package/dist/types/common/config/state/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/env.cdn.d.ts +18 -0
- package/dist/types/common/constants/env.cdn.d.ts.map +1 -0
- package/dist/types/common/constants/env.d.ts +13 -0
- package/dist/types/common/constants/env.d.ts.map +1 -0
- package/dist/types/common/constants/env.npm.d.ts +19 -0
- package/dist/types/common/constants/env.npm.d.ts.map +1 -0
- package/dist/types/common/context/shared-context.d.ts +5 -0
- package/dist/types/common/context/shared-context.d.ts.map +1 -0
- package/dist/types/common/deny-list/deny-list.d.ts +12 -0
- package/dist/types/common/deny-list/deny-list.d.ts.map +1 -0
- package/dist/types/common/drain/drain.d.ts +17 -0
- package/dist/types/common/drain/drain.d.ts.map +1 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts +4 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -0
- package/dist/types/common/event-emitter/handle.d.ts +3 -0
- package/dist/types/common/event-emitter/handle.d.ts.map +1 -0
- package/dist/types/common/event-emitter/register-handler.d.ts +8 -0
- package/dist/types/common/event-emitter/register-handler.d.ts.map +1 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts +10 -0
- package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts +21 -0
- package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -0
- package/dist/types/common/harvest/harvest.d.ts +58 -0
- package/dist/types/common/harvest/harvest.d.ts.map +1 -0
- package/dist/types/common/ids/id.d.ts +12 -0
- package/dist/types/common/ids/id.d.ts.map +1 -0
- package/dist/types/common/ids/unique-id.d.ts +28 -0
- package/dist/types/common/ids/unique-id.d.ts.map +1 -0
- package/dist/types/common/metrics/framework-detection.d.ts +2 -0
- package/dist/types/common/metrics/framework-detection.d.ts.map +1 -0
- package/dist/types/common/metrics/paint-metrics.d.ts +2 -0
- package/dist/types/common/metrics/paint-metrics.d.ts.map +1 -0
- package/dist/types/common/serialize/bel-serializer.d.ts +5 -0
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -0
- package/dist/types/common/timing/nav-timing.d.ts +4 -0
- package/dist/types/common/timing/nav-timing.d.ts.map +1 -0
- package/dist/types/common/timing/now.d.ts +2 -0
- package/dist/types/common/timing/now.d.ts.map +1 -0
- package/dist/types/common/unload/eol.d.ts +8 -0
- package/dist/types/common/unload/eol.d.ts.map +1 -0
- package/dist/types/common/url/clean-url.d.ts +2 -0
- package/dist/types/common/url/clean-url.d.ts.map +1 -0
- package/dist/types/common/url/encode.d.ts +5 -0
- package/dist/types/common/url/encode.d.ts.map +1 -0
- package/dist/types/common/url/location.d.ts +6 -0
- package/dist/types/common/url/location.d.ts.map +1 -0
- package/dist/types/common/url/parse-url.d.ts +2 -0
- package/dist/types/common/url/parse-url.d.ts.map +1 -0
- package/dist/types/common/url/protocol.d.ts +2 -0
- package/dist/types/common/url/protocol.d.ts.map +1 -0
- package/dist/types/common/util/console.d.ts +8 -0
- package/dist/types/common/util/console.d.ts.map +1 -0
- package/dist/types/common/util/data-size.d.ts +2 -0
- package/dist/types/common/util/data-size.d.ts.map +1 -0
- package/dist/types/common/util/feature-flags.d.ts +3 -0
- package/dist/types/common/util/feature-flags.d.ts.map +1 -0
- package/dist/types/common/util/get-or-set.d.ts +2 -0
- package/dist/types/common/util/get-or-set.d.ts.map +1 -0
- package/dist/types/common/util/global-scope.d.ts +13 -0
- package/dist/types/common/util/global-scope.d.ts.map +1 -0
- package/dist/types/common/util/map-own.d.ts +3 -0
- package/dist/types/common/util/map-own.d.ts.map +1 -0
- package/dist/types/common/util/obfuscate.d.ts +8 -0
- package/dist/types/common/util/obfuscate.d.ts.map +1 -0
- package/dist/types/common/util/s-hash.d.ts +2 -0
- package/dist/types/common/util/s-hash.d.ts.map +1 -0
- package/dist/types/common/util/single.d.ts +2 -0
- package/dist/types/common/util/single.d.ts.map +1 -0
- package/dist/types/common/util/stringify.d.ts +8 -0
- package/dist/types/common/util/stringify.d.ts.map +1 -0
- package/dist/types/common/util/submit-data.d.ts +35 -0
- package/dist/types/common/util/submit-data.d.ts.map +1 -0
- package/dist/types/common/util/traverse.d.ts +2 -0
- package/dist/types/common/util/traverse.d.ts.map +1 -0
- package/dist/types/common/util/user-agent.d.ts +5 -0
- package/dist/types/common/util/user-agent.d.ts.map +1 -0
- package/dist/types/common/window/load.d.ts +3 -0
- package/dist/types/common/window/load.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts +14 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -0
- package/dist/types/common/window/page-visibility.d.ts +7 -0
- package/dist/types/common/window/page-visibility.d.ts.map +1 -0
- package/dist/types/common/window/session-storage.d.ts +18 -0
- package/dist/types/common/window/session-storage.d.ts.map +1 -0
- package/dist/types/common/window/supports-performance-observer.d.ts +2 -0
- package/dist/types/common/window/supports-performance-observer.d.ts.map +1 -0
- package/dist/types/common/wrap/index.d.ts +11 -0
- package/dist/types/common/wrap/index.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-events.d.ts +17 -0
- package/dist/types/common/wrap/wrap-events.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts +18 -0
- package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-function.d.ts +28 -0
- package/dist/types/common/wrap/wrap-function.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-history.d.ts +16 -0
- package/dist/types/common/wrap/wrap-history.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts +16 -0
- package/dist/types/common/wrap/wrap-jsonp.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts +16 -0
- package/dist/types/common/wrap/wrap-mutation.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-promise.d.ts +17 -0
- package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-raf.d.ts +16 -0
- package/dist/types/common/wrap/wrap-raf.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-timer.d.ts +17 -0
- package/dist/types/common/wrap/wrap-timer.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts +16 -0
- package/dist/types/common/wrap/wrap-xhr.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts +16 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/ajax/constants.d.ts +2 -0
- package/dist/types/features/ajax/constants.d.ts.map +1 -0
- package/dist/types/features/ajax/index.d.ts +2 -0
- package/dist/types/features/ajax/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts +19 -0
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts +9 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts +2 -0
- package/dist/types/features/ajax/instrument/response-size.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +22 -0
- package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts +3 -0
- package/dist/types/features/jserrors/aggregate/format-stack-trace.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts +24 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts +2 -0
- package/dist/types/features/jserrors/aggregate/string-hash-code.d.ts.map +1 -0
- package/dist/types/features/jserrors/constants.d.ts +3 -0
- package/dist/types/features/jserrors/constants.d.ts.map +1 -0
- package/dist/types/features/jserrors/index.d.ts +2 -0
- package/dist/types/features/jserrors/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts +2 -0
- package/dist/types/features/jserrors/instrument/debug.d.ts.map +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts +22 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/aggregate/index.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts +6 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -0
- package/dist/types/features/metrics/index.d.ts +2 -0
- package/dist/types/features/metrics/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts +6 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts +7 -0
- package/dist/types/features/metrics/instrument/workers-helper.d.ts.map +1 -0
- package/dist/types/features/page_action/aggregate/index.d.ts +24 -0
- package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_action/constants.d.ts +2 -0
- package/dist/types/features/page_action/constants.d.ts.map +1 -0
- package/dist/types/features/page_action/index.d.ts +2 -0
- package/dist/types/features/page_action/index.d.ts.map +1 -0
- package/dist/types/features/page_action/instrument/index.d.ts +6 -0
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts +9 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts +8 -0
- package/dist/types/features/page_view_event/aggregate/initialized-features.d.ts.map +1 -0
- package/dist/types/features/page_view_event/constants.d.ts +5 -0
- package/dist/types/features/page_view_event/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_event/index.d.ts +2 -0
- package/dist/types/features/page_view_event/index.d.ts.map +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +32 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/constants.d.ts +2 -0
- package/dist/types/features/page_view_timing/constants.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts +2 -0
- package/dist/types/features/page_view_timing/first-paint.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts +6 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts +2 -0
- package/dist/types/features/page_view_timing/long-tasks.d.ts.map +1 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts +77 -0
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/constants.d.ts +13 -0
- package/dist/types/features/session_trace/constants.d.ts.map +1 -0
- package/dist/types/features/session_trace/index.d.ts +2 -0
- package/dist/types/features/session_trace/index.d.ts.map +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts +11 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/index.d.ts +25 -0
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts +15 -0
- package/dist/types/features/spa/aggregate/interaction-node.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts +20 -0
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts +15 -0
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -0
- package/dist/types/features/spa/constants.d.ts +23 -0
- package/dist/types/features/spa/constants.d.ts.map +1 -0
- package/dist/types/features/spa/index.d.ts +2 -0
- package/dist/types/features/spa/index.d.ts.map +1 -0
- package/dist/types/features/spa/instrument/index.d.ts +8 -0
- package/dist/types/features/spa/instrument/index.d.ts.map +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts +4 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
- package/dist/types/features/utils/feature-base.d.ts +23 -0
- package/dist/types/features/utils/feature-base.d.ts.map +1 -0
- package/dist/types/features/utils/handler-cache.d.ts +22 -0
- package/dist/types/features/utils/handler-cache.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +27 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -0
- package/dist/types/features/utils/lazy-loader.d.ts +13 -0
- package/dist/types/features/utils/lazy-loader.d.ts.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/loaders/agent.d.ts +20 -0
- package/dist/types/loaders/agent.d.ts.map +1 -0
- package/dist/types/loaders/api/api.d.ts +17 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -0
- package/dist/types/loaders/api/apiAsync.d.ts +2 -0
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -0
- package/dist/types/loaders/browser-agent.d.ts +9 -0
- package/dist/types/loaders/browser-agent.d.ts.map +1 -0
- package/dist/types/loaders/configure/configure.d.ts +10 -0
- package/dist/types/loaders/configure/configure.d.ts.map +1 -0
- package/dist/types/loaders/features/enabled-features.d.ts +2 -0
- package/dist/types/loaders/features/enabled-features.d.ts.map +1 -0
- package/dist/types/loaders/features/featureDependencies.d.ts +3 -0
- package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -0
- package/dist/types/loaders/features/features.d.ts +18 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -0
- package/dist/types/loaders/micro-agent.d.ts +25 -0
- package/dist/types/loaders/micro-agent.d.ts.map +1 -0
- package/dist/types/loaders/worker-agent.d.ts +8 -0
- package/dist/types/loaders/worker-agent.d.ts.map +1 -0
- package/package.json +67 -59
- package/src/cdn/lite.js +18 -0
- package/src/cdn/polyfills/lite.js +7 -0
- package/src/cdn/polyfills/pro.js +7 -0
- package/src/cdn/polyfills/spa.js +7 -0
- package/src/cdn/polyfills.js +17 -0
- package/src/cdn/pro.js +27 -0
- package/src/cdn/spa.js +28 -0
- package/src/cdn/worker.js +21 -0
- package/src/common/aggregate/aggregator.js +171 -0
- package/src/common/browser-version/firefox-version.js +10 -0
- package/src/common/browser-version/ios-version.js +11 -0
- package/src/common/config/config.js +12 -0
- package/src/common/config/state/configurable.js +26 -0
- package/src/common/config/state/info.js +49 -0
- package/src/common/config/state/init.js +56 -0
- package/src/common/config/state/loader-config.js +25 -0
- package/src/common/config/state/originals.js +3 -0
- package/src/common/config/state/runtime.js +47 -0
- package/src/common/constants/env.cdn.js +20 -0
- package/src/common/constants/env.js +23 -0
- package/src/common/constants/env.npm.js +21 -0
- package/src/common/context/shared-context.js +21 -0
- package/src/common/deny-list/deny-list.js +116 -0
- package/src/common/drain/drain.js +119 -0
- package/src/common/event-emitter/contextual-ee.js +159 -0
- package/src/common/event-emitter/contextual-ee.test.js +310 -0
- package/src/common/event-emitter/handle.js +17 -0
- package/src/common/event-emitter/handle.test.js +56 -0
- package/src/common/event-emitter/register-handler.js +25 -0
- package/src/common/event-emitter/register-handler.test.js +61 -0
- package/src/common/event-listener/event-listener-opts.js +41 -0
- package/src/common/harvest/harvest-scheduler.js +112 -0
- package/src/common/harvest/harvest.js +248 -0
- package/src/common/ids/id.js +32 -0
- package/src/common/ids/id.test.js +92 -0
- package/src/common/ids/unique-id.js +104 -0
- package/src/common/ids/unique-id.test.js +58 -0
- package/src/common/metrics/framework-detection.js +71 -0
- package/src/common/metrics/paint-metrics.js +6 -0
- package/src/common/serialize/bel-serializer.js +93 -0
- package/src/common/timing/nav-timing.js +90 -0
- package/src/common/timing/nav-timing.test.js +161 -0
- package/src/common/timing/now.js +9 -0
- package/src/common/unload/eol.js +62 -0
- package/src/common/url/clean-url.js +10 -0
- package/src/common/url/clean-url.test.js +25 -0
- package/src/common/url/encode.js +75 -0
- package/src/common/url/encode.test.js +80 -0
- package/src/common/url/location.js +12 -0
- package/src/common/url/location.test.js +15 -0
- package/src/common/url/parse-url.js +70 -0
- package/src/common/url/parse-url.test.js +110 -0
- package/src/common/url/protocol.js +9 -0
- package/src/common/url/protocol.test.js +18 -0
- package/src/common/util/console.js +11 -0
- package/src/common/util/data-size.js +21 -0
- package/src/common/util/feature-flags.js +38 -0
- package/src/common/util/get-or-set.js +34 -0
- package/src/common/util/global-scope.js +47 -0
- package/src/common/util/map-own.js +22 -0
- package/src/common/util/map-own.test.js +52 -0
- package/src/common/util/obfuscate.js +73 -0
- package/src/common/util/s-hash.js +14 -0
- package/src/common/util/single.js +18 -0
- package/src/common/util/stringify.js +42 -0
- package/src/common/util/submit-data.js +101 -0
- package/src/common/util/traverse.js +36 -0
- package/src/common/util/user-agent.js +56 -0
- package/src/common/window/load.js +15 -0
- package/src/common/window/nreum.js +110 -0
- package/src/common/window/page-visibility.js +24 -0
- package/src/common/window/session-storage.js +75 -0
- package/src/common/window/supports-performance-observer.js +10 -0
- package/src/common/wrap/index.js +17 -0
- package/src/common/wrap/wrap-events.js +106 -0
- package/src/common/wrap/wrap-fetch.js +110 -0
- package/src/common/wrap/wrap-function.js +248 -0
- package/src/common/wrap/wrap-history.js +51 -0
- package/src/common/wrap/wrap-jsonp.js +136 -0
- package/src/common/wrap/wrap-mutation.js +58 -0
- package/src/common/wrap/wrap-promise.js +166 -0
- package/src/common/wrap/wrap-promise.test.js +140 -0
- package/src/common/wrap/wrap-raf.js +52 -0
- package/src/common/wrap/wrap-timer.js +69 -0
- package/src/common/wrap/wrap-xhr.js +214 -0
- package/src/features/ajax/aggregate/index.js +248 -0
- package/src/features/ajax/constants.js +3 -0
- package/src/features/ajax/index.js +1 -0
- package/src/features/ajax/instrument/distributed-tracing.js +166 -0
- package/src/features/ajax/instrument/index.js +380 -0
- package/src/features/ajax/instrument/response-size.js +18 -0
- package/src/features/jserrors/aggregate/canonical-function-name.js +14 -0
- package/src/features/jserrors/aggregate/canonical-function-name.test.js +13 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.js +231 -0
- package/src/features/jserrors/aggregate/compute-stack-trace.test.js +297 -0
- package/src/features/jserrors/aggregate/format-stack-trace.js +30 -0
- package/src/features/jserrors/aggregate/format-stack-trace.test.js +39 -0
- package/src/features/jserrors/aggregate/index.js +310 -0
- package/src/features/jserrors/aggregate/string-hash-code.js +17 -0
- package/src/features/jserrors/aggregate/string-hash-code.test.js +12 -0
- package/src/features/jserrors/constants.js +4 -0
- package/src/features/jserrors/index.js +1 -0
- package/src/features/jserrors/instrument/debug.js +36 -0
- package/src/features/jserrors/instrument/index.js +151 -0
- package/src/features/metrics/aggregate/index.js +133 -0
- package/src/features/metrics/constants.js +7 -0
- package/src/features/metrics/index.js +1 -0
- package/src/features/metrics/instrument/index.js +14 -0
- package/src/features/metrics/instrument/workers-helper.js +113 -0
- package/src/features/page_action/aggregate/index.js +113 -0
- package/src/features/page_action/constants.js +3 -0
- package/src/features/page_action/index.js +1 -0
- package/src/features/page_action/instrument/index.js +15 -0
- package/src/features/page_view_event/aggregate/index.js +143 -0
- package/src/features/page_view_event/aggregate/initialized-features.js +31 -0
- package/src/features/page_view_event/constants.js +6 -0
- package/src/features/page_view_event/index.js +1 -0
- package/src/features/page_view_event/instrument/index.js +33 -0
- package/src/features/page_view_timing/aggregate/index.js +257 -0
- package/src/features/page_view_timing/constants.js +3 -0
- package/src/features/page_view_timing/first-paint.js +41 -0
- package/src/features/page_view_timing/index.js +1 -0
- package/src/features/page_view_timing/instrument/index.js +30 -0
- package/src/features/page_view_timing/long-tasks.js +60 -0
- package/src/features/session_trace/aggregate/index.js +413 -0
- package/src/features/session_trace/constants.js +15 -0
- package/src/features/session_trace/index.js +1 -0
- package/src/features/session_trace/instrument/index.js +127 -0
- package/src/features/spa/aggregate/index.js +738 -0
- package/src/features/spa/aggregate/interaction-node.js +85 -0
- package/src/features/spa/aggregate/interaction-node.test.js +17 -0
- package/src/features/spa/aggregate/interaction.js +112 -0
- package/src/features/spa/aggregate/serializer.js +198 -0
- package/src/features/spa/constants.js +36 -0
- package/src/features/spa/index.js +1 -0
- package/src/features/spa/instrument/index.js +114 -0
- package/src/features/utils/aggregate-base.js +7 -0
- package/src/features/utils/feature-base.js +51 -0
- package/src/features/utils/handler-cache.js +60 -0
- package/src/features/utils/instrument-base.js +68 -0
- package/src/features/utils/lazy-loader.js +37 -0
- package/src/index.js +15 -0
- package/src/loaders/agent.js +80 -0
- package/src/loaders/api/api.js +175 -0
- package/src/loaders/api/apiAsync.js +92 -0
- package/src/loaders/browser-agent.js +33 -0
- package/src/loaders/configure/configure.js +39 -0
- package/src/loaders/features/enabled-features.js +16 -0
- package/src/loaders/features/featureDependencies.js +26 -0
- package/src/loaders/features/features.js +25 -0
- package/src/loaders/micro-agent.js +84 -0
- package/src/loaders/worker-agent.js +24 -0
- package/dist/cjs/common/constants/environment-variables.js +0 -20
- package/dist/cjs/common/util/reduce.js +0 -22
- package/dist/cjs/common/window/top-level-callers.js +0 -23
- package/dist/esm/common/constants/environment-variables.js +0 -11
- package/dist/esm/common/util/reduce.js +0 -16
- package/dist/esm/common/window/top-level-callers.js +0 -17
- package/types.ts +0 -221
|
@@ -27,15 +27,13 @@ var _features = require("../../../loaders/features/features");
|
|
|
27
27
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
28
28
|
static featureName = _constants.FEATURE_NAME;
|
|
29
29
|
constructor(agentIdentifier, aggregator) {
|
|
30
|
+
var _this;
|
|
30
31
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
32
|
+
_this = this;
|
|
31
33
|
this.timings = [];
|
|
32
34
|
this.timingsSent = [];
|
|
33
35
|
this.curSessEndRecorded = false;
|
|
34
|
-
|
|
35
|
-
// we (only) need to track cls state because it's attached to other timing events rather than reported on change...
|
|
36
|
-
this.clsSupported = PerformanceObserver.supportedEntryTypes.includes('layout-shift');
|
|
37
|
-
this.cls = 0;
|
|
38
|
-
} catch (e) {}
|
|
36
|
+
this.cls = null; // this should be null unless set to a numeric value by web-vitals so that we differentiate if CLS is supported
|
|
39
37
|
|
|
40
38
|
/*! This is the section that used to be in the loader portion: !*/
|
|
41
39
|
/* ------------------------------------------------------------ */
|
|
@@ -43,10 +41,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
43
41
|
this.alreadySent = new Set(); // since we don't support timings on BFCache restores, this tracks and helps cap metrics that web-vitals report more than once
|
|
44
42
|
|
|
45
43
|
/* PerformancePaintTiming API - BFC is not yet supported. */
|
|
46
|
-
(0, _firstPaint.onFirstPaint)(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
(0, _firstPaint.onFirstPaint)(_ref => {
|
|
45
|
+
let {
|
|
46
|
+
name,
|
|
47
|
+
value
|
|
48
|
+
} = _ref;
|
|
50
49
|
if (pageStartedHidden) return;
|
|
51
50
|
this.addTiming(name.toLowerCase(), Math.floor(value));
|
|
52
51
|
});
|
|
@@ -65,10 +64,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
65
64
|
}
|
|
66
65
|
} catch (e) {}
|
|
67
66
|
} else {
|
|
68
|
-
(0, _webVitals.onFCP)(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
(0, _webVitals.onFCP)(_ref2 => {
|
|
68
|
+
let {
|
|
69
|
+
name,
|
|
70
|
+
value
|
|
71
|
+
} = _ref2;
|
|
72
72
|
if (pageStartedHidden || this.alreadySent.has(name)) return;
|
|
73
73
|
this.alreadySent.add(name);
|
|
74
74
|
this.addTiming(name.toLowerCase(), value);
|
|
@@ -76,12 +76,13 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/* First Input Delay (+"First Interaction") - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
79
|
-
(0, _webVitals.onFID)(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
(0, _webVitals.onFID)(_ref3 => {
|
|
80
|
+
let {
|
|
81
|
+
name,
|
|
82
|
+
value,
|
|
83
|
+
entries
|
|
84
|
+
} = _ref3;
|
|
85
|
+
if (pageStartedHidden || this.alreadySent.has(name) || entries.length === 0) return;
|
|
85
86
|
this.alreadySent.add(name);
|
|
86
87
|
|
|
87
88
|
// CWV will only report one (THE) first-input entry to us; fid isn't reported if there are no user interactions occurs before the *first* page hiding.
|
|
@@ -95,59 +96,76 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
95
96
|
});
|
|
96
97
|
|
|
97
98
|
/* Largest Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
98
|
-
(0, _webVitals.onLCP)(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
(0, _webVitals.onLCP)(_ref4 => {
|
|
100
|
+
let {
|
|
101
|
+
name,
|
|
102
|
+
value,
|
|
103
|
+
entries
|
|
104
|
+
} = _ref4;
|
|
103
105
|
if (pageStartedHidden || this.alreadySent.has(name)) return;
|
|
104
106
|
this.alreadySent.add(name);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
size
|
|
110
|
-
eid
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
attrs['elTag'] = lcpEntry.element.tagName;
|
|
107
|
+
const attributes = {};
|
|
108
|
+
if (entries.length > 0) {
|
|
109
|
+
// CWV will only ever report one (THE) lcp entry to us; lcp is also only reported *once* on earlier(user interaction, page hidden).
|
|
110
|
+
const lcpEntry = entries[entries.length - 1]; // this looks weird if we only expect one, but this is how cwv-attribution gets it so to be sure...
|
|
111
|
+
attributes.size = lcpEntry.size;
|
|
112
|
+
attributes.eid = lcpEntry.id;
|
|
113
|
+
if (lcpEntry.url) {
|
|
114
|
+
attributes['elUrl'] = (0, _cleanUrl.cleanURL)(lcpEntry.url);
|
|
115
|
+
}
|
|
116
|
+
if (lcpEntry.element?.tagName) {
|
|
117
|
+
attributes['elTag'] = lcpEntry.element.tagName;
|
|
118
|
+
}
|
|
118
119
|
}
|
|
119
|
-
this.
|
|
120
|
+
this.addConnectionAttributes(attributes);
|
|
121
|
+
this.addTiming(name.toLowerCase(), value, attributes);
|
|
120
122
|
});
|
|
121
123
|
|
|
122
|
-
/* Cumulative Layout Shift - We don't have to limit this callback since cls is stored as a state and only sent as attribute on other timings.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
/* Cumulative Layout Shift - We don't have to limit this callback since cls is stored as a state and only sent as attribute on other timings.
|
|
125
|
+
reportAllChanges ensures our tracked cls has the most recent rolling value to attach to 'unload' and 'pagehide'. */
|
|
126
|
+
(0, _webVitals.onCLS)(_ref5 => {
|
|
127
|
+
let {
|
|
128
|
+
value
|
|
129
|
+
} = _ref5;
|
|
130
|
+
return this.cls = value;
|
|
131
|
+
}, {
|
|
132
|
+
reportAllChanges: true
|
|
133
|
+
});
|
|
126
134
|
|
|
127
135
|
/* Interaction-to-Next-Paint */
|
|
128
|
-
(0, _webVitals.onINP)(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
(0, _webVitals.onINP)(_ref6 => {
|
|
137
|
+
let {
|
|
138
|
+
name,
|
|
139
|
+
value,
|
|
140
|
+
id
|
|
141
|
+
} = _ref6;
|
|
142
|
+
return this.addTiming(name.toLowerCase(), value, {
|
|
143
|
+
metricId: id
|
|
144
|
+
});
|
|
145
|
+
});
|
|
135
146
|
|
|
136
147
|
/* PerformanceLongTaskTiming API */
|
|
137
148
|
if ((0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.long_task') === true) {
|
|
138
|
-
(0, _longTasks.onLongTask)(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
149
|
+
(0, _longTasks.onLongTask)(_ref7 => {
|
|
150
|
+
let {
|
|
151
|
+
name,
|
|
152
|
+
value,
|
|
153
|
+
info
|
|
154
|
+
} = _ref7;
|
|
155
|
+
return this.addTiming(name.toLowerCase(), value, info);
|
|
156
|
+
}); // lt context is passed as 'info'=attrs in the timing node
|
|
143
157
|
}
|
|
144
158
|
/* ------------------------------------End of ex-loader section */
|
|
145
159
|
|
|
146
160
|
/* It's important that CWV api, like "onLCP", is called before this scheduler is initialized. The reason is because they listen to the same
|
|
147
161
|
on vis change or pagehide events, and we'd want ex. onLCP to record the timing (win the race) before we try to send "final harvest". */
|
|
148
162
|
this.scheduler = new _harvestScheduler.HarvestScheduler('events', {
|
|
149
|
-
onFinished: (
|
|
150
|
-
|
|
163
|
+
onFinished: function () {
|
|
164
|
+
return _this.onHarvestFinished(...arguments);
|
|
165
|
+
},
|
|
166
|
+
getPayload: function () {
|
|
167
|
+
return _this.prepareHarvest(...arguments);
|
|
168
|
+
}
|
|
151
169
|
}, this);
|
|
152
170
|
(0, _registerHandler.registerHandler)('timing', (name, value, attrs) => this.addTiming(name, value, attrs), this.featureName, this.ee); // notice CLS is added to all timings via 4th param
|
|
153
171
|
(0, _registerHandler.registerHandler)('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
|
|
@@ -155,7 +173,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
155
173
|
const initialHarvestSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.initialHarvestSeconds') || 10;
|
|
156
174
|
const harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.harvestTimeSeconds') || 30;
|
|
157
175
|
// send initial data sooner, then start regular
|
|
158
|
-
this.ee.on(
|
|
176
|
+
this.ee.on("drain-".concat(this.featureName), () => {
|
|
159
177
|
this.scheduler.startTimer(harvestTimeSeconds, initialHarvestSeconds);
|
|
160
178
|
});
|
|
161
179
|
(0, _drain.drain)(this.agentIdentifier, this.featureName);
|
|
@@ -189,15 +207,26 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
189
207
|
*/
|
|
190
208
|
recordPageUnload(timestamp) {
|
|
191
209
|
this.addTiming('unload', timestamp, null);
|
|
192
|
-
|
|
210
|
+
/*
|
|
211
|
+
Issue: Because window's pageHide commonly fires BEFORE vis change and "final" harvest would happen at the former in this case, we also have to add our vis-change event now or it may not be sent.
|
|
212
|
+
Affected: Safari < v14.1/.5 ; versions that don't support 'visiilitychange' event
|
|
213
|
+
Impact: For affected w/o this, NR 'pageHide' attribute may not be sent. For other browsers w/o this, NR 'pageHide' gets fragmented into its own harvest call on page unloading because of dual EoL logic.
|
|
214
|
+
Mitigation: NR 'unload' and 'pageHide' are both recorded when window pageHide fires, rather than only recording 'unload'.
|
|
215
|
+
Future: When EoL can become the singular subscribeToVisibilityChange, it's likely endCurrentSession isn't needed here as 'unload'-'pageHide' can be untangled.
|
|
216
|
+
*/
|
|
193
217
|
this.endCurrentSession(timestamp);
|
|
194
218
|
}
|
|
195
219
|
addTiming(name, value, attrs) {
|
|
196
220
|
attrs = attrs || {};
|
|
197
221
|
|
|
198
|
-
// If
|
|
199
|
-
|
|
200
|
-
if
|
|
222
|
+
// If cls was set to another value by `onCLS`, then it's supported and is attached onto any timing but is omitted until such time.
|
|
223
|
+
/*
|
|
224
|
+
*cli Apr'23 - Convert attach-to-all -> attach-if-not-null. See NEWRELIC-6143.
|
|
225
|
+
Issue: Because NR 'pageHide' was only sent once with what is considered the "final" CLS value, in the case that 'pageHide' fires before 'load' happens, we incorrectly a final CLS of 0 for that page.
|
|
226
|
+
Mitigation: We've set initial CLS to null so that it's omitted from timings like 'pageHide' in that edge case. It should only be included if onCLS callback was executed at least once.
|
|
227
|
+
Future: onCLS value changes should be reported directly & CLS separated into its own timing node so it's not beholden to 'pageHide' firing. It'd also be possible to report the real final CLS.
|
|
228
|
+
*/
|
|
229
|
+
if (this.cls !== null) {
|
|
201
230
|
attrs['cls'] = this.cls;
|
|
202
231
|
}
|
|
203
232
|
this.timings.push({
|
|
@@ -19,7 +19,8 @@ var _globalScope = require("../../../common/util/global-scope");
|
|
|
19
19
|
|
|
20
20
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
21
21
|
static featureName = _constants.FEATURE_NAME;
|
|
22
|
-
constructor(agentIdentifier, aggregator
|
|
22
|
+
constructor(agentIdentifier, aggregator) {
|
|
23
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
23
24
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
24
25
|
if (!_globalScope.isBrowserScope) return; // CWV is irrelevant outside web context
|
|
25
26
|
|
|
@@ -7,7 +7,6 @@ exports.Aggregate = void 0;
|
|
|
7
7
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
8
8
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
9
9
|
var _mapOwn = require("../../../common/util/map-own");
|
|
10
|
-
var _reduce = require("../../../common/util/reduce");
|
|
11
10
|
var _stringify = require("../../../common/util/stringify");
|
|
12
11
|
var _parseUrl = require("../../../common/url/parse-url");
|
|
13
12
|
var _supportsPerformanceObserver = require("../../../common/window/supports-performance-observer");
|
|
@@ -27,9 +26,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27
26
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
28
27
|
static featureName = _constants.FEATURE_NAME;
|
|
29
28
|
constructor(agentIdentifier, aggregator) {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
var _this;
|
|
32
30
|
// Very unlikely, but in case the existing XMLHttpRequest.prototype object on the page couldn't be wrapped.
|
|
31
|
+
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
32
|
+
_this = this;
|
|
33
33
|
if (!(0, _config.getRuntime)(agentIdentifier).xhrWrappable) return;
|
|
34
34
|
const handlerCache = new _handlerCache.HandlerCache();
|
|
35
35
|
this.ptid = '';
|
|
@@ -87,7 +87,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
87
87
|
this.maxNodesPerHarvest = (0, _config.getConfigurationValue)(agentIdentifier, 'session_trace.maxNodesPerHarvest') || 1000;
|
|
88
88
|
this.laststart = 0;
|
|
89
89
|
(0, _registerHandler.registerHandler)('feat-stn', () => {
|
|
90
|
-
|
|
90
|
+
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
91
|
+
this.storeTiming(window.performance?.getEntriesByType('navigation')?.[0] || {});
|
|
92
|
+
} else {
|
|
93
|
+
this.storeTiming(window.performance?.timing);
|
|
94
|
+
}
|
|
91
95
|
var scheduler = new _harvestScheduler.HarvestScheduler('resources', {
|
|
92
96
|
onFinished: onHarvestFinished.bind(this),
|
|
93
97
|
retryDelay: this.harvestTimeSeconds
|
|
@@ -130,39 +134,78 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
130
134
|
}, this.featureName, this.ee);
|
|
131
135
|
|
|
132
136
|
// register the handlers immediately... but let the handlerCache decide if the data should actually get stored...
|
|
133
|
-
(0, _registerHandler.registerHandler)('bst',
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
(0, _registerHandler.registerHandler)('
|
|
140
|
-
|
|
137
|
+
(0, _registerHandler.registerHandler)('bst', function () {
|
|
138
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
139
|
+
args[_key] = arguments[_key];
|
|
140
|
+
}
|
|
141
|
+
return handlerCache.settle(() => _this.storeEvent(...args));
|
|
142
|
+
}, this.featureName, this.ee);
|
|
143
|
+
(0, _registerHandler.registerHandler)('bstTimer', function () {
|
|
144
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
145
|
+
args[_key2] = arguments[_key2];
|
|
146
|
+
}
|
|
147
|
+
return handlerCache.settle(() => _this.storeTimer(...args));
|
|
148
|
+
}, this.featureName, this.ee);
|
|
149
|
+
(0, _registerHandler.registerHandler)('bstResource', function () {
|
|
150
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
151
|
+
args[_key3] = arguments[_key3];
|
|
152
|
+
}
|
|
153
|
+
return handlerCache.settle(() => _this.storeResources(...args));
|
|
154
|
+
}, this.featureName, this.ee);
|
|
155
|
+
(0, _registerHandler.registerHandler)('bstHist', function () {
|
|
156
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
157
|
+
args[_key4] = arguments[_key4];
|
|
158
|
+
}
|
|
159
|
+
return handlerCache.settle(() => _this.storeHist(...args));
|
|
160
|
+
}, this.featureName, this.ee);
|
|
161
|
+
(0, _registerHandler.registerHandler)('bstXhrAgg', function () {
|
|
162
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
163
|
+
args[_key5] = arguments[_key5];
|
|
164
|
+
}
|
|
165
|
+
return handlerCache.settle(() => _this.storeXhrAgg(...args));
|
|
166
|
+
}, this.featureName, this.ee);
|
|
167
|
+
(0, _registerHandler.registerHandler)('bstApi', function () {
|
|
168
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
169
|
+
args[_key6] = arguments[_key6];
|
|
170
|
+
}
|
|
171
|
+
return handlerCache.settle(() => _this.storeSTN(...args));
|
|
172
|
+
}, this.featureName, this.ee);
|
|
173
|
+
(0, _registerHandler.registerHandler)('errorAgg', function () {
|
|
174
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
175
|
+
args[_key7] = arguments[_key7];
|
|
176
|
+
}
|
|
177
|
+
return handlerCache.settle(() => _this.storeErrorAgg(...args));
|
|
178
|
+
}, this.featureName, this.ee);
|
|
179
|
+
(0, _registerHandler.registerHandler)('pvtAdded', function () {
|
|
180
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
|
181
|
+
args[_key8] = arguments[_key8];
|
|
182
|
+
}
|
|
183
|
+
return handlerCache.settle(() => _this.processPVT(...args));
|
|
184
|
+
}, this.featureName, this.ee);
|
|
141
185
|
(0, _drain.drain)(this.agentIdentifier, this.featureName);
|
|
142
186
|
}
|
|
143
187
|
processPVT(name, value, attrs) {
|
|
144
188
|
var t = {};
|
|
145
189
|
t[name] = value;
|
|
146
|
-
this.storeTiming(t
|
|
190
|
+
this.storeTiming(t);
|
|
147
191
|
if (this.hasFID(name, attrs)) this.storeEvent({
|
|
148
192
|
type: 'fid',
|
|
149
193
|
target: 'document'
|
|
150
194
|
}, 'document', value, value + attrs.fid);
|
|
151
195
|
}
|
|
152
|
-
storeTiming(_t
|
|
153
|
-
var key;
|
|
154
|
-
var val;
|
|
155
|
-
var timeOffset;
|
|
156
|
-
var dateNow = Date.now();
|
|
157
|
-
|
|
196
|
+
storeTiming(_t) {
|
|
158
197
|
// loop iterates through prototype also (for FF)
|
|
159
|
-
for (key in _t) {
|
|
160
|
-
val = _t[key];
|
|
198
|
+
for (let key in _t) {
|
|
199
|
+
const val = _t[key];
|
|
200
|
+
|
|
201
|
+
// ignore size and status type nodes that do not map to timestamp metrics
|
|
202
|
+
const lck = key.toLowerCase();
|
|
203
|
+
if (lck.indexOf('size') >= 0 || lck.indexOf('status') >= 0) continue;
|
|
161
204
|
|
|
162
205
|
// ignore inherited methods, meaningless 0 values, and bogus timestamps
|
|
163
206
|
// that are in the future (Microsoft Edge seems to sometimes produce these)
|
|
164
|
-
if (!(typeof val === 'number' && val
|
|
165
|
-
timeOffset =
|
|
207
|
+
if (!(typeof val === 'number' && val >= 0)) continue;
|
|
208
|
+
const timeOffset = Math.round(_t[key]);
|
|
166
209
|
this.storeSTN({
|
|
167
210
|
n: key,
|
|
168
211
|
s: timeOffset,
|
|
@@ -296,10 +339,10 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
296
339
|
if (!(0, _supportsPerformanceObserver.supportsPerformanceObserver)()) {
|
|
297
340
|
this.storeResources(window.performance.getEntriesByType('resource'));
|
|
298
341
|
}
|
|
299
|
-
var stns = (0,
|
|
342
|
+
var stns = (0, _mapOwn.mapOwn)(this.trace, (name, nodes) => {
|
|
300
343
|
if (!(name in this.toAggregate)) return nodes;
|
|
301
|
-
return (0,
|
|
302
|
-
})
|
|
344
|
+
return (0, _mapOwn.mapOwn)(nodes.sort(this.byStart).reduce(this.smearEvtsByOrigin(name), {}), this.val).reduce(this.flatten, []);
|
|
345
|
+
}).reduce(this.flatten, []);
|
|
303
346
|
if (stns.length === 0) return {};
|
|
304
347
|
if (retry) {
|
|
305
348
|
this.sentTrace = this.trace;
|
|
@@ -37,7 +37,8 @@ const {
|
|
|
37
37
|
const CRT = 'clearResourceTimings';
|
|
38
38
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
39
39
|
static featureName = FEATURE_NAME;
|
|
40
|
-
constructor(agentIdentifier, aggregator
|
|
40
|
+
constructor(agentIdentifier, aggregator) {
|
|
41
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
41
42
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
42
43
|
if (!_globalScope.isBrowserScope) return; // session traces not supported outside web env
|
|
43
44
|
|
|
@@ -32,7 +32,8 @@ const {
|
|
|
32
32
|
} = CONSTANTS;
|
|
33
33
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
34
34
|
static featureName = FEATURE_NAME;
|
|
35
|
-
constructor(agentIdentifier, aggregator
|
|
35
|
+
constructor(agentIdentifier, aggregator) {
|
|
36
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
36
37
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
37
38
|
if (!_globalScope.isBrowserScope) return; // SPA not supported outside web env
|
|
38
39
|
|
|
@@ -10,7 +10,11 @@ var _load = require("../../common/window/load");
|
|
|
10
10
|
var _globalScope = require("../../common/util/global-scope");
|
|
11
11
|
var _console = require("../../common/util/console");
|
|
12
12
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /**
|
|
14
|
+
* @file Defines `InstrumentBase` to be used as the super of the Instrument classes implemented by each feature.
|
|
15
|
+
* Inherits and executes the `checkConfiguration` method from [FeatureBase]{@link ./feature-base}, which also
|
|
16
|
+
* exposes the `blocked` property.
|
|
17
|
+
*/
|
|
14
18
|
/**
|
|
15
19
|
* Base class for instrumenting a feature.
|
|
16
20
|
* @extends FeatureBase
|
|
@@ -25,7 +29,8 @@ class InstrumentBase extends _featureBase.FeatureBase {
|
|
|
25
29
|
* of its pooled instrumentation data handled by the agent's centralized drain functionality, rather than draining
|
|
26
30
|
* immediately. Primarily useful for fine-grained control in tests.
|
|
27
31
|
*/
|
|
28
|
-
constructor(agentIdentifier, aggregator, featureName
|
|
32
|
+
constructor(agentIdentifier, aggregator, featureName) {
|
|
33
|
+
let auto = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
29
34
|
super(agentIdentifier, aggregator, featureName);
|
|
30
35
|
this.hasAggregator = false;
|
|
31
36
|
this.auto = auto;
|
|
@@ -56,7 +61,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
|
|
|
56
61
|
} = await lazyLoader(this.featureName, 'aggregate');
|
|
57
62
|
new Aggregate(this.agentIdentifier, this.aggregator);
|
|
58
63
|
} catch (e) {
|
|
59
|
-
(0, _console.warn)(
|
|
64
|
+
(0, _console.warn)("Downloading ".concat(this.featureName, " failed..."));
|
|
60
65
|
this.abortHandler?.(); // undo any important alterations made to the page
|
|
61
66
|
|
|
62
67
|
// not supported yet but nice to do: "abort" this agent's EE for this feature specifically
|
|
@@ -38,7 +38,7 @@ function lazyLoader(featureName, featurePart) {
|
|
|
38
38
|
case _features.FEATURE_NAMES.spa:
|
|
39
39
|
return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "spa-aggregate" */'../spa/aggregate')));
|
|
40
40
|
default:
|
|
41
|
-
throw new Error(
|
|
41
|
+
throw new Error("Attempted to load unsupported agent feature: ".concat(featureName, " ").concat(featurePart));
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "Agent", {
|
|
7
7
|
enumerable: true,
|
|
8
8
|
get: function () {
|
|
9
|
-
return
|
|
9
|
+
return _agent.Agent;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "Ajax", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _ajax.Ajax;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "BrowserAgent", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _browserAgent.BrowserAgent;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "JSErrors", {
|
|
@@ -69,9 +69,9 @@ Object.defineProperty(exports, "WorkerAgent", {
|
|
|
69
69
|
return _workerAgent.WorkerAgent;
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
var
|
|
73
|
-
var _browserAgent = require("./browser-agent");
|
|
74
|
-
var _workerAgent = require("./worker-agent");
|
|
72
|
+
var _agent = require("./loaders/agent");
|
|
73
|
+
var _browserAgent = require("./loaders/browser-agent");
|
|
74
|
+
var _workerAgent = require("./loaders/worker-agent");
|
|
75
75
|
var _ajax = require("./features/ajax");
|
|
76
76
|
var _jserrors = require("./features/jserrors");
|
|
77
77
|
var _metrics = require("./features/metrics");
|
|
@@ -26,7 +26,8 @@ var _stringify = require("../common/util/stringify");
|
|
|
26
26
|
* sensitive to network load, this may result in smaller builds with slightly lower performance impact.
|
|
27
27
|
*/
|
|
28
28
|
class Agent {
|
|
29
|
-
constructor(options
|
|
29
|
+
constructor(options) {
|
|
30
|
+
let agentIdentifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _uniqueId.generateRandomHexString)(16);
|
|
30
31
|
this.agentIdentifier = agentIdentifier;
|
|
31
32
|
this.sharedAggregator = new _aggregator.Aggregator({
|
|
32
33
|
agentIdentifier: this.agentIdentifier
|
|
@@ -61,7 +62,7 @@ class Agent {
|
|
|
61
62
|
if (enabledFeatures[f.featureName] || f.featureName === _features.FEATURE_NAMES.pageViewEvent) {
|
|
62
63
|
const dependencies = (0, _featureDependencies.getFeatureDependencyNames)(f.featureName);
|
|
63
64
|
const hasAllDeps = dependencies.every(x => enabledFeatures[x]);
|
|
64
|
-
if (!hasAllDeps) (0, _console.warn)(
|
|
65
|
+
if (!hasAllDeps) (0, _console.warn)("".concat(f.featureName, " is enabled but one or more dependent features has been disabled (").concat((0, _stringify.stringify)(dependencies), "). This may cause unintended consequences or missing data..."));
|
|
65
66
|
this.features[f.featureName] = new f(this.agentIdentifier, this.sharedAggregator);
|
|
66
67
|
}
|
|
67
68
|
});
|