@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
|
@@ -4,30 +4,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.RecorderEvents = void 0;
|
|
7
|
+
var _eventBuffer = require("../../utils/event-buffer");
|
|
7
8
|
class RecorderEvents {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
|
|
9
|
+
/** The buffer to hold recorder event nodes */
|
|
10
|
+
#events = new _eventBuffer.EventBuffer(Infinity);
|
|
11
|
+
/** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
|
|
12
12
|
* cycle timestamps are used as fallbacks if event timestamps cannot be used
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
/** Payload metadata -- Denotes whether all stylesheet elements were able to be inlined */
|
|
27
|
-
this.inlinedAllStylesheets = true;
|
|
28
|
-
}
|
|
14
|
+
cycleTimestamp = Date.now();
|
|
15
|
+
/** Payload metadata -- Should indicate that the payload being sent has a full DOM snapshot. This can happen
|
|
16
|
+
* -- When the recording library begins recording, it starts by taking a DOM snapshot
|
|
17
|
+
* -- When visibility changes from "hidden" -> "visible", it must capture a full snapshot for the replay to work correctly across tabs
|
|
18
|
+
*/
|
|
19
|
+
hasSnapshot = false;
|
|
20
|
+
/** Payload metadata -- Should indicate that the payload being sent has a meta node. The meta node should always precede a snapshot node. */
|
|
21
|
+
hasMeta = false;
|
|
22
|
+
/** Payload metadata -- Should indicate that the payload being sent contains an error. Used for query/filter purposes in UI */
|
|
23
|
+
hasError = false;
|
|
24
|
+
/** Payload metadata -- Denotes whether all stylesheet elements were able to be inlined */
|
|
25
|
+
inlinedAllStylesheets = true;
|
|
29
26
|
add(event) {
|
|
30
|
-
this
|
|
27
|
+
this.#events.add(event);
|
|
28
|
+
}
|
|
29
|
+
get events() {
|
|
30
|
+
return this.#events.buffer;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** A value which increments with every new mutation node reported. Resets after a harvest is sent */
|
|
34
|
+
get payloadBytesEstimation() {
|
|
35
|
+
return this.#events.bytes;
|
|
31
36
|
}
|
|
32
37
|
}
|
|
33
38
|
exports.RecorderEvents = RecorderEvents;
|
|
@@ -7,7 +7,7 @@ exports.Recorder = void 0;
|
|
|
7
7
|
var _rrweb = require("rrweb");
|
|
8
8
|
var _stringify = require("../../../common/util/stringify");
|
|
9
9
|
var _constants = require("../constants");
|
|
10
|
-
var
|
|
10
|
+
var _init = require("../../../common/config/init");
|
|
11
11
|
var _recorderEvents = require("./recorder-events");
|
|
12
12
|
var _constants2 = require("../../../common/session/constants");
|
|
13
13
|
var _stylesheetEvaluator = require("./stylesheet-evaluator");
|
|
@@ -15,6 +15,7 @@ var _handle = require("../../../common/event-emitter/handle");
|
|
|
15
15
|
var _constants3 = require("../../metrics/constants");
|
|
16
16
|
var _features = require("../../../loaders/features/features");
|
|
17
17
|
var _utils = require("./utils");
|
|
18
|
+
var _agentConstants = require("../../../common/constants/agent-constants");
|
|
18
19
|
class Recorder {
|
|
19
20
|
/** Each page mutation or event will be stored (raw) in this array. This array will be cleared on each harvest */
|
|
20
21
|
#events;
|
|
@@ -37,17 +38,21 @@ class Recorder {
|
|
|
37
38
|
/** The parent class that instantiated the recorder */
|
|
38
39
|
this.parent = parent;
|
|
39
40
|
/** Config to inform to inline stylesheet contents (true default) */
|
|
40
|
-
this.shouldInlineStylesheets = (0,
|
|
41
|
+
this.shouldInlineStylesheets = (0, _init.getConfigurationValue)(this.parent.agentIdentifier, 'session_replay.inline_stylesheet');
|
|
41
42
|
/** A flag that can be set to false by failing conversions to stop the fetching process */
|
|
42
|
-
this.shouldFix = this.shouldInlineStylesheets && (0,
|
|
43
|
+
this.shouldFix = this.shouldInlineStylesheets && (0, _init.getConfigurationValue)(this.parent.agentIdentifier, 'session_replay.fix_stylesheets');
|
|
43
44
|
/** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
|
|
44
45
|
this.stopRecording = () => {/* no-op until set by rrweb initializer */};
|
|
45
46
|
}
|
|
46
47
|
getEvents() {
|
|
47
|
-
if (this.#preloaded[0]?.events.length)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (this.#preloaded[0]?.events.length) {
|
|
49
|
+
return {
|
|
50
|
+
...this.#preloaded[0],
|
|
51
|
+
events: this.#preloaded[0].events,
|
|
52
|
+
payloadBytesEstimation: this.#preloaded[0].payloadBytesEstimation,
|
|
53
|
+
type: 'preloaded'
|
|
54
|
+
};
|
|
55
|
+
}
|
|
51
56
|
return {
|
|
52
57
|
events: [...this.#backloggedEvents.events, ...this.#events.events].filter(x => x),
|
|
53
58
|
type: 'standard',
|
|
@@ -80,7 +85,7 @@ class Recorder {
|
|
|
80
85
|
inline_stylesheet,
|
|
81
86
|
inline_images,
|
|
82
87
|
collect_fonts
|
|
83
|
-
} = (0,
|
|
88
|
+
} = (0, _init.getConfigurationValue)(this.parent.agentIdentifier, 'session_replay');
|
|
84
89
|
const customMasker = (text, element) => {
|
|
85
90
|
if (element?.type?.toLowerCase() !== 'password' && (element?.dataset.nrUnmask !== undefined || element?.classList.contains('nr-unmask'))) return text;
|
|
86
91
|
return '*'.repeat(text.length);
|
|
@@ -108,7 +113,8 @@ class Recorder {
|
|
|
108
113
|
this.parent.ee.emit('internal-error', [err]);
|
|
109
114
|
/** returning true informs rrweb to swallow the error instead of throwing it to the window */
|
|
110
115
|
return true;
|
|
111
|
-
}
|
|
116
|
+
},
|
|
117
|
+
recordAfter: 'DOMContentLoaded'
|
|
112
118
|
});
|
|
113
119
|
this.stopRecording = () => {
|
|
114
120
|
this.recording = false;
|
|
@@ -186,11 +192,10 @@ class Recorder {
|
|
|
186
192
|
this.currentBufferTarget.hasSnapshot = true;
|
|
187
193
|
}
|
|
188
194
|
this.currentBufferTarget.add(event);
|
|
189
|
-
this.currentBufferTarget.payloadBytesEstimation += eventBytes;
|
|
190
195
|
|
|
191
196
|
// We are making an effort to try to keep payloads manageable for unloading. If they reach the unload limit before their interval,
|
|
192
197
|
// it will send immediately. This often happens on the first snapshot, which can be significantly larger than the other payloads.
|
|
193
|
-
if ((event.type === _constants.RRWEB_EVENT_TYPES.FullSnapshot && this.currentBufferTarget.hasMeta || payloadSize >
|
|
198
|
+
if ((event.type === _constants.RRWEB_EVENT_TYPES.FullSnapshot && this.currentBufferTarget.hasMeta || payloadSize > _agentConstants.IDEAL_PAYLOAD_SIZE) && this.parent.mode === _constants2.MODE.FULL) {
|
|
194
199
|
// if we've made it to the ideal size of ~64kb before the interval timer, we should send early.
|
|
195
200
|
if (this.parent.scheduler) {
|
|
196
201
|
this.parent.scheduler.runHarvest();
|
|
@@ -215,8 +220,7 @@ class Recorder {
|
|
|
215
220
|
}
|
|
216
221
|
|
|
217
222
|
/** Estimate the payload size */
|
|
218
|
-
getPayloadSize() {
|
|
219
|
-
let newBytes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
223
|
+
getPayloadSize(newBytes = 0) {
|
|
220
224
|
// the query param padding constant gives us some padding for the other metadata to be safely injected
|
|
221
225
|
return this.estimateCompression(this.currentBufferTarget.payloadBytesEstimation + newBytes) + _constants.QUERY_PARAM_PADDING;
|
|
222
226
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.stylesheetEvaluator = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _nreum = require("../../../common/window/nreum");
|
|
8
8
|
var _runtime = require("../../../common/constants/runtime");
|
|
9
9
|
class StylesheetEvaluator {
|
|
10
10
|
#evaluated = new WeakSet();
|
|
@@ -62,7 +62,7 @@ class StylesheetEvaluator {
|
|
|
62
62
|
async #fetchAndOverride(target) {
|
|
63
63
|
if (!target?.href) return;
|
|
64
64
|
try {
|
|
65
|
-
const stylesheetContents = await
|
|
65
|
+
const stylesheetContents = await (0, _nreum.gosNREUMOriginals)().o.FETCH.bind(window)(target.href);
|
|
66
66
|
if (!stylesheetContents.ok) {
|
|
67
67
|
this.failedToFix++;
|
|
68
68
|
return;
|
|
@@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.buildNRMetaNode = buildNRMetaNode;
|
|
7
7
|
exports.hasReplayPrerequisite = hasReplayPrerequisite;
|
|
8
8
|
exports.isPreloadAllowed = isPreloadAllowed;
|
|
9
|
-
var
|
|
9
|
+
var _nreum = require("../../../common/window/nreum");
|
|
10
|
+
var _init = require("../../../common/config/init");
|
|
10
11
|
var _featureGates = require("../../utils/feature-gates");
|
|
11
12
|
var _runtime = require("../../../common/constants/runtime");
|
|
12
13
|
function hasReplayPrerequisite(agentId) {
|
|
13
|
-
return !!
|
|
14
|
+
return !!(0, _nreum.gosNREUMOriginals)().o.MO &&
|
|
14
15
|
// Session Replay cannot work without Mutation Observer
|
|
15
16
|
(0, _featureGates.canEnableSessionTracking)(agentId) &&
|
|
16
17
|
// requires session tracking to be running (hence "session" replay...)
|
|
17
|
-
(0,
|
|
18
|
+
(0, _init.getConfigurationValue)(agentId, 'session_trace.enabled') === true; // Session Replay as of now is tightly coupled with Session Trace in the UI
|
|
18
19
|
}
|
|
19
20
|
function isPreloadAllowed(agentId) {
|
|
20
|
-
return (0,
|
|
21
|
+
return (0, _init.getConfigurationValue)(agentId, 'session_replay.preload') === true && hasReplayPrerequisite(agentId);
|
|
21
22
|
}
|
|
22
23
|
function buildNRMetaNode(timestamp, timeKeeper) {
|
|
23
24
|
const correctedTimestamp = timeKeeper.correctAbsoluteTimestamp(timestamp);
|
|
@@ -6,14 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
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
|
-
var
|
|
9
|
+
var _info = require("../../../common/config/info");
|
|
10
|
+
var _init = require("../../../common/config/init");
|
|
11
|
+
var _runtime = require("../../../common/config/runtime");
|
|
10
12
|
var _constants = require("../constants");
|
|
11
13
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
12
14
|
var _storage = require("./trace/storage");
|
|
13
15
|
var _encode = require("../../../common/url/encode");
|
|
14
16
|
var _drain = require("../../../common/drain/drain");
|
|
15
|
-
var
|
|
17
|
+
var _runtime2 = require("../../../common/constants/runtime");
|
|
16
18
|
var _constants2 = require("../../../common/session/constants");
|
|
19
|
+
var _traverse = require("../../../common/util/traverse");
|
|
17
20
|
const ERROR_MODE_SECONDS_WINDOW = 30 * 1000; // sliding window of nodes to track when simply monitoring (but not harvesting) in error mode
|
|
18
21
|
/** Reserved room for query param attrs */
|
|
19
22
|
const QUERY_PARAM_PADDING = 5000;
|
|
@@ -21,12 +24,12 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
21
24
|
static featureName = _constants.FEATURE_NAME;
|
|
22
25
|
constructor(agentIdentifier, aggregator) {
|
|
23
26
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
24
|
-
this.agentRuntime = (0,
|
|
25
|
-
this.agentInfo = (0,
|
|
27
|
+
this.agentRuntime = (0, _runtime.getRuntime)(agentIdentifier);
|
|
28
|
+
this.agentInfo = (0, _info.getInfo)(agentIdentifier);
|
|
26
29
|
|
|
27
30
|
/** A buffer to hold on to harvested traces in the case that a retry must be made later */
|
|
28
31
|
this.sentTrace = null;
|
|
29
|
-
this.harvestTimeSeconds = (0,
|
|
32
|
+
this.harvestTimeSeconds = (0, _init.getConfigurationValue)(agentIdentifier, 'session_trace.harvestTimeSeconds') || 30;
|
|
30
33
|
/** Tied to the entitlement flag response from BCS. Will short circuit operations of the agg if false */
|
|
31
34
|
this.entitled = undefined;
|
|
32
35
|
/** A flag used to decide if the 30 node threshold should be ignored on the first harvest to ensure sending on the first payload */
|
|
@@ -36,15 +39,11 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
36
39
|
/** TraceStorage is the mechanism that holds, normalizes and aggregates ST nodes. It will be accessed and purged when harvests occur */
|
|
37
40
|
this.traceStorage = new _storage.TraceStorage(this);
|
|
38
41
|
/** This agg needs information about sampling (sts) and entitlements (st) to make the appropriate decisions on running */
|
|
39
|
-
this.waitForFlags(['sts', 'st']).then(
|
|
40
|
-
let [stMode, stEntitled] = _ref;
|
|
41
|
-
return this.initialize(stMode, stEntitled);
|
|
42
|
-
});
|
|
42
|
+
this.waitForFlags(['sts', 'st']).then(([stMode, stEntitled]) => this.initialize(stMode, stEntitled));
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/** Sets up event listeners, and initializes this module to run in the correct "mode". Can be triggered from a few places, but makes an effort to only set up listeners once */
|
|
46
46
|
initialize(stMode, stEntitled, ignoreSession) {
|
|
47
|
-
var _this = this;
|
|
48
47
|
this.entitled ??= stEntitled;
|
|
49
48
|
if (this.blocked || !this.entitled) return (0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
|
|
50
49
|
if (!this.initialized) {
|
|
@@ -84,31 +83,17 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
84
83
|
}, this);
|
|
85
84
|
|
|
86
85
|
/** The handlers set up by the Inst file */
|
|
87
|
-
(0, _registerHandler.registerHandler)('bst',
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
(0, _registerHandler.registerHandler)('
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
(0, _registerHandler.registerHandler)('
|
|
94
|
-
return _this.traceStorage.storeHist(...arguments);
|
|
95
|
-
}, this.featureName, this.ee);
|
|
96
|
-
(0, _registerHandler.registerHandler)('bstXhrAgg', function () {
|
|
97
|
-
return _this.traceStorage.storeXhrAgg(...arguments);
|
|
98
|
-
}, this.featureName, this.ee);
|
|
99
|
-
(0, _registerHandler.registerHandler)('bstApi', function () {
|
|
100
|
-
return _this.traceStorage.storeSTN(...arguments);
|
|
101
|
-
}, this.featureName, this.ee);
|
|
102
|
-
(0, _registerHandler.registerHandler)('trace-jserror', function () {
|
|
103
|
-
return _this.traceStorage.storeErrorAgg(...arguments);
|
|
104
|
-
}, this.featureName, this.ee);
|
|
105
|
-
(0, _registerHandler.registerHandler)('pvtAdded', function () {
|
|
106
|
-
return _this.traceStorage.processPVT(...arguments);
|
|
107
|
-
}, this.featureName, this.ee);
|
|
86
|
+
(0, _registerHandler.registerHandler)('bst', (...args) => this.traceStorage.storeEvent(...args), this.featureName, this.ee);
|
|
87
|
+
(0, _registerHandler.registerHandler)('bstResource', (...args) => this.traceStorage.storeResources(...args), this.featureName, this.ee);
|
|
88
|
+
(0, _registerHandler.registerHandler)('bstHist', (...args) => this.traceStorage.storeHist(...args), this.featureName, this.ee);
|
|
89
|
+
(0, _registerHandler.registerHandler)('bstXhrAgg', (...args) => this.traceStorage.storeXhrAgg(...args), this.featureName, this.ee);
|
|
90
|
+
(0, _registerHandler.registerHandler)('bstApi', (...args) => this.traceStorage.storeSTN(...args), this.featureName, this.ee);
|
|
91
|
+
(0, _registerHandler.registerHandler)('trace-jserror', (...args) => this.traceStorage.storeErrorAgg(...args), this.featureName, this.ee);
|
|
92
|
+
(0, _registerHandler.registerHandler)('pvtAdded', (...args) => this.traceStorage.processPVT(...args), this.featureName, this.ee);
|
|
108
93
|
if (typeof PerformanceNavigationTiming !== 'undefined') {
|
|
109
|
-
this.traceStorage.storeTiming(
|
|
94
|
+
this.traceStorage.storeTiming(_runtime2.globalScope.performance?.getEntriesByType?.('navigation')[0]);
|
|
110
95
|
} else {
|
|
111
|
-
this.traceStorage.storeTiming(
|
|
96
|
+
this.traceStorage.storeTiming(_runtime2.globalScope.performance?.timing, true);
|
|
112
97
|
}
|
|
113
98
|
|
|
114
99
|
/** Only start actually harvesting if running in full mode at init time */
|
|
@@ -132,8 +117,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
132
117
|
}
|
|
133
118
|
|
|
134
119
|
/** Called by the harvest scheduler at harvest time to retrieve the payload. This will only actually return a payload if running in full mode */
|
|
135
|
-
prepareHarvest() {
|
|
136
|
-
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
120
|
+
prepareHarvest(options = {}) {
|
|
137
121
|
this.traceStorage.prevStoredEvents.clear(); // release references to past events for GC
|
|
138
122
|
if (!this.timeKeeper?.ready) return; // this should likely never happen, but just to be safe, we should never harvest if we cant correct time
|
|
139
123
|
if (this.blocked || this.mode !== _constants2.MODE.FULL || this.traceStorage.nodeCount === 0) return;
|
|
@@ -172,7 +156,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
172
156
|
type: 'BrowserSessionChunk',
|
|
173
157
|
app_id: this.agentInfo.applicationID,
|
|
174
158
|
protocol_version: '0',
|
|
175
|
-
timestamp: this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp),
|
|
159
|
+
timestamp: Math.floor(this.timeKeeper.correctAbsoluteTimestamp(this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp))),
|
|
176
160
|
attributes: (0, _encode.obj)({
|
|
177
161
|
...(agentMetadata.entityGuid && {
|
|
178
162
|
entityGuid: agentMetadata.entityGuid
|
|
@@ -181,8 +165,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
181
165
|
// this section of attributes must be controllable and stay below the query param padding limit -- see QUERY_PARAM_PADDING
|
|
182
166
|
// if not, data could be lost to truncation at time of sending, potentially breaking parsing / API behavior in NR1
|
|
183
167
|
// trace payload metadata
|
|
184
|
-
'trace.firstTimestamp': this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp),
|
|
185
|
-
'trace.lastTimestamp': this.timeKeeper.convertRelativeTimestamp(latestTimeStamp),
|
|
168
|
+
'trace.firstTimestamp': Math.floor(this.timeKeeper.correctAbsoluteTimestamp(this.timeKeeper.convertRelativeTimestamp(earliestTimeStamp))),
|
|
169
|
+
'trace.lastTimestamp': Math.floor(this.timeKeeper.correctAbsoluteTimestamp(this.timeKeeper.convertRelativeTimestamp(latestTimeStamp))),
|
|
186
170
|
'trace.nodes': stns.length,
|
|
187
171
|
'trace.originTimestamp': this.timeKeeper.correctedOriginTime,
|
|
188
172
|
// other payload metadata
|
|
@@ -197,12 +181,12 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
197
181
|
session: "".concat(this.sessionId),
|
|
198
182
|
// customer-defined data should go last so that if it exceeds the query param padding limit it will be truncated instead of important attrs
|
|
199
183
|
...(endUserId && {
|
|
200
|
-
'enduser.id': endUserId
|
|
184
|
+
'enduser.id': this.obfuscator.obfuscateString(endUserId)
|
|
201
185
|
})
|
|
202
186
|
// The Query Param is being arbitrarily limited in length here. It is also applied when estimating the size of the payload in getPayloadSize()
|
|
203
187
|
}, QUERY_PARAM_PADDING).substring(1) // remove the leading '&'
|
|
204
188
|
},
|
|
205
|
-
body: stns
|
|
189
|
+
body: (0, _traverse.applyFnToProps)(stns, this.obfuscator.obfuscateString.bind(this.obfuscator), 'string')
|
|
206
190
|
};
|
|
207
191
|
}
|
|
208
192
|
|
|
@@ -212,8 +196,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
212
196
|
onHarvestFinished(result) {
|
|
213
197
|
if (result.sent && result.retry && this.sentTrace) {
|
|
214
198
|
// merge previous trace back into buffer to retry for next harvest
|
|
215
|
-
Object.entries(this.sentTrace).forEach(
|
|
216
|
-
let [name, listOfSTNodes] = _ref2;
|
|
199
|
+
Object.entries(this.sentTrace).forEach(([name, listOfSTNodes]) => {
|
|
217
200
|
this.traceStorage.restoreNode(name, listOfSTNodes);
|
|
218
201
|
});
|
|
219
202
|
this.sentTrace = null;
|
|
@@ -97,8 +97,7 @@ class TraceStorage {
|
|
|
97
97
|
// if PO isn't supported, this checks resourcetiming buffer every harvest.
|
|
98
98
|
this.storeResources(_runtime.globalScope.performance?.getEntriesByType?.('resource'));
|
|
99
99
|
}
|
|
100
|
-
const stns = Object.entries(this.trace).flatMap(
|
|
101
|
-
let [name, listOfSTNodes] = _ref;
|
|
100
|
+
const stns = Object.entries(this.trace).flatMap(([name, listOfSTNodes]) => {
|
|
102
101
|
// basically take the "this.trace" map-obj and concat all the list-type values
|
|
103
102
|
if (!(name in toAggregate)) return listOfSTNodes;
|
|
104
103
|
// Special processing for event nodes dealing with user inputs:
|
|
@@ -156,7 +155,7 @@ class TraceStorage {
|
|
|
156
155
|
return name === 'fi' && !!attrs && typeof attrs.fid === 'number';
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
|
-
storeTiming(timingEntry) {
|
|
158
|
+
storeTiming(timingEntry, isAbsoluteTimestamp = false) {
|
|
160
159
|
if (!timingEntry) return;
|
|
161
160
|
|
|
162
161
|
// loop iterates through prototype also (for FF)
|
|
@@ -171,6 +170,9 @@ class TraceStorage {
|
|
|
171
170
|
// that are in the future (Microsoft Edge seems to sometimes produce these)
|
|
172
171
|
if (!(typeof val === 'number' && val >= 0)) continue;
|
|
173
172
|
val = Math.round(val);
|
|
173
|
+
if (this.parent.timeKeeper && this.parent.timeKeeper.ready && isAbsoluteTimestamp) {
|
|
174
|
+
val = this.parent.timeKeeper.convertAbsoluteTimestamp(Math.floor(this.parent.timeKeeper.correctAbsoluteTimestamp(val)));
|
|
175
|
+
}
|
|
174
176
|
this.storeSTN(new _node.TraceNode(key, val, val, 'document', 'timing'));
|
|
175
177
|
}
|
|
176
178
|
}
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.Instrument = void 0;
|
|
6
|
+
exports.SessionTrace = exports.Instrument = void 0;
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var
|
|
8
|
+
var _wrapHistory = require("../../../common/wrap/wrap-history");
|
|
9
|
+
var _wrapEvents = require("../../../common/wrap/wrap-events");
|
|
9
10
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
10
11
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
11
12
|
var _features = require("../../../loaders/features/features");
|
|
@@ -31,8 +32,7 @@ const {
|
|
|
31
32
|
} = CONSTANTS;
|
|
32
33
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
33
34
|
static featureName = FEATURE_NAME;
|
|
34
|
-
constructor(agentIdentifier, aggregator) {
|
|
35
|
-
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
35
|
+
constructor(agentIdentifier, aggregator, auto = true) {
|
|
36
36
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
37
37
|
const canTrackSession = (0, _featureGates.canEnableSessionTracking)(this.agentIdentifier);
|
|
38
38
|
if (!canTrackSession) {
|
|
@@ -40,8 +40,8 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
const thisInstrumentEE = this.ee;
|
|
43
|
-
(0,
|
|
44
|
-
this.eventsEE = (0,
|
|
43
|
+
(0, _wrapHistory.wrapHistory)(thisInstrumentEE);
|
|
44
|
+
this.eventsEE = (0, _wrapEvents.wrapEvents)(thisInstrumentEE);
|
|
45
45
|
this.eventsEE.on(FN_START, function (args, target) {
|
|
46
46
|
this.bstStart = (0, _now.now)();
|
|
47
47
|
});
|
|
@@ -77,4 +77,5 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
exports.Instrument = Instrument;
|
|
80
|
+
exports.Instrument = Instrument;
|
|
81
|
+
const SessionTrace = exports.SessionTrace = Instrument;
|
|
@@ -22,7 +22,7 @@ class AjaxNode extends _belNode.BelNode {
|
|
|
22
22
|
this.traceId = ajaxEvent.traceId;
|
|
23
23
|
this.spanTimestamp = ajaxEvent.spanTimestamp;
|
|
24
24
|
this.gql = ajaxEvent.gql;
|
|
25
|
-
this.start = ajaxEvent.startTime;
|
|
25
|
+
this.start = ajaxEvent.startTime; // 5000 --- 5500 --> 10500
|
|
26
26
|
this.end = ajaxEvent.endTime;
|
|
27
27
|
}
|
|
28
28
|
serialize(parentStartTimestamp) {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Aggregate = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _init = require("../../../common/config/init");
|
|
8
8
|
var _drain = require("../../../common/drain/drain");
|
|
9
9
|
var _handle = require("../../../common/event-emitter/handle");
|
|
10
10
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
@@ -14,30 +14,28 @@ var _timeToFirstByte = require("../../../common/vitals/time-to-first-byte");
|
|
|
14
14
|
var _features = require("../../../loaders/features/features");
|
|
15
15
|
var _constants = require("../../metrics/constants");
|
|
16
16
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
17
|
+
var _eventBuffer = require("../../utils/event-buffer");
|
|
17
18
|
var _constants2 = require("../constants");
|
|
18
19
|
var _ajaxNode = require("./ajax-node");
|
|
19
20
|
var _initialPageLoadInteraction = require("./initial-page-load-interaction");
|
|
20
21
|
var _interaction = require("./interaction");
|
|
21
22
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
22
23
|
static featureName = _constants2.FEATURE_NAME;
|
|
23
|
-
constructor(agentIdentifier, aggregator,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
} = _ref;
|
|
24
|
+
constructor(agentIdentifier, aggregator, {
|
|
25
|
+
domObserver
|
|
26
|
+
}) {
|
|
27
27
|
super(agentIdentifier, aggregator, _constants2.FEATURE_NAME);
|
|
28
|
-
const harvestTimeSeconds = (0,
|
|
29
|
-
this.interactionsToHarvest =
|
|
30
|
-
this.interactionsAwaitingRetry = [];
|
|
28
|
+
const harvestTimeSeconds = (0, _init.getConfigurationValue)(agentIdentifier, 'soft_navigations.harvestTimeSeconds') || 10;
|
|
29
|
+
this.interactionsToHarvest = new _eventBuffer.EventBuffer();
|
|
31
30
|
this.domObserver = domObserver;
|
|
32
31
|
this.initialPageLoadInteraction = new _initialPageLoadInteraction.InitialPageLoadInteraction(agentIdentifier);
|
|
33
|
-
_timeToFirstByte.timeToFirstByte.subscribe(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
} = _ref2;
|
|
32
|
+
_timeToFirstByte.timeToFirstByte.subscribe(({
|
|
33
|
+
attrs
|
|
34
|
+
}) => {
|
|
37
35
|
const loadEventTime = attrs.navigationEntry.loadEventEnd;
|
|
38
36
|
this.initialPageLoadInteraction.forceSave = true;
|
|
39
37
|
this.initialPageLoadInteraction.done(loadEventTime);
|
|
40
|
-
this.interactionsToHarvest.
|
|
38
|
+
this.interactionsToHarvest.add(this.initialPageLoadInteraction);
|
|
41
39
|
this.initialPageLoadInteraction = null;
|
|
42
40
|
// Report metric on the initial page load time
|
|
43
41
|
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['SoftNav/Interaction/InitialPageLoad/Duration/Ms', Math.round(loadEventTime)], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
@@ -46,8 +44,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
46
44
|
this.interactionInProgress = null; // aside from the "page load" interaction, there can only ever be 1 ongoing at a time
|
|
47
45
|
|
|
48
46
|
this.blocked = false;
|
|
49
|
-
this.waitForFlags(['spa']).then(
|
|
50
|
-
let [spaOn] = _ref3;
|
|
47
|
+
this.waitForFlags(['spa']).then(([spaOn]) => {
|
|
51
48
|
if (spaOn) {
|
|
52
49
|
this.drain();
|
|
53
50
|
const scheduler = new _harvestScheduler.HarvestScheduler('events', {
|
|
@@ -78,18 +75,17 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
78
75
|
(0, _registerHandler.registerHandler)('jserror', this.#handleJserror.bind(this), this.featureName, this.ee);
|
|
79
76
|
}
|
|
80
77
|
onHarvestStarted(options) {
|
|
81
|
-
if (this.interactionsToHarvest.
|
|
78
|
+
if (!this.interactionsToHarvest.hasData || this.blocked) return;
|
|
82
79
|
// 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.
|
|
83
80
|
// 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.
|
|
84
81
|
let firstIxnStartTime = 0; // the very 1st ixn does not require any offsetting
|
|
85
82
|
const serializedIxnList = [];
|
|
86
|
-
for (const interaction of this.interactionsToHarvest) {
|
|
83
|
+
for (const interaction of this.interactionsToHarvest.buffer) {
|
|
87
84
|
serializedIxnList.push(interaction.serialize(firstIxnStartTime));
|
|
88
85
|
if (!firstIxnStartTime) firstIxnStartTime = Math.floor(interaction.start);
|
|
89
86
|
}
|
|
90
87
|
const payload = "bel.7;".concat(serializedIxnList.join(';'));
|
|
91
|
-
if (options.retry) this.
|
|
92
|
-
this.interactionsToHarvest = [];
|
|
88
|
+
if (options.retry) this.interactionsToHarvest.hold();else this.interactionsToHarvest.clear();
|
|
93
89
|
return {
|
|
94
90
|
body: {
|
|
95
91
|
e: payload
|
|
@@ -97,10 +93,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
97
93
|
};
|
|
98
94
|
}
|
|
99
95
|
onHarvestFinished(result) {
|
|
100
|
-
if (result.sent && result.retry && this.
|
|
101
|
-
this.interactionsToHarvest = [...this.interactionsAwaitingRetry, ...this.interactionsToHarvest];
|
|
102
|
-
}
|
|
103
|
-
this.interactionsAwaitingRetry = [];
|
|
96
|
+
if (result.sent && result.retry && this.interactionsToHarvest.held.hasData) this.interactionsToHarvest.unhold();else this.interactionsToHarvest.held.clear();
|
|
104
97
|
}
|
|
105
98
|
startUIInteraction(eventName, startedAt, sourceElem) {
|
|
106
99
|
// this is throttled by instrumentation so that it isn't excessively called
|
|
@@ -121,7 +114,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
121
114
|
setClosureHandlers() {
|
|
122
115
|
this.interactionInProgress.on('finished', () => {
|
|
123
116
|
const ref = this.interactionInProgress;
|
|
124
|
-
this.interactionsToHarvest.
|
|
117
|
+
this.interactionsToHarvest.add(this.interactionInProgress);
|
|
125
118
|
this.interactionInProgress = null;
|
|
126
119
|
this.domObserver.disconnect(); // can stop observing whenever our interaction logic completes a cycle
|
|
127
120
|
|
|
@@ -148,9 +141,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
148
141
|
*/
|
|
149
142
|
if (this.interactionInProgress?.isActiveDuring(timestamp)) return this.interactionInProgress;
|
|
150
143
|
let saveIxn;
|
|
151
|
-
for (let idx = this.interactionsToHarvest.length - 1; idx >= 0; idx--) {
|
|
144
|
+
for (let idx = this.interactionsToHarvest.buffer.length - 1; idx >= 0; idx--) {
|
|
152
145
|
// reverse search for the latest completed interaction for efficiency
|
|
153
|
-
const finishedInteraction = this.interactionsToHarvest[idx];
|
|
146
|
+
const finishedInteraction = this.interactionsToHarvest.buffer[idx];
|
|
154
147
|
if (finishedInteraction.isActiveDuring(timestamp)) {
|
|
155
148
|
if (finishedInteraction.trigger !== 'initialPageLoad') return finishedInteraction;
|
|
156
149
|
// 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
|
|
@@ -210,10 +203,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
210
203
|
#registerApiHandlers() {
|
|
211
204
|
const INTERACTION_API = 'api-ixn-';
|
|
212
205
|
const thisClass = this;
|
|
213
|
-
(0, _registerHandler.registerHandler)(INTERACTION_API + 'get', function (time
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
206
|
+
(0, _registerHandler.registerHandler)(INTERACTION_API + 'get', function (time, {
|
|
207
|
+
waitForEnd
|
|
208
|
+
} = {}) {
|
|
217
209
|
// In here, 'this' refers to the EventContext specific to per InteractionHandle instance spawned by each .interaction() api call.
|
|
218
210
|
// Each api call aka IH instance would therefore retain a reference to either the in-progress interaction *at the time of the call* OR a new api-started interaction.
|
|
219
211
|
this.associatedInteraction = thisClass.getInteractionFor(time);
|
|
@@ -9,11 +9,11 @@ var _interaction = require("./interaction");
|
|
|
9
9
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
10
10
|
var _firstPaint = require("../../../common/vitals/first-paint");
|
|
11
11
|
var _firstContentfulPaint = require("../../../common/vitals/first-contentful-paint");
|
|
12
|
-
var
|
|
12
|
+
var _info = require("../../../common/config/info");
|
|
13
13
|
class InitialPageLoadInteraction extends _interaction.Interaction {
|
|
14
14
|
constructor(agentIdentifier) {
|
|
15
15
|
super(agentIdentifier, 'initialPageLoad', 0, null);
|
|
16
|
-
const agentInfo = (0,
|
|
16
|
+
const agentInfo = (0, _info.getInfo)(agentIdentifier);
|
|
17
17
|
this.queueTime = agentInfo.queueTime;
|
|
18
18
|
this.appTime = agentInfo.applicationTime;
|
|
19
19
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Interaction = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _info = require("../../../common/config/info");
|
|
8
8
|
var _runtime = require("../../../common/constants/runtime");
|
|
9
9
|
var _uniqueId = require("../../../common/ids/unique-id");
|
|
10
10
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
@@ -70,13 +70,12 @@ class Interaction extends _belNode.BelNode {
|
|
|
70
70
|
else this.#cancel();
|
|
71
71
|
return true;
|
|
72
72
|
}
|
|
73
|
-
#finish() {
|
|
74
|
-
let customEndTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
73
|
+
#finish(customEndTime = 0) {
|
|
75
74
|
if (this.status !== _constants.INTERACTION_STATUS.IP) return; // disallow this call if the ixn is already done aka not in-progress
|
|
76
75
|
clearTimeout(this.cancellationTimer);
|
|
77
76
|
this.end = Math.max(this.domTimestamp, this.historyTimestamp, customEndTime);
|
|
78
77
|
this.customAttributes = {
|
|
79
|
-
...(0,
|
|
78
|
+
...(0, _info.getInfo)(this.agentIdentifier).jsAttributes,
|
|
80
79
|
...this.customAttributes
|
|
81
80
|
}; // attrs specific to this interaction should have precedence over the general custom attrs
|
|
82
81
|
this.status = _constants.INTERACTION_STATUS.FIN;
|
|
@@ -129,7 +128,7 @@ class Interaction extends _belNode.BelNode {
|
|
|
129
128
|
// not relative
|
|
130
129
|
addString(this.trigger), addString((0, _cleanUrl.cleanURL)(this.initialPageURL, true)), addString((0, _cleanUrl.cleanURL)(this.oldURL, true)), addString((0, _cleanUrl.cleanURL)(this.newURL, true)), addString(this.customName), ixnType, (0, _belSerializer.nullable)(this.queueTime, _belSerializer.numeric, true) + (0, _belSerializer.nullable)(this.appTime, _belSerializer.numeric, true) + (0, _belSerializer.nullable)(this.oldRoute, addString, true) + (0, _belSerializer.nullable)(this.newRoute, addString, true) + addString(this.id), addString(this.nodeId), (0, _belSerializer.nullable)(this.firstPaint, _belSerializer.numeric, true) + (0, _belSerializer.nullable)(this.firstContentfulPaint, _belSerializer.numeric)];
|
|
131
130
|
const allAttachedNodes = (0, _belSerializer.addCustomAttributes)(this.customAttributes || {}, addString); // start with all custom attributes
|
|
132
|
-
if ((0,
|
|
131
|
+
if ((0, _info.getInfo)(this.agentIdentifier).atts) allAttachedNodes.push('a,' + addString((0, _info.getInfo)(this.agentIdentifier).atts)); // add apm provided attributes
|
|
133
132
|
/* Querypack encoder+decoder quirkiness:
|
|
134
133
|
- If first ixn node of payload is being processed, we use this node's start to offset. (firstStartTime should be 0--or undefined.)
|
|
135
134
|
- Else for subsequent ixn nodes, we use the first ixn node's start to offset. */
|