@newrelic/browser-agent 1.263.0 → 1.265.0
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/CHANGELOG.md +32 -0
- package/README.md +2 -2
- package/dist/cjs/cdn/experimental.js +3 -7
- package/dist/cjs/cdn/pro.js +2 -2
- package/dist/cjs/cdn/spa.js +2 -2
- package/dist/cjs/common/aggregate/aggregator.js +2 -3
- package/dist/cjs/common/config/{state/configurable.js → configurable.js} +1 -1
- package/dist/cjs/common/config/{state/info.js → info.js} +1 -1
- package/dist/cjs/common/config/{state/init.js → init.js} +11 -8
- package/dist/cjs/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/dist/cjs/common/config/{state/runtime.js → runtime.js} +16 -5
- package/dist/cjs/common/constants/agent-constants.js +8 -0
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +1 -3
- package/dist/cjs/common/context/shared-context.js +1 -2
- package/dist/cjs/common/dispatch/global-event.js +1 -2
- package/dist/cjs/common/drain/drain.js +12 -18
- package/dist/cjs/common/event-emitter/contextual-ee.js +3 -4
- package/dist/cjs/common/event-listener/event-listener-opts.js +2 -6
- package/dist/cjs/common/harvest/harvest-scheduler.js +1 -2
- package/dist/cjs/common/harvest/harvest.js +30 -57
- package/dist/cjs/common/serialize/bel-serializer.js +6 -11
- package/dist/cjs/common/session/session-entity.js +10 -13
- package/dist/cjs/common/timing/nav-timing.js +1 -3
- package/dist/cjs/common/timing/time-keeper.js +16 -6
- package/dist/cjs/common/url/encode.js +3 -7
- package/dist/cjs/common/util/console.js +2 -0
- package/dist/cjs/common/util/invoke.js +6 -16
- package/dist/cjs/common/util/obfuscate.js +97 -53
- package/dist/cjs/common/util/submit-data.js +17 -21
- package/dist/cjs/common/util/text.js +9 -0
- package/dist/cjs/common/util/traverse.js +1 -3
- package/dist/cjs/common/vitals/cumulative-layout-shift.js +5 -6
- package/dist/cjs/common/vitals/first-contentful-paint.js +4 -5
- package/dist/cjs/common/vitals/first-input-delay.js +4 -5
- package/dist/cjs/common/vitals/interaction-to-next-paint.js +5 -6
- package/dist/cjs/common/vitals/largest-contentful-paint.js +4 -5
- package/dist/cjs/common/vitals/time-to-first-byte.js +4 -5
- package/dist/cjs/common/vitals/vital-metric.js +5 -7
- package/dist/cjs/common/window/nreum.js +2 -1
- package/dist/cjs/common/window/page-visibility.js +1 -4
- package/dist/cjs/common/wrap/wrap-events.js +1 -4
- package/dist/cjs/common/wrap/wrap-promise.js +1 -4
- package/dist/cjs/common/wrap/wrap-websocket.js +74 -0
- package/dist/cjs/features/ajax/aggregate/chunk.js +4 -3
- package/dist/cjs/features/ajax/aggregate/gql.js +4 -5
- package/dist/cjs/features/ajax/aggregate/index.js +19 -22
- package/dist/cjs/features/ajax/constants.js +2 -3
- package/dist/cjs/features/ajax/instrument/distributed-tracing.js +9 -8
- package/dist/cjs/features/ajax/instrument/index.js +14 -12
- package/dist/cjs/features/generic_events/aggregate/index.js +128 -0
- package/dist/cjs/features/generic_events/constants.js +10 -0
- package/dist/cjs/features/generic_events/index.js +12 -0
- package/dist/cjs/features/generic_events/instrument/index.js +27 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +25 -44
- package/dist/cjs/features/jserrors/instrument/index.js +4 -4
- package/dist/cjs/features/logging/aggregate/index.js +33 -36
- package/dist/cjs/features/logging/constants.js +2 -3
- package/dist/cjs/features/logging/instrument/index.js +5 -6
- package/dist/cjs/features/logging/shared/log.js +1 -3
- package/dist/cjs/features/logging/shared/utils.js +2 -4
- package/dist/cjs/features/metrics/aggregate/index.js +34 -17
- package/dist/cjs/features/metrics/aggregate/websocket-detection.js +34 -0
- package/dist/cjs/features/metrics/constants.js +4 -2
- package/dist/cjs/features/metrics/instrument/index.js +12 -4
- package/dist/cjs/features/page_action/instrument/index.js +14 -10
- package/dist/cjs/features/page_view_event/aggregate/index.js +19 -39
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/cjs/features/page_view_event/instrument/index.js +4 -4
- package/dist/cjs/features/page_view_timing/aggregate/index.js +23 -39
- package/dist/cjs/features/page_view_timing/instrument/index.js +4 -4
- package/dist/cjs/features/session_replay/aggregate/index.js +35 -42
- package/dist/cjs/features/session_replay/constants.js +1 -5
- package/dist/cjs/features/session_replay/instrument/index.js +5 -9
- package/dist/cjs/features/session_replay/shared/recorder-events.js +25 -20
- package/dist/cjs/features/session_replay/shared/recorder.js +17 -13
- package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +2 -2
- package/dist/cjs/features/session_replay/shared/utils.js +5 -4
- package/dist/cjs/features/session_trace/aggregate/index.js +25 -42
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +5 -3
- package/dist/cjs/features/session_trace/instrument/index.js +8 -7
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +22 -30
- package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +2 -2
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +4 -5
- package/dist/cjs/features/soft_navigations/instrument/index.js +14 -13
- package/dist/cjs/features/spa/aggregate/index.js +17 -28
- package/dist/cjs/features/spa/aggregate/interaction.js +7 -6
- package/dist/cjs/features/spa/aggregate/serializer.js +4 -5
- package/dist/cjs/features/spa/constants.js +2 -2
- package/dist/cjs/features/spa/instrument/index.js +20 -19
- package/dist/cjs/features/utils/agent-session.js +6 -4
- package/dist/cjs/features/utils/aggregate-base.js +17 -10
- package/dist/cjs/features/utils/event-buffer.js +132 -0
- package/dist/cjs/features/utils/feature-gates.js +2 -2
- package/dist/cjs/features/utils/instrument-base.js +7 -8
- package/dist/cjs/features/utils/lazy-feature-loader.js +12 -12
- package/dist/cjs/features/utils/nr1-debugger.js +1 -3
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/loaders/agent-base.js +4 -12
- package/dist/cjs/loaders/agent.js +7 -2
- package/dist/cjs/loaders/api/api.js +23 -35
- package/dist/cjs/loaders/api/apiAsync.js +10 -13
- package/dist/cjs/loaders/browser-agent.js +4 -3
- package/dist/cjs/loaders/configure/configure.js +16 -15
- package/dist/cjs/loaders/features/enabled-features.js +2 -2
- package/dist/cjs/loaders/features/features.js +8 -4
- package/dist/cjs/loaders/micro-agent.js +16 -15
- package/dist/esm/cdn/experimental.js +2 -5
- package/dist/esm/cdn/pro.js +2 -2
- package/dist/esm/cdn/spa.js +2 -2
- package/dist/esm/common/aggregate/aggregator.js +2 -3
- package/dist/esm/common/config/{state/configurable.js → configurable.js} +1 -1
- package/dist/esm/common/config/{state/info.js → info.js} +1 -1
- package/dist/esm/common/config/{state/init.js → init.js} +11 -8
- package/dist/esm/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/dist/esm/common/config/{state/runtime.js → runtime.js} +17 -5
- package/dist/esm/common/constants/agent-constants.js +2 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +0 -2
- package/dist/esm/common/context/shared-context.js +1 -2
- package/dist/esm/common/dispatch/global-event.js +1 -2
- package/dist/esm/common/drain/drain.js +12 -18
- package/dist/esm/common/event-emitter/contextual-ee.js +2 -3
- package/dist/esm/common/event-listener/event-listener-opts.js +2 -6
- package/dist/esm/common/harvest/harvest-scheduler.js +1 -2
- package/dist/esm/common/harvest/harvest.js +24 -51
- package/dist/esm/common/serialize/bel-serializer.js +6 -11
- package/dist/esm/common/session/session-entity.js +10 -13
- package/dist/esm/common/timing/nav-timing.js +1 -3
- package/dist/esm/common/timing/time-keeper.js +15 -5
- package/dist/esm/common/url/encode.js +3 -7
- package/dist/esm/common/util/console.js +2 -0
- package/dist/esm/common/util/invoke.js +6 -16
- package/dist/esm/common/util/obfuscate.js +96 -49
- package/dist/esm/common/util/submit-data.js +17 -21
- package/dist/esm/common/util/text.js +3 -0
- package/dist/esm/common/util/traverse.js +1 -3
- package/dist/esm/common/vitals/cumulative-layout-shift.js +5 -6
- package/dist/esm/common/vitals/first-contentful-paint.js +4 -5
- package/dist/esm/common/vitals/first-input-delay.js +4 -5
- package/dist/esm/common/vitals/interaction-to-next-paint.js +5 -6
- package/dist/esm/common/vitals/largest-contentful-paint.js +4 -5
- package/dist/esm/common/vitals/time-to-first-byte.js +4 -5
- package/dist/esm/common/vitals/vital-metric.js +5 -7
- package/dist/esm/common/window/nreum.js +2 -1
- package/dist/esm/common/window/page-visibility.js +1 -4
- package/dist/esm/common/wrap/wrap-events.js +1 -4
- package/dist/esm/common/wrap/wrap-promise.js +1 -4
- package/dist/esm/common/wrap/wrap-websocket.js +67 -0
- package/dist/esm/features/ajax/aggregate/chunk.js +3 -2
- package/dist/esm/features/ajax/aggregate/gql.js +4 -5
- package/dist/esm/features/ajax/aggregate/index.js +16 -19
- package/dist/esm/features/ajax/constants.js +1 -2
- package/dist/esm/features/ajax/instrument/distributed-tracing.js +2 -1
- package/dist/esm/features/ajax/instrument/index.js +10 -8
- package/dist/esm/features/generic_events/aggregate/index.js +120 -0
- package/dist/esm/features/generic_events/constants.js +4 -0
- package/dist/esm/features/generic_events/index.js +1 -0
- package/dist/esm/features/generic_events/instrument/index.js +20 -0
- package/dist/esm/features/jserrors/aggregate/index.js +20 -39
- package/dist/esm/features/jserrors/instrument/index.js +3 -3
- package/dist/esm/features/logging/aggregate/index.js +31 -34
- package/dist/esm/features/logging/constants.js +1 -2
- package/dist/esm/features/logging/instrument/index.js +4 -5
- package/dist/esm/features/logging/shared/log.js +1 -3
- package/dist/esm/features/logging/shared/utils.js +2 -4
- package/dist/esm/features/metrics/aggregate/index.js +28 -11
- package/dist/esm/features/metrics/aggregate/websocket-detection.js +29 -0
- package/dist/esm/features/metrics/constants.js +3 -1
- package/dist/esm/features/metrics/instrument/index.js +12 -4
- package/dist/esm/features/page_action/instrument/index.js +14 -9
- package/dist/esm/features/page_view_event/aggregate/index.js +17 -37
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/esm/features/page_view_event/instrument/index.js +3 -3
- package/dist/esm/features/page_view_timing/aggregate/index.js +20 -36
- package/dist/esm/features/page_view_timing/instrument/index.js +3 -3
- package/dist/esm/features/session_replay/aggregate/index.js +25 -32
- package/dist/esm/features/session_replay/constants.js +0 -4
- package/dist/esm/features/session_replay/index.js +1 -7
- package/dist/esm/features/session_replay/instrument/index.js +5 -8
- package/dist/esm/features/session_replay/shared/recorder-events.js +25 -20
- package/dist/esm/features/session_replay/shared/recorder.js +14 -10
- package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +2 -2
- package/dist/esm/features/session_replay/shared/utils.js +3 -2
- package/dist/esm/features/session_trace/aggregate/index.js +20 -37
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +5 -3
- package/dist/esm/features/session_trace/instrument/index.js +5 -4
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +21 -29
- package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +2 -3
- package/dist/esm/features/soft_navigations/instrument/index.js +11 -10
- package/dist/esm/features/spa/aggregate/index.js +11 -22
- package/dist/esm/features/spa/aggregate/interaction.js +6 -5
- package/dist/esm/features/spa/aggregate/serializer.js +2 -3
- package/dist/esm/features/spa/constants.js +2 -2
- package/dist/esm/features/spa/instrument/index.js +12 -11
- package/dist/esm/features/utils/agent-session.js +3 -1
- package/dist/esm/features/utils/aggregate-base.js +16 -9
- package/dist/esm/features/utils/event-buffer.js +126 -0
- package/dist/esm/features/utils/feature-gates.js +1 -1
- package/dist/esm/features/utils/instrument-base.js +6 -7
- package/dist/esm/features/utils/lazy-feature-loader.js +12 -12
- package/dist/esm/features/utils/nr1-debugger.js +1 -3
- package/dist/esm/index.js +3 -0
- package/dist/esm/loaders/agent-base.js +4 -12
- package/dist/esm/loaders/agent.js +7 -2
- package/dist/esm/loaders/api/api.js +18 -30
- package/dist/esm/loaders/api/apiAsync.js +3 -6
- package/dist/esm/loaders/browser-agent.js +3 -2
- package/dist/esm/loaders/configure/configure.js +9 -8
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/features/features.js +8 -4
- package/dist/esm/loaders/micro-agent.js +11 -10
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
- package/dist/types/common/config/configurable.d.ts.map +1 -0
- package/dist/types/common/config/info.d.ts.map +1 -0
- package/dist/types/common/config/init.d.ts.map +1 -0
- package/dist/types/common/config/loader-config.d.ts.map +1 -0
- package/dist/types/common/config/runtime.d.ts.map +1 -0
- package/dist/types/common/constants/agent-constants.d.ts +3 -0
- package/dist/types/common/constants/agent-constants.d.ts.map +1 -0
- package/dist/types/common/constants/runtime.d.ts +0 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +1 -7
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +9 -2
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
- package/dist/types/common/url/encode.d.ts.map +1 -1
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts +78 -6
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/util/text.d.ts +2 -0
- package/dist/types/common/util/text.d.ts.map +1 -0
- package/dist/types/common/window/nreum.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-websocket.d.ts +4 -0
- package/dist/types/common/wrap/wrap-websocket.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/chunk.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -3
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/constants.d.ts +0 -1
- package/dist/types/features/ajax/constants.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts +1 -0
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/{page_action → generic_events}/aggregate/index.d.ts +10 -10
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/constants.d.ts +4 -0
- package/dist/types/features/generic_events/constants.d.ts.map +1 -0
- package/dist/types/features/generic_events/index.d.ts +2 -0
- package/dist/types/features/generic_events/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts +7 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/instrument/index.d.ts +1 -0
- package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +4 -7
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/constants.d.ts +0 -1
- package/dist/types/features/logging/constants.d.ts.map +1 -1
- package/dist/types/features/logging/instrument/index.d.ts +1 -0
- package/dist/types/features/logging/instrument/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/websocket-detection.d.ts +12 -0
- package/dist/types/features/metrics/aggregate/websocket-detection.d.ts.map +1 -0
- package/dist/types/features/metrics/constants.d.ts +1 -0
- package/dist/types/features/metrics/constants.d.ts.map +1 -1
- package/dist/types/features/metrics/instrument/index.d.ts +1 -0
- package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_action/instrument/index.d.ts +9 -4
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/instrument/index.d.ts +1 -0
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/instrument/index.d.ts +1 -0
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/constants.d.ts +0 -4
- package/dist/types/features/session_replay/constants.d.ts.map +1 -1
- package/dist/types/features/session_replay/instrument/index.d.ts +1 -0
- package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder-events.d.ts +6 -6
- package/dist/types/features/session_replay/shared/recorder-events.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts +2 -2
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/utils.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/trace/storage.d.ts +1 -1
- package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
- package/dist/types/features/session_trace/instrument/index.d.ts +1 -0
- package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/index.d.ts +3 -3
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/instrument/index.d.ts +1 -0
- package/dist/types/features/soft_navigations/instrument/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts +2 -2
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -1
- package/dist/types/features/spa/constants.d.ts.map +1 -1
- package/dist/types/features/spa/instrument/index.d.ts +1 -0
- package/dist/types/features/spa/instrument/index.d.ts.map +1 -1
- package/dist/types/features/utils/agent-session.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +1 -0
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/features/utils/event-buffer.d.ts +72 -0
- package/dist/types/features/utils/event-buffer.d.ts.map +1 -0
- package/dist/types/features/utils/instrument-base.d.ts +1 -0
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/loaders/agent-base.d.ts +1 -2
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/browser-agent.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +67 -52
- package/src/cdn/experimental.js +2 -4
- package/src/cdn/pro.js +2 -2
- package/src/cdn/spa.js +2 -2
- package/src/common/aggregate/aggregator.js +2 -3
- package/src/common/config/__mocks__/info.js +3 -0
- package/src/common/config/__mocks__/init.js +3 -0
- package/src/common/config/__mocks__/loader-config.js +2 -0
- package/src/common/config/__mocks__/runtime.js +2 -0
- package/src/common/config/{state/configurable.js → configurable.js} +1 -1
- package/src/common/config/{state/info.js → info.js} +1 -1
- package/src/common/config/{state/init.js → init.js} +7 -6
- package/src/common/config/{state/loader-config.js → loader-config.js} +1 -1
- package/src/common/config/{state/runtime.js → runtime.js} +19 -5
- package/src/common/constants/agent-constants.js +2 -0
- package/src/common/constants/runtime.js +0 -2
- package/src/common/drain/drain.js +8 -6
- package/src/common/event-emitter/contextual-ee.js +1 -1
- package/src/common/harvest/harvest.js +10 -24
- package/src/common/serialize/bel-serializer.js +6 -9
- package/src/common/session/session-entity.js +4 -4
- package/src/common/timing/__mocks__/time-keeper.js +6 -2
- package/src/common/timing/time-keeper.js +15 -5
- package/src/common/url/encode.js +2 -3
- package/src/common/util/__mocks__/console.js +1 -0
- package/src/common/util/__mocks__/obfuscate.js +5 -8
- package/src/common/util/console.js +2 -0
- package/src/common/util/obfuscate.js +94 -50
- package/src/common/util/submit-data.js +0 -1
- package/src/common/util/text.js +6 -0
- package/src/common/window/__mocks__/nreum.js +1 -1
- package/src/common/window/nreum.js +2 -1
- package/src/common/wrap/wrap-websocket.js +73 -0
- package/src/features/ajax/aggregate/chunk.js +3 -2
- package/src/features/ajax/aggregate/index.js +20 -19
- package/src/features/ajax/constants.js +0 -2
- package/src/features/ajax/instrument/distributed-tracing.js +2 -1
- package/src/features/ajax/instrument/index.js +9 -5
- package/src/features/generic_events/aggregate/index.js +139 -0
- package/src/features/generic_events/constants.js +5 -0
- package/src/features/generic_events/index.js +1 -0
- package/src/features/generic_events/instrument/index.js +24 -0
- package/src/features/jserrors/aggregate/index.js +18 -9
- package/src/features/jserrors/instrument/index.js +2 -0
- package/src/features/logging/aggregate/index.js +39 -31
- package/src/features/logging/constants.js +0 -2
- package/src/features/logging/instrument/index.js +2 -0
- package/src/features/logging/shared/utils.js +1 -1
- package/src/features/metrics/aggregate/index.js +24 -9
- package/src/features/metrics/aggregate/websocket-detection.js +31 -0
- package/src/features/metrics/constants.js +3 -0
- package/src/features/metrics/instrument/index.js +13 -1
- package/src/features/page_action/instrument/index.js +11 -6
- package/src/features/page_view_event/aggregate/index.js +8 -23
- package/src/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/src/features/page_view_event/instrument/index.js +2 -0
- package/src/features/page_view_timing/aggregate/index.js +15 -18
- package/src/features/page_view_timing/instrument/index.js +2 -0
- package/src/features/session_replay/aggregate/index.js +13 -9
- package/src/features/session_replay/constants.js +0 -4
- package/src/features/session_replay/index.js +1 -7
- package/src/features/session_replay/instrument/index.js +3 -4
- package/src/features/session_replay/shared/recorder-events.js +27 -20
- package/src/features/session_replay/shared/recorder.js +13 -6
- package/src/features/session_replay/shared/stylesheet-evaluator.js +2 -2
- package/src/features/session_replay/shared/utils.js +3 -2
- package/src/features/session_trace/aggregate/index.js +16 -7
- package/src/features/session_trace/aggregate/trace/storage.js +6 -1
- package/src/features/session_trace/instrument/index.js +4 -1
- package/src/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/src/features/soft_navigations/aggregate/index.js +13 -15
- package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/src/features/soft_navigations/aggregate/interaction.js +1 -1
- package/src/features/soft_navigations/instrument/index.js +9 -5
- package/src/features/spa/aggregate/index.js +12 -20
- package/src/features/spa/aggregate/interaction.js +6 -5
- package/src/features/spa/aggregate/serializer.js +2 -3
- package/src/features/spa/constants.js +2 -2
- package/src/features/spa/instrument/index.js +9 -3
- package/src/features/utils/agent-session.js +3 -1
- package/src/features/utils/aggregate-base.js +13 -3
- package/src/features/utils/event-buffer.js +126 -0
- package/src/features/utils/feature-gates.js +1 -1
- package/src/features/utils/instrument-base.js +2 -1
- package/src/features/utils/lazy-feature-loader.js +2 -2
- package/src/index.js +3 -0
- package/src/loaders/agent-base.js +2 -6
- package/src/loaders/agent.js +7 -2
- package/src/loaders/api/api.js +3 -2
- package/src/loaders/api/apiAsync.js +2 -2
- package/src/loaders/browser-agent.js +5 -3
- package/src/loaders/configure/configure.js +9 -2
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/features/features.js +8 -4
- package/src/loaders/micro-agent.js +5 -2
- package/dist/cjs/cdn/polyfills/lite.js +0 -16
- package/dist/cjs/cdn/polyfills/pro.js +0 -21
- package/dist/cjs/cdn/polyfills/spa.js +0 -22
- package/dist/cjs/cdn/polyfills.js +0 -24
- package/dist/cjs/common/config/config.js +0 -76
- package/dist/cjs/common/config/state/originals.js +0 -8
- package/dist/cjs/common/util/map-own.js +0 -31
- package/dist/cjs/common/wrap/index.js +0 -61
- package/dist/cjs/features/page_action/aggregate/index.js +0 -121
- package/dist/esm/cdn/polyfills/lite.js +0 -14
- package/dist/esm/cdn/polyfills/pro.js +0 -19
- package/dist/esm/cdn/polyfills/spa.js +0 -20
- package/dist/esm/cdn/polyfills.js +0 -27
- package/dist/esm/common/config/config.js +0 -11
- package/dist/esm/common/config/state/originals.js +0 -2
- package/dist/esm/common/util/map-own.js +0 -24
- package/dist/esm/common/wrap/index.js +0 -13
- package/dist/esm/features/page_action/aggregate/index.js +0 -114
- package/dist/types/cdn/polyfills/lite.d.ts +0 -2
- package/dist/types/cdn/polyfills/lite.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/pro.d.ts +0 -2
- package/dist/types/cdn/polyfills/pro.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/spa.d.ts +0 -2
- package/dist/types/cdn/polyfills/spa.d.ts.map +0 -1
- package/dist/types/cdn/polyfills.d.ts +0 -2
- package/dist/types/cdn/polyfills.d.ts.map +0 -1
- package/dist/types/common/config/config.d.ts +0 -13
- package/dist/types/common/config/config.d.ts.map +0 -1
- package/dist/types/common/config/state/configurable.d.ts.map +0 -1
- package/dist/types/common/config/state/info.d.ts.map +0 -1
- package/dist/types/common/config/state/init.d.ts.map +0 -1
- package/dist/types/common/config/state/loader-config.d.ts.map +0 -1
- package/dist/types/common/config/state/originals.d.ts +0 -2
- package/dist/types/common/config/state/originals.d.ts.map +0 -1
- package/dist/types/common/config/state/runtime.d.ts.map +0 -1
- package/dist/types/common/util/map-own.d.ts +0 -3
- package/dist/types/common/util/map-own.d.ts.map +0 -1
- package/dist/types/common/wrap/index.d.ts +0 -10
- package/dist/types/common/wrap/index.d.ts.map +0 -1
- package/dist/types/features/page_action/aggregate/index.d.ts.map +0 -1
- package/src/cdn/polyfills/lite.js +0 -20
- package/src/cdn/polyfills/pro.js +0 -30
- package/src/cdn/polyfills/spa.js +0 -32
- package/src/cdn/polyfills.js +0 -27
- package/src/common/config/__mocks__/config.js +0 -11
- package/src/common/config/config.js +0 -12
- package/src/common/config/state/originals.js +0 -3
- package/src/common/util/map-own.js +0 -22
- package/src/common/wrap/index.js +0 -16
- package/src/features/page_action/aggregate/index.js +0 -114
- /package/dist/types/common/config/{state/configurable.d.ts → configurable.d.ts} +0 -0
- /package/dist/types/common/config/{state/info.d.ts → info.d.ts} +0 -0
- /package/dist/types/common/config/{state/init.d.ts → init.d.ts} +0 -0
- /package/dist/types/common/config/{state/loader-config.d.ts → loader-config.d.ts} +0 -0
- /package/dist/types/common/config/{state/runtime.d.ts → runtime.d.ts} +0 -0
|
@@ -1,27 +1,34 @@
|
|
|
1
|
+
import { EventBuffer } from '../../utils/event-buffer'
|
|
2
|
+
|
|
1
3
|
export class RecorderEvents {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
/** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
|
|
4
|
+
/** The buffer to hold recorder event nodes */
|
|
5
|
+
#events = new EventBuffer(Infinity)
|
|
6
|
+
/** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
|
|
6
7
|
* cycle timestamps are used as fallbacks if event timestamps cannot be used
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/** Payload metadata -- Denotes whether all stylesheet elements were able to be inlined */
|
|
21
|
-
this.inlinedAllStylesheets = true
|
|
22
|
-
}
|
|
9
|
+
cycleTimestamp = Date.now()
|
|
10
|
+
/** Payload metadata -- Should indicate that the payload being sent has a full DOM snapshot. This can happen
|
|
11
|
+
* -- When the recording library begins recording, it starts by taking a DOM snapshot
|
|
12
|
+
* -- When visibility changes from "hidden" -> "visible", it must capture a full snapshot for the replay to work correctly across tabs
|
|
13
|
+
*/
|
|
14
|
+
hasSnapshot = false
|
|
15
|
+
/** Payload metadata -- Should indicate that the payload being sent has a meta node. The meta node should always precede a snapshot node. */
|
|
16
|
+
hasMeta = false
|
|
17
|
+
/** Payload metadata -- Should indicate that the payload being sent contains an error. Used for query/filter purposes in UI */
|
|
18
|
+
hasError = false
|
|
19
|
+
/** Payload metadata -- Denotes whether all stylesheet elements were able to be inlined */
|
|
20
|
+
inlinedAllStylesheets = true
|
|
23
21
|
|
|
24
22
|
add (event) {
|
|
25
|
-
this
|
|
23
|
+
this.#events.add(event)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get events () {
|
|
27
|
+
return this.#events.buffer
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** A value which increments with every new mutation node reported. Resets after a harvest is sent */
|
|
31
|
+
get payloadBytesEstimation () {
|
|
32
|
+
return this.#events.bytes
|
|
26
33
|
}
|
|
27
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { record as recorder } from 'rrweb'
|
|
2
2
|
import { stringify } from '../../../common/util/stringify'
|
|
3
|
-
import { AVG_COMPRESSION, CHECKOUT_MS,
|
|
4
|
-
import { getConfigurationValue } from '../../../common/config/
|
|
3
|
+
import { AVG_COMPRESSION, CHECKOUT_MS, QUERY_PARAM_PADDING, RRWEB_EVENT_TYPES, SR_EVENT_EMITTER_TYPES } from '../constants'
|
|
4
|
+
import { getConfigurationValue } from '../../../common/config/init'
|
|
5
5
|
import { RecorderEvents } from './recorder-events'
|
|
6
6
|
import { MODE } from '../../../common/session/constants'
|
|
7
7
|
import { stylesheetEvaluator } from './stylesheet-evaluator'
|
|
@@ -9,6 +9,7 @@ import { handle } from '../../../common/event-emitter/handle'
|
|
|
9
9
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
|
|
10
10
|
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
11
11
|
import { buildNRMetaNode } from './utils'
|
|
12
|
+
import { IDEAL_PAYLOAD_SIZE } from '../../../common/constants/agent-constants'
|
|
12
13
|
|
|
13
14
|
export class Recorder {
|
|
14
15
|
/** Each page mutation or event will be stored (raw) in this array. This array will be cleared on each harvest */
|
|
@@ -41,7 +42,14 @@ export class Recorder {
|
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
getEvents () {
|
|
44
|
-
if (this.#preloaded[0]?.events.length)
|
|
45
|
+
if (this.#preloaded[0]?.events.length) {
|
|
46
|
+
return {
|
|
47
|
+
...this.#preloaded[0],
|
|
48
|
+
events: this.#preloaded[0].events,
|
|
49
|
+
payloadBytesEstimation: this.#preloaded[0].payloadBytesEstimation,
|
|
50
|
+
type: 'preloaded'
|
|
51
|
+
}
|
|
52
|
+
}
|
|
45
53
|
return {
|
|
46
54
|
events: [...this.#backloggedEvents.events, ...this.#events.events].filter(x => x),
|
|
47
55
|
type: 'standard',
|
|
@@ -93,7 +101,8 @@ export class Recorder {
|
|
|
93
101
|
this.parent.ee.emit('internal-error', [err])
|
|
94
102
|
/** returning true informs rrweb to swallow the error instead of throwing it to the window */
|
|
95
103
|
return true
|
|
96
|
-
}
|
|
104
|
+
},
|
|
105
|
+
recordAfter: 'DOMContentLoaded'
|
|
97
106
|
})
|
|
98
107
|
|
|
99
108
|
this.stopRecording = () => {
|
|
@@ -176,9 +185,7 @@ export class Recorder {
|
|
|
176
185
|
if (event.type === RRWEB_EVENT_TYPES.FullSnapshot) {
|
|
177
186
|
this.currentBufferTarget.hasSnapshot = true
|
|
178
187
|
}
|
|
179
|
-
|
|
180
188
|
this.currentBufferTarget.add(event)
|
|
181
|
-
this.currentBufferTarget.payloadBytesEstimation += eventBytes
|
|
182
189
|
|
|
183
190
|
// We are making an effort to try to keep payloads manageable for unloading. If they reach the unload limit before their interval,
|
|
184
191
|
// it will send immediately. This often happens on the first snapshot, which can be significantly larger than the other payloads.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gosNREUMOriginals } from '../../../common/window/nreum'
|
|
2
2
|
import { isBrowserScope } from '../../../common/constants/runtime'
|
|
3
3
|
|
|
4
4
|
class StylesheetEvaluator {
|
|
@@ -57,7 +57,7 @@ class StylesheetEvaluator {
|
|
|
57
57
|
async #fetchAndOverride (target) {
|
|
58
58
|
if (!target?.href) return
|
|
59
59
|
try {
|
|
60
|
-
const stylesheetContents = await
|
|
60
|
+
const stylesheetContents = await gosNREUMOriginals().o.FETCH.bind(window)(target.href)
|
|
61
61
|
if (!stylesheetContents.ok) {
|
|
62
62
|
this.failedToFix++
|
|
63
63
|
return
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gosNREUMOriginals } from '../../../common/window/nreum'
|
|
2
|
+
import { getConfigurationValue } from '../../../common/config/init'
|
|
2
3
|
import { canEnableSessionTracking } from '../../utils/feature-gates'
|
|
3
4
|
import { originTime } from '../../../common/constants/runtime'
|
|
4
5
|
|
|
5
6
|
export function hasReplayPrerequisite (agentId) {
|
|
6
|
-
return !!
|
|
7
|
+
return !!gosNREUMOriginals().o.MO && // Session Replay cannot work without Mutation Observer
|
|
7
8
|
canEnableSessionTracking(agentId) && // requires session tracking to be running (hence "session" replay...)
|
|
8
9
|
getConfigurationValue(agentId, 'session_trace.enabled') === true // Session Replay as of now is tightly coupled with Session Trace in the UI
|
|
9
10
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { registerHandler } from '../../../common/event-emitter/register-handler'
|
|
2
2
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler'
|
|
3
|
-
import {
|
|
3
|
+
import { getInfo } from '../../../common/config/info'
|
|
4
|
+
import { getConfigurationValue } from '../../../common/config/init'
|
|
5
|
+
import { getRuntime } from '../../../common/config/runtime'
|
|
4
6
|
import { FEATURE_NAME } from '../constants'
|
|
5
7
|
import { AggregateBase } from '../../utils/aggregate-base'
|
|
6
8
|
import { TraceStorage } from './trace/storage'
|
|
@@ -8,6 +10,7 @@ import { obj as encodeObj } from '../../../common/url/encode'
|
|
|
8
10
|
import { deregisterDrain } from '../../../common/drain/drain'
|
|
9
11
|
import { globalScope } from '../../../common/constants/runtime'
|
|
10
12
|
import { MODE, SESSION_EVENTS } from '../../../common/session/constants'
|
|
13
|
+
import { applyFnToProps } from '../../../common/util/traverse'
|
|
11
14
|
|
|
12
15
|
const ERROR_MODE_SECONDS_WINDOW = 30 * 1000 // sliding window of nodes to track when simply monitoring (but not harvesting) in error mode
|
|
13
16
|
/** Reserved room for query param attrs */
|
|
@@ -92,7 +95,7 @@ export class Aggregate extends AggregateBase {
|
|
|
92
95
|
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
93
96
|
this.traceStorage.storeTiming(globalScope.performance?.getEntriesByType?.('navigation')[0])
|
|
94
97
|
} else {
|
|
95
|
-
this.traceStorage.storeTiming(globalScope.performance?.timing)
|
|
98
|
+
this.traceStorage.storeTiming(globalScope.performance?.timing, true)
|
|
96
99
|
}
|
|
97
100
|
|
|
98
101
|
/** Only start actually harvesting if running in full mode at init time */
|
|
@@ -151,15 +154,21 @@ export class Aggregate extends AggregateBase {
|
|
|
151
154
|
type: 'BrowserSessionChunk',
|
|
152
155
|
app_id: this.agentInfo.applicationID,
|
|
153
156
|
protocol_version: '0',
|
|
154
|
-
timestamp: this.timeKeeper.
|
|
157
|
+
timestamp: Math.floor(this.timeKeeper.correctAbsoluteTimestamp(
|
|
158
|
+
this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp)
|
|
159
|
+
)),
|
|
155
160
|
attributes: encodeObj({
|
|
156
161
|
...(agentMetadata.entityGuid && { entityGuid: agentMetadata.entityGuid }),
|
|
157
162
|
harvestId: `${this.agentRuntime.session?.state.value}_${this.agentRuntime.ptid}_${this.agentRuntime.harvestCount}`,
|
|
158
163
|
// this section of attributes must be controllable and stay below the query param padding limit -- see QUERY_PARAM_PADDING
|
|
159
164
|
// if not, data could be lost to truncation at time of sending, potentially breaking parsing / API behavior in NR1
|
|
160
165
|
// trace payload metadata
|
|
161
|
-
'trace.firstTimestamp': this.timeKeeper.
|
|
162
|
-
|
|
166
|
+
'trace.firstTimestamp': Math.floor(this.timeKeeper.correctAbsoluteTimestamp(
|
|
167
|
+
this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp)
|
|
168
|
+
)),
|
|
169
|
+
'trace.lastTimestamp': Math.floor(this.timeKeeper.correctAbsoluteTimestamp(
|
|
170
|
+
this.timeKeeper.convertRelativeTimestamp(latestTimeStamp)
|
|
171
|
+
)),
|
|
163
172
|
'trace.nodes': stns.length,
|
|
164
173
|
'trace.originTimestamp': this.timeKeeper.correctedOriginTime,
|
|
165
174
|
// other payload metadata
|
|
@@ -169,11 +178,11 @@ export class Aggregate extends AggregateBase {
|
|
|
169
178
|
ptid: `${this.ptid}`,
|
|
170
179
|
session: `${this.sessionId}`,
|
|
171
180
|
// customer-defined data should go last so that if it exceeds the query param padding limit it will be truncated instead of important attrs
|
|
172
|
-
...(endUserId && { 'enduser.id': endUserId })
|
|
181
|
+
...(endUserId && { 'enduser.id': this.obfuscator.obfuscateString(endUserId) })
|
|
173
182
|
// The Query Param is being arbitrarily limited in length here. It is also applied when estimating the size of the payload in getPayloadSize()
|
|
174
183
|
}, QUERY_PARAM_PADDING).substring(1) // remove the leading '&'
|
|
175
184
|
},
|
|
176
|
-
body: stns
|
|
185
|
+
body: applyFnToProps(stns, this.obfuscator.obfuscateString.bind(this.obfuscator), 'string')
|
|
177
186
|
}
|
|
178
187
|
}
|
|
179
188
|
|
|
@@ -148,7 +148,7 @@ export class TraceStorage {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
storeTiming (timingEntry) {
|
|
151
|
+
storeTiming (timingEntry, isAbsoluteTimestamp = false) {
|
|
152
152
|
if (!timingEntry) return
|
|
153
153
|
|
|
154
154
|
// loop iterates through prototype also (for FF)
|
|
@@ -164,6 +164,11 @@ export class TraceStorage {
|
|
|
164
164
|
if (!(typeof val === 'number' && val >= 0)) continue
|
|
165
165
|
|
|
166
166
|
val = Math.round(val)
|
|
167
|
+
if (this.parent.timeKeeper && this.parent.timeKeeper.ready && isAbsoluteTimestamp) {
|
|
168
|
+
val = this.parent.timeKeeper.convertAbsoluteTimestamp(
|
|
169
|
+
Math.floor(this.parent.timeKeeper.correctAbsoluteTimestamp(val))
|
|
170
|
+
)
|
|
171
|
+
}
|
|
167
172
|
this.storeSTN(new TraceNode(key, val, val, 'document', 'timing'))
|
|
168
173
|
}
|
|
169
174
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { handle } from '../../../common/event-emitter/handle'
|
|
6
|
-
import { wrapHistory
|
|
6
|
+
import { wrapHistory } from '../../../common/wrap/wrap-history'
|
|
7
|
+
import { wrapEvents } from '../../../common/wrap/wrap-events'
|
|
7
8
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
8
9
|
import * as CONSTANTS from '../constants'
|
|
9
10
|
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
@@ -61,3 +62,5 @@ export class Instrument extends InstrumentBase {
|
|
|
61
62
|
this.importAggregator({ resourceObserver: observer })
|
|
62
63
|
}
|
|
63
64
|
}
|
|
65
|
+
|
|
66
|
+
export const SessionTrace = Instrument
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfigurationValue } from '../../../common/config/
|
|
1
|
+
import { getConfigurationValue } from '../../../common/config/init'
|
|
2
2
|
import { deregisterDrain } from '../../../common/drain/drain'
|
|
3
3
|
import { handle } from '../../../common/event-emitter/handle'
|
|
4
4
|
import { registerHandler } from '../../../common/event-emitter/register-handler'
|
|
@@ -8,6 +8,7 @@ import { timeToFirstByte } from '../../../common/vitals/time-to-first-byte'
|
|
|
8
8
|
import { FEATURE_NAMES } from '../../../loaders/features/features'
|
|
9
9
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
|
|
10
10
|
import { AggregateBase } from '../../utils/aggregate-base'
|
|
11
|
+
import { EventBuffer } from '../../utils/event-buffer'
|
|
11
12
|
import { API_TRIGGER_NAME, FEATURE_NAME, INTERACTION_STATUS } from '../constants'
|
|
12
13
|
import { AjaxNode } from './ajax-node'
|
|
13
14
|
import { InitialPageLoadInteraction } from './initial-page-load-interaction'
|
|
@@ -19,8 +20,7 @@ export class Aggregate extends AggregateBase {
|
|
|
19
20
|
super(agentIdentifier, aggregator, FEATURE_NAME)
|
|
20
21
|
|
|
21
22
|
const harvestTimeSeconds = getConfigurationValue(agentIdentifier, 'soft_navigations.harvestTimeSeconds') || 10
|
|
22
|
-
this.interactionsToHarvest =
|
|
23
|
-
this.interactionsAwaitingRetry = []
|
|
23
|
+
this.interactionsToHarvest = new EventBuffer()
|
|
24
24
|
this.domObserver = domObserver
|
|
25
25
|
|
|
26
26
|
this.initialPageLoadInteraction = new InitialPageLoadInteraction(agentIdentifier)
|
|
@@ -28,7 +28,7 @@ export class Aggregate extends AggregateBase {
|
|
|
28
28
|
const loadEventTime = attrs.navigationEntry.loadEventEnd
|
|
29
29
|
this.initialPageLoadInteraction.forceSave = true
|
|
30
30
|
this.initialPageLoadInteraction.done(loadEventTime)
|
|
31
|
-
this.interactionsToHarvest.
|
|
31
|
+
this.interactionsToHarvest.add(this.initialPageLoadInteraction)
|
|
32
32
|
this.initialPageLoadInteraction = null
|
|
33
33
|
// Report metric on the initial page load time
|
|
34
34
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['SoftNav/Interaction/InitialPageLoad/Duration/Ms', Math.round(loadEventTime)], undefined, FEATURE_NAMES.metrics, this.ee)
|
|
@@ -69,28 +69,26 @@ export class Aggregate extends AggregateBase {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
onHarvestStarted (options) {
|
|
72
|
-
if (this.interactionsToHarvest.
|
|
72
|
+
if (!this.interactionsToHarvest.hasData || this.blocked) return
|
|
73
73
|
// The payload depacker takes the first ixn of a payload (if there are multiple ixns) and positively offset the subsequent ixns timestamps by that amount.
|
|
74
74
|
// In order to accurately portray the real start & end times of the 2nd & onward ixns, we hence need to negatively offset their start timestamps with that of the 1st ixn.
|
|
75
75
|
let firstIxnStartTime = 0 // the very 1st ixn does not require any offsetting
|
|
76
76
|
const serializedIxnList = []
|
|
77
|
-
for (const interaction of this.interactionsToHarvest) {
|
|
77
|
+
for (const interaction of this.interactionsToHarvest.buffer) {
|
|
78
78
|
serializedIxnList.push(interaction.serialize(firstIxnStartTime))
|
|
79
79
|
if (!firstIxnStartTime) firstIxnStartTime = Math.floor(interaction.start)
|
|
80
80
|
}
|
|
81
81
|
const payload = `bel.7;${serializedIxnList.join(';')}`
|
|
82
82
|
|
|
83
|
-
if (options.retry) this.
|
|
84
|
-
this.interactionsToHarvest
|
|
83
|
+
if (options.retry) this.interactionsToHarvest.hold()
|
|
84
|
+
else this.interactionsToHarvest.clear()
|
|
85
85
|
|
|
86
86
|
return { body: { e: payload } }
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
onHarvestFinished (result) {
|
|
90
|
-
if (result.sent && result.retry && this.
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
this.interactionsAwaitingRetry = []
|
|
90
|
+
if (result.sent && result.retry && this.interactionsToHarvest.held.hasData) this.interactionsToHarvest.unhold()
|
|
91
|
+
else this.interactionsToHarvest.held.clear()
|
|
94
92
|
}
|
|
95
93
|
|
|
96
94
|
startUIInteraction (eventName, startedAt, sourceElem) { // this is throttled by instrumentation so that it isn't excessively called
|
|
@@ -113,7 +111,7 @@ export class Aggregate extends AggregateBase {
|
|
|
113
111
|
setClosureHandlers () {
|
|
114
112
|
this.interactionInProgress.on('finished', () => {
|
|
115
113
|
const ref = this.interactionInProgress
|
|
116
|
-
this.interactionsToHarvest.
|
|
114
|
+
this.interactionsToHarvest.add(this.interactionInProgress)
|
|
117
115
|
this.interactionInProgress = null
|
|
118
116
|
this.domObserver.disconnect() // can stop observing whenever our interaction logic completes a cycle
|
|
119
117
|
|
|
@@ -143,8 +141,8 @@ export class Aggregate extends AggregateBase {
|
|
|
143
141
|
*/
|
|
144
142
|
if (this.interactionInProgress?.isActiveDuring(timestamp)) return this.interactionInProgress
|
|
145
143
|
let saveIxn
|
|
146
|
-
for (let idx = this.interactionsToHarvest.length - 1; idx >= 0; idx--) { // reverse search for the latest completed interaction for efficiency
|
|
147
|
-
const finishedInteraction = this.interactionsToHarvest[idx]
|
|
144
|
+
for (let idx = this.interactionsToHarvest.buffer.length - 1; idx >= 0; idx--) { // reverse search for the latest completed interaction for efficiency
|
|
145
|
+
const finishedInteraction = this.interactionsToHarvest.buffer[idx]
|
|
148
146
|
if (finishedInteraction.isActiveDuring(timestamp)) {
|
|
149
147
|
if (finishedInteraction.trigger !== 'initialPageLoad') return finishedInteraction
|
|
150
148
|
// It's possible that a complete interaction occurs before page is fully loaded, so we need to consider if a route-change ixn may have overlapped this iPL
|
|
@@ -3,7 +3,7 @@ import { Interaction } from './interaction'
|
|
|
3
3
|
import { numeric } from '../../../common/serialize/bel-serializer'
|
|
4
4
|
import { firstPaint } from '../../../common/vitals/first-paint'
|
|
5
5
|
import { firstContentfulPaint } from '../../../common/vitals/first-contentful-paint'
|
|
6
|
-
import { getInfo } from '../../../common/config/
|
|
6
|
+
import { getInfo } from '../../../common/config/info'
|
|
7
7
|
|
|
8
8
|
export class InitialPageLoadInteraction extends Interaction {
|
|
9
9
|
constructor (agentIdentifier) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getInfo } from '../../../common/config/
|
|
1
|
+
import { getInfo } from '../../../common/config/info'
|
|
2
2
|
import { globalScope, initialLocation } from '../../../common/constants/runtime'
|
|
3
3
|
import { generateUuid } from '../../../common/ids/unique-id'
|
|
4
4
|
import { addCustomAttributes, getAddStringContext, nullable, numeric } from '../../../common/serialize/bel-serializer'
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gosNREUMOriginals } from '../../../common/window/nreum'
|
|
2
2
|
import { isBrowserScope } from '../../../common/constants/runtime'
|
|
3
3
|
import { handle } from '../../../common/event-emitter/handle'
|
|
4
4
|
import { windowAddEventListener } from '../../../common/event-listener/event-listener-opts'
|
|
5
5
|
import { debounce } from '../../../common/util/invoke'
|
|
6
|
-
import { wrapEvents
|
|
6
|
+
import { wrapEvents } from '../../../common/wrap/wrap-events'
|
|
7
|
+
import { wrapHistory } from '../../../common/wrap/wrap-history'
|
|
7
8
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
8
9
|
import { FEATURE_NAME, INTERACTION_TRIGGERS } from '../constants'
|
|
9
10
|
import { now } from '../../../common/timing/now'
|
|
10
11
|
|
|
11
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* The minimal time after a UI event for which no further events will be processed - i.e. a throttling rate to reduce spam.
|
|
12
14
|
* This also give some time for the new interaction to complete without being discarded by a subsequent UI event and wrongly attributed.
|
|
13
15
|
* This value is still subject to change and critique, as it is derived from beyond worst case time to next frame of a page.
|
|
14
16
|
*/
|
|
@@ -18,7 +20,7 @@ export class Instrument extends InstrumentBase {
|
|
|
18
20
|
static featureName = FEATURE_NAME
|
|
19
21
|
constructor (agentIdentifier, aggregator, auto = true) {
|
|
20
22
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto)
|
|
21
|
-
if (!isBrowserScope || !
|
|
23
|
+
if (!isBrowserScope || !gosNREUMOriginals().o.MO) return // soft navigations is not supported outside web env or browsers without the mutation observer API
|
|
22
24
|
|
|
23
25
|
const historyEE = wrapHistory(this.ee)
|
|
24
26
|
const eventsEE = wrapEvents(this.ee)
|
|
@@ -34,7 +36,7 @@ export class Instrument extends InstrumentBase {
|
|
|
34
36
|
windowAddEventListener('popstate', trackURLChangeEvent, true, this.removeOnAbort?.signal)
|
|
35
37
|
|
|
36
38
|
let oncePerFrame = false // attempt to reduce dom noice since the observer runs very frequently with below options
|
|
37
|
-
const domObserver = new
|
|
39
|
+
const domObserver = new (gosNREUMOriginals().o).MO((domChanges, observer) => {
|
|
38
40
|
if (oncePerFrame) return
|
|
39
41
|
oncePerFrame = true
|
|
40
42
|
requestAnimationFrame(() => { // waiting for next frame to time when any visuals are supposedly updated
|
|
@@ -65,3 +67,5 @@ export class Instrument extends InstrumentBase {
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}
|
|
70
|
+
|
|
71
|
+
export const SoftNav = Instrument
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
import { registerHandler as register } from '../../../common/event-emitter/register-handler'
|
|
7
7
|
import { parseUrl } from '../../../common/url/parse-url'
|
|
8
8
|
import { shouldCollectEvent } from '../../../common/deny-list/deny-list'
|
|
9
|
-
import { mapOwn } from '../../../common/util/map-own'
|
|
10
9
|
import { navTimingValues as navTiming } from '../../../common/timing/nav-timing'
|
|
11
10
|
import { generateUuid } from '../../../common/ids/unique-id'
|
|
12
11
|
import { Interaction } from './interaction'
|
|
13
|
-
import { getConfigurationValue
|
|
12
|
+
import { getConfigurationValue } from '../../../common/config/init'
|
|
13
|
+
import { getRuntime } from '../../../common/config/runtime'
|
|
14
14
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts'
|
|
15
15
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler'
|
|
16
16
|
import { Serializer } from './serializer'
|
|
@@ -26,6 +26,7 @@ import { handle } from '../../../common/event-emitter/handle'
|
|
|
26
26
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
|
|
27
27
|
import { deregisterDrain } from '../../../common/drain/drain'
|
|
28
28
|
import { warn } from '../../../common/util/console'
|
|
29
|
+
import { EventBuffer } from '../../utils/event-buffer'
|
|
29
30
|
|
|
30
31
|
const {
|
|
31
32
|
FEATURE_NAME, INTERACTION_EVENTS, MAX_TIMER_BUDGET, FN_START, FN_END, CB_START, INTERACTION_API, REMAINING,
|
|
@@ -51,8 +52,7 @@ export class Aggregate extends AggregateBase {
|
|
|
51
52
|
childTime: 0,
|
|
52
53
|
depth: 0,
|
|
53
54
|
harvestTimeSeconds: getConfigurationValue(agentIdentifier, 'spa.harvestTimeSeconds') || 10,
|
|
54
|
-
interactionsToHarvest:
|
|
55
|
-
interactionsSent: [],
|
|
55
|
+
interactionsToHarvest: new EventBuffer(),
|
|
56
56
|
// The below feature flag is used to disable the SPA ajax fix for specific customers, see https://new-relic.atlassian.net/browse/NR-172169
|
|
57
57
|
disableSpaFix: (getConfigurationValue(agentIdentifier, 'feature_flags') || []).indexOf('disable-spa-fix') > -1
|
|
58
58
|
}
|
|
@@ -668,7 +668,7 @@ export class Aggregate extends AggregateBase {
|
|
|
668
668
|
|
|
669
669
|
// make sure that newrelic[INTERACTION]() works in end handler
|
|
670
670
|
state.currentNode = root
|
|
671
|
-
|
|
671
|
+
Object.values(interaction.handlers || {}).forEach(function (cb) {
|
|
672
672
|
cb(attrs.store)
|
|
673
673
|
})
|
|
674
674
|
setCurrentNode(null)
|
|
@@ -676,26 +676,18 @@ export class Aggregate extends AggregateBase {
|
|
|
676
676
|
|
|
677
677
|
const classThis = this
|
|
678
678
|
function onHarvestStarted (options) {
|
|
679
|
-
if (state.interactionsToHarvest.
|
|
680
|
-
var payload = serializer.serializeMultiple(state.interactionsToHarvest, 0, navTiming)
|
|
679
|
+
if (!state.interactionsToHarvest.hasData || classThis.blocked) return {}
|
|
680
|
+
var payload = serializer.serializeMultiple(state.interactionsToHarvest.buffer, 0, navTiming)
|
|
681
681
|
|
|
682
|
-
if (options.retry)
|
|
683
|
-
|
|
684
|
-
state.interactionsSent.push(interaction)
|
|
685
|
-
})
|
|
686
|
-
}
|
|
687
|
-
state.interactionsToHarvest = []
|
|
682
|
+
if (options.retry) state.interactionsToHarvest.hold()
|
|
683
|
+
else state.interactionsToHarvest.clear()
|
|
688
684
|
|
|
689
685
|
return { body: { e: payload } }
|
|
690
686
|
}
|
|
691
687
|
|
|
692
688
|
function onHarvestFinished (result) {
|
|
693
|
-
if (result.sent && result.retry && state.
|
|
694
|
-
|
|
695
|
-
state.interactionsToHarvest.unshift(interaction)
|
|
696
|
-
})
|
|
697
|
-
state.interactionsSent = []
|
|
698
|
-
}
|
|
689
|
+
if (result.sent && result.retry && state.interactionsToHarvest.held.hasData) state.interactionsToHarvest.unhold()
|
|
690
|
+
else state.interactionsToHarvest.held.clear()
|
|
699
691
|
}
|
|
700
692
|
|
|
701
693
|
baseEE.on('spa-jserror', function (type, name, params, metrics) {
|
|
@@ -748,7 +740,7 @@ export class Aggregate extends AggregateBase {
|
|
|
748
740
|
interaction.root.attrs.firstContentfulPaint = firstContentfulPaint.current.value
|
|
749
741
|
}
|
|
750
742
|
baseEE.emit('interactionDone', [interaction, true])
|
|
751
|
-
state.interactionsToHarvest.
|
|
743
|
+
state.interactionsToHarvest.add(interaction)
|
|
752
744
|
|
|
753
745
|
let smCategory
|
|
754
746
|
if (interaction.root?.attrs?.trigger === 'initialPageLoad') smCategory = 'InitialPageLoad'
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { getInfo
|
|
7
|
-
import {
|
|
6
|
+
import { getInfo } from '../../../common/config/info'
|
|
7
|
+
import { getRuntime } from '../../../common/config/runtime'
|
|
8
|
+
import { gosNREUMOriginals } from '../../../common/window/nreum'
|
|
8
9
|
import { ee } from '../../../common/event-emitter/contextual-ee'
|
|
9
10
|
import { InteractionNode } from './interaction-node'
|
|
10
11
|
|
|
11
|
-
var originalSetTimeout =
|
|
12
|
-
var originalClearTimeout =
|
|
12
|
+
var originalSetTimeout = gosNREUMOriginals().o.ST
|
|
13
|
+
var originalClearTimeout = gosNREUMOriginals().o.CT
|
|
13
14
|
|
|
14
15
|
var lastId = {}
|
|
15
16
|
|
|
@@ -101,7 +102,7 @@ InteractionPrototype.finish = function finishInteraction () {
|
|
|
101
102
|
this.onFinished(this)
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
|
|
105
|
+
Object.entries(getInfo(interaction.agentIdentifier).jsAttributes || {}).forEach(([attr, value]) => {
|
|
105
106
|
if (!(attr in customAttrs)) customAttrs[attr] = value
|
|
106
107
|
})
|
|
107
108
|
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { cleanURL } from '../../../common/url/clean-url'
|
|
6
|
-
import { mapOwn } from '../../../common/util/map-own'
|
|
7
6
|
import { nullable, numeric, getAddStringContext, addCustomAttributes } from '../../../common/serialize/bel-serializer'
|
|
8
7
|
import { SharedContext } from '../../../common/context/shared-context'
|
|
9
|
-
import { getInfo } from '../../../common/config/
|
|
8
|
+
import { getInfo } from '../../../common/config/info'
|
|
10
9
|
|
|
11
10
|
export class Serializer extends SharedContext {
|
|
12
11
|
constructor (parent) {
|
|
@@ -181,7 +180,7 @@ export class Serializer extends SharedContext {
|
|
|
181
180
|
// get all navTiming values except navigationStart
|
|
182
181
|
// (since its the same as interaction.start)
|
|
183
182
|
// and limit to just the first 20 values we know about
|
|
184
|
-
|
|
183
|
+
Object.values(navTiming.slice(1, 21) || {}).forEach((v) => {
|
|
185
184
|
if (v !== undefined) {
|
|
186
185
|
navTimingNode += seperator + numeric(v - prev)
|
|
187
186
|
seperator = ','
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gosNREUMOriginals } from '../../common/window/nreum'
|
|
2
2
|
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
3
3
|
|
|
4
4
|
export const FEATURE_NAME = FEATURE_NAMES.spa
|
|
@@ -25,7 +25,7 @@ export const FETCH_DONE = 'fetch-done'
|
|
|
25
25
|
export const FETCH_BODY = 'fetch-body-'
|
|
26
26
|
export const JSONP_END = 'jsonp-end'
|
|
27
27
|
|
|
28
|
-
export const originalSetTimeout =
|
|
28
|
+
export const originalSetTimeout = gosNREUMOriginals().o.ST
|
|
29
29
|
|
|
30
30
|
export const START = '-start'
|
|
31
31
|
export const END = '-end'
|
|
@@ -2,15 +2,19 @@
|
|
|
2
2
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
wrapMutation, wrapPromise, wrapHistory, wrapTimer, wrapFetch, wrapXhr, wrapJsonP
|
|
7
|
-
} from '../../../common/wrap'
|
|
8
5
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts'
|
|
9
6
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
10
7
|
import * as CONSTANTS from '../constants'
|
|
11
8
|
import { isBrowserScope } from '../../../common/constants/runtime'
|
|
12
9
|
import { now } from '../../../common/timing/now'
|
|
13
10
|
import { handle } from '../../../common/event-emitter/handle'
|
|
11
|
+
import { wrapJsonP } from '../../../common/wrap/wrap-jsonp'
|
|
12
|
+
import { wrapPromise } from '../../../common/wrap/wrap-promise'
|
|
13
|
+
import { wrapTimer } from '../../../common/wrap/wrap-timer'
|
|
14
|
+
import { wrapXhr } from '../../../common/wrap/wrap-xhr'
|
|
15
|
+
import { wrapFetch } from '../../../common/wrap/wrap-fetch'
|
|
16
|
+
import { wrapHistory } from '../../../common/wrap/wrap-history'
|
|
17
|
+
import { wrapMutation } from '../../../common/wrap/wrap-mutation'
|
|
14
18
|
|
|
15
19
|
const {
|
|
16
20
|
FEATURE_NAME, START, END, BODY, CB_END, JS_TIME, FETCH, FN_START, CB_START, FN_END
|
|
@@ -112,3 +116,5 @@ export class Instrument extends InstrumentBase {
|
|
|
112
116
|
this.abortHandler = undefined // weakly allow this abort op to run only once
|
|
113
117
|
}
|
|
114
118
|
}
|
|
119
|
+
|
|
120
|
+
export const Spa = Instrument
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInfo } from '../../common/config/info'
|
|
2
|
+
import { getConfiguration } from '../../common/config/init'
|
|
3
|
+
import { getRuntime } from '../../common/config/runtime'
|
|
2
4
|
import { drain } from '../../common/drain/drain'
|
|
3
5
|
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
4
6
|
import { registerHandler } from '../../common/event-emitter/register-handler'
|