@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,14 +1,17 @@
|
|
|
1
1
|
import { FeatureBase } from './feature-base'
|
|
2
|
-
import { getInfo,
|
|
2
|
+
import { getInfo, isValid } from '../../common/config/info'
|
|
3
|
+
import { getRuntime } from '../../common/config/runtime'
|
|
3
4
|
import { configure } from '../../loaders/configure/configure'
|
|
4
5
|
import { gosCDN } from '../../common/window/nreum'
|
|
5
|
-
import { drain } from '../../common/drain/drain'
|
|
6
|
+
import { deregisterDrain, drain } from '../../common/drain/drain'
|
|
6
7
|
import { activatedFeatures } from '../../common/util/feature-flags'
|
|
8
|
+
import { Obfuscator } from '../../common/util/obfuscate'
|
|
7
9
|
|
|
8
10
|
export class AggregateBase extends FeatureBase {
|
|
9
11
|
constructor (...args) {
|
|
10
12
|
super(...args)
|
|
11
13
|
this.checkConfiguration()
|
|
14
|
+
this.obfuscator = getRuntime(this.agentIdentifier).obfuscator
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
/**
|
|
@@ -34,6 +37,8 @@ export class AggregateBase extends FeatureBase {
|
|
|
34
37
|
})
|
|
35
38
|
return flagsPromise.catch(err => {
|
|
36
39
|
this.ee.emit('internal-error', [err])
|
|
40
|
+
this.blocked = true
|
|
41
|
+
deregisterDrain(this.agentIdentifier, this.featureName)
|
|
37
42
|
})
|
|
38
43
|
}
|
|
39
44
|
|
|
@@ -48,7 +53,7 @@ export class AggregateBase extends FeatureBase {
|
|
|
48
53
|
*/
|
|
49
54
|
checkConfiguration () {
|
|
50
55
|
// NOTE: This check has to happen at aggregator load time
|
|
51
|
-
if (!
|
|
56
|
+
if (!isValid(this.agentIdentifier)) {
|
|
52
57
|
const cdn = gosCDN()
|
|
53
58
|
let jsAttributes = { ...cdn.info?.jsAttributes }
|
|
54
59
|
try {
|
|
@@ -68,5 +73,10 @@ export class AggregateBase extends FeatureBase {
|
|
|
68
73
|
runtime: getRuntime(this.agentIdentifier)
|
|
69
74
|
})
|
|
70
75
|
}
|
|
76
|
+
|
|
77
|
+
const runtime = getRuntime(this.agentIdentifier)
|
|
78
|
+
if (!runtime.obfuscator) {
|
|
79
|
+
runtime.obfuscator = new Obfuscator(this.agentIdentifier)
|
|
80
|
+
}
|
|
71
81
|
}
|
|
72
82
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { stringify } from '../../common/util/stringify'
|
|
2
|
+
import { MAX_PAYLOAD_SIZE } from '../../common/constants/agent-constants'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A container that keeps an event buffer and size with helper methods
|
|
6
|
+
* @typedef {Object} EventBuffer
|
|
7
|
+
* @property {number} size
|
|
8
|
+
* @property {*[]} buffer
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A container that holds, evaluates, and merges event objects for harvesting
|
|
13
|
+
*/
|
|
14
|
+
export class EventBuffer {
|
|
15
|
+
/** @type {Object[]} */
|
|
16
|
+
#buffer = []
|
|
17
|
+
/** @type {number} */
|
|
18
|
+
#bytes = 0
|
|
19
|
+
/** @type {EventBuffer} */
|
|
20
|
+
#held
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {number=} maxPayloadSize
|
|
25
|
+
*/
|
|
26
|
+
constructor (maxPayloadSize = MAX_PAYLOAD_SIZE) {
|
|
27
|
+
this.maxPayloadSize = maxPayloadSize
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* buffer is read only, use the helper methods to add or clear buffer data
|
|
32
|
+
*/
|
|
33
|
+
get buffer () {
|
|
34
|
+
return this.#buffer
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* bytes is read only, use the helper methods to add or clear buffer data
|
|
39
|
+
*/
|
|
40
|
+
get bytes () {
|
|
41
|
+
return this.#bytes
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* held is another event buffer
|
|
46
|
+
*/
|
|
47
|
+
get held () {
|
|
48
|
+
this.#held ??= new EventBuffer(this.maxPayloadSize)
|
|
49
|
+
return this.#held
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Returns a boolean indicating whether the current size and buffer contain valid data
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
get hasData () {
|
|
57
|
+
return this.buffer.length > 0 && this.bytes > 0
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Adds an event object to the buffer while tallying size
|
|
62
|
+
* @param {Object} event the event object to add to the buffer
|
|
63
|
+
* @returns {EventBuffer} returns the event buffer for chaining
|
|
64
|
+
*/
|
|
65
|
+
add (event) {
|
|
66
|
+
const size = stringify(event).length
|
|
67
|
+
if (!this.canMerge(size)) return this
|
|
68
|
+
this.#buffer.push(event)
|
|
69
|
+
this.#bytes += size
|
|
70
|
+
return this
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* clear the buffer data
|
|
75
|
+
* @returns {EventBuffer}
|
|
76
|
+
*/
|
|
77
|
+
clear () {
|
|
78
|
+
this.#bytes = 0
|
|
79
|
+
this.#buffer = []
|
|
80
|
+
return this
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Hold the buffer data in a new (child) EventBuffer (.held) to unblock the main buffer.
|
|
85
|
+
* This action clears the main buffer
|
|
86
|
+
* @returns {EventBuffer}
|
|
87
|
+
*/
|
|
88
|
+
hold () {
|
|
89
|
+
this.held.merge(this)
|
|
90
|
+
this.clear()
|
|
91
|
+
return this
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Prepend the held EventBuffer (.held) back into the main buffer
|
|
96
|
+
* This action clears the held buffer
|
|
97
|
+
* @returns {EventBuffer}
|
|
98
|
+
*/
|
|
99
|
+
unhold () {
|
|
100
|
+
this.merge(this.held, true)
|
|
101
|
+
this.held.clear()
|
|
102
|
+
return this
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Merges an EventBuffer into this EventBuffer
|
|
107
|
+
* @param {EventBuffer} events an EventBuffer intended to merge with this EventBuffer
|
|
108
|
+
* @param {boolean} prepend if true, the supplied events will be prepended before the events of this class
|
|
109
|
+
* @returns {EventBuffer} returns the event buffer for chaining
|
|
110
|
+
*/
|
|
111
|
+
merge (eventBuffer, prepend = false) {
|
|
112
|
+
if (!this.canMerge(eventBuffer.bytes)) return this
|
|
113
|
+
this.#buffer = prepend ? [...eventBuffer.buffer, ...this.#buffer] : [...this.#buffer, ...eventBuffer.buffer]
|
|
114
|
+
this.#bytes += eventBuffer.#bytes
|
|
115
|
+
return this
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Returns a boolean indicating the resulting size of a merge would be valid. Compares against the maxPayloadSize provided at initialization time.
|
|
120
|
+
* @param {number} size
|
|
121
|
+
* @returns {boolean}
|
|
122
|
+
*/
|
|
123
|
+
canMerge (size) {
|
|
124
|
+
return this.bytes + (size || Infinity) < this.maxPayloadSize
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -10,7 +10,7 @@ import { onWindowLoad } from '../../common/window/load'
|
|
|
10
10
|
import { isBrowserScope } from '../../common/constants/runtime'
|
|
11
11
|
import { warn } from '../../common/util/console'
|
|
12
12
|
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
13
|
-
import { getConfigurationValue } from '../../common/config/
|
|
13
|
+
import { getConfigurationValue } from '../../common/config/init'
|
|
14
14
|
import { hasReplayPrerequisite } from '../session_replay/shared/utils'
|
|
15
15
|
import { canEnableSessionTracking } from './feature-gates'
|
|
16
16
|
import { single } from '../../common/util/invoke'
|
|
@@ -45,6 +45,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
45
45
|
/**
|
|
46
46
|
* @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
|
|
47
47
|
* one another if there are inter-features dependencies.
|
|
48
|
+
* TODO: This is only used for the SPA feature component tests and should be refactored out.
|
|
48
49
|
*/
|
|
49
50
|
this.onAggregateImported = undefined
|
|
50
51
|
|
|
@@ -18,12 +18,12 @@ export function lazyFeatureLoader (featureName, featurePart) {
|
|
|
18
18
|
return import(/* webpackChunkName: "ajax-aggregate" */ '../ajax/aggregate')
|
|
19
19
|
case FEATURE_NAMES.jserrors:
|
|
20
20
|
return import(/* webpackChunkName: "jserrors-aggregate" */ '../jserrors/aggregate')
|
|
21
|
+
case FEATURE_NAMES.genericEvents:
|
|
22
|
+
return import(/* webpackChunkName: "generic_events-aggregate" */ '../generic_events/aggregate')
|
|
21
23
|
case FEATURE_NAMES.logging:
|
|
22
24
|
return import(/* webpackChunkName: "logging-aggregate" */ '../logging/aggregate')
|
|
23
25
|
case FEATURE_NAMES.metrics:
|
|
24
26
|
return import(/* webpackChunkName: "metrics-aggregate" */ '../metrics/aggregate')
|
|
25
|
-
case FEATURE_NAMES.pageAction:
|
|
26
|
-
return import(/* webpackChunkName: "page_action-aggregate" */ '../page_action/aggregate')
|
|
27
27
|
case FEATURE_NAMES.pageViewEvent:
|
|
28
28
|
return import(/* webpackChunkName: "page_view_event-aggregate" */ '../page_view_event/aggregate')
|
|
29
29
|
case FEATURE_NAMES.pageViewTiming:
|
package/src/index.js
CHANGED
|
@@ -4,9 +4,12 @@ export { MicroAgent } from './loaders/micro-agent'
|
|
|
4
4
|
|
|
5
5
|
export { Ajax } from './features/ajax'
|
|
6
6
|
export { JSErrors } from './features/jserrors'
|
|
7
|
+
export { GenericEvents } from './features/generic_events'
|
|
8
|
+
export { Logging } from './features/logging'
|
|
7
9
|
export { Metrics } from './features/metrics'
|
|
8
10
|
export { PageAction } from './features/page_action'
|
|
9
11
|
export { PageViewEvent } from './features/page_view_event'
|
|
10
12
|
export { PageViewTiming } from './features/page_view_timing'
|
|
11
13
|
export { SessionTrace } from './features/session_trace'
|
|
14
|
+
export { SessionReplay } from './features/session_replay'
|
|
12
15
|
export { Spa } from './features/spa'
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { warn } from '../common/util/console'
|
|
4
4
|
import { SR_EVENT_EMITTER_TYPES } from '../features/session_replay/constants'
|
|
5
5
|
import { generateRandomHexString } from '../common/ids/unique-id'
|
|
6
|
-
import { ee } from '../common/event-emitter/contextual-ee'
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @typedef {import('./api/interaction-types').InteractionInstance} InteractionInstance
|
|
@@ -14,9 +13,6 @@ export class AgentBase {
|
|
|
14
13
|
|
|
15
14
|
constructor (agentIdentifier = generateRandomHexString(16)) {
|
|
16
15
|
this.agentIdentifier = agentIdentifier
|
|
17
|
-
|
|
18
|
-
// Assign the observation context to the event emitter, so it knows how to create observation contexts
|
|
19
|
-
this.ee = ee.get(agentIdentifier)
|
|
20
16
|
}
|
|
21
17
|
|
|
22
18
|
/**
|
|
@@ -184,12 +180,12 @@ export class AgentBase {
|
|
|
184
180
|
|
|
185
181
|
/**
|
|
186
182
|
* Capture a single log.
|
|
187
|
-
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/
|
|
183
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/log/}
|
|
188
184
|
* @param {string} message String to be captured as log message
|
|
189
185
|
* @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
|
|
190
186
|
*/
|
|
191
187
|
log (message, options) {
|
|
192
|
-
return this.#callMethod('
|
|
188
|
+
return this.#callMethod('log', message, options)
|
|
193
189
|
}
|
|
194
190
|
|
|
195
191
|
/**
|
package/src/loaders/agent.js
CHANGED
|
@@ -72,8 +72,13 @@ export class Agent extends AgentBase {
|
|
|
72
72
|
if (!this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.softNav) return
|
|
73
73
|
|
|
74
74
|
const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName)
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
75
|
+
const missingDependencies = dependencies.filter(featName => !(featName in this.features)) // any other feature(s) this depends on should've been initialized on prior iterations by priority order
|
|
76
|
+
if (missingDependencies.length > 0) {
|
|
77
|
+
warn(36, {
|
|
78
|
+
targetFeature: InstrumentCtor.featureName,
|
|
79
|
+
missingDependencies
|
|
80
|
+
})
|
|
81
|
+
}
|
|
77
82
|
|
|
78
83
|
this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator)
|
|
79
84
|
})
|
package/src/loaders/api/api.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { FEATURE_NAMES } from '../features/features'
|
|
6
|
-
import {
|
|
6
|
+
import { getInfo, setInfo } from '../../common/config/info'
|
|
7
|
+
import { getRuntime } from '../../common/config/runtime'
|
|
7
8
|
import { handle } from '../../common/event-emitter/handle'
|
|
8
9
|
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
9
10
|
import { drain, registerDrain } from '../../common/drain/drain'
|
|
@@ -69,7 +70,7 @@ export function setAPI (agentIdentifier, forceDrain, runSoftNavOverSpa = false)
|
|
|
69
70
|
// Setup stub functions that queue calls for later processing.
|
|
70
71
|
asyncApiMethods.forEach(fnName => { apiInterface[fnName] = apiCall(prefix, fnName, true, 'api') })
|
|
71
72
|
|
|
72
|
-
apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.
|
|
73
|
+
apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.genericEvents)
|
|
73
74
|
|
|
74
75
|
apiInterface.setPageViewName = function (name, host) {
|
|
75
76
|
if (typeof name !== 'string') return
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FEATURE_NAMES } from '../features/features'
|
|
2
|
-
import { getRuntime } from '../../common/config/
|
|
2
|
+
import { getRuntime } from '../../common/config/runtime'
|
|
3
3
|
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
4
4
|
import { handle } from '../../common/event-emitter/handle'
|
|
5
5
|
import { registerHandler } from '../../common/event-emitter/register-handler'
|
|
@@ -27,7 +27,7 @@ export function setAPI (agentIdentifier) {
|
|
|
27
27
|
var time = providedTime ? providedTime - originTime : t
|
|
28
28
|
handle(CUSTOM_METRIC_CHANNEL, ['finished', { time }], undefined, FEATURE_NAMES.metrics, instanceEE)
|
|
29
29
|
addToTrace(t, { name: 'finished', start: time + originTime, origin: 'nr' })
|
|
30
|
-
handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.
|
|
30
|
+
handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.genericEvents, instanceEE)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function addToTrace (t, evt) {
|
|
@@ -7,8 +7,9 @@ import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
|
|
|
7
7
|
import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
|
|
8
8
|
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
|
|
9
9
|
import { Instrument as InstrumentSpa } from '../features/spa/instrument'
|
|
10
|
-
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
|
|
11
10
|
import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument'
|
|
11
|
+
import { Instrument as InstrumentGenericEvents } from '../features/generic_events/instrument'
|
|
12
|
+
import { Instrument as InstrumentLogs } from '../features/logging/instrument'
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* An agent class with all feature modules available. Features may be disabled and enabled via runtime configuration.
|
|
@@ -24,10 +25,11 @@ export class BrowserAgent extends Agent {
|
|
|
24
25
|
InstrumentPageViewTiming,
|
|
25
26
|
InstrumentSessionTrace,
|
|
26
27
|
InstrumentMetrics,
|
|
27
|
-
InstrumentPageAction,
|
|
28
28
|
InstrumentErrors,
|
|
29
29
|
InstrumentSpa,
|
|
30
|
-
InstrumentSessionReplay
|
|
30
|
+
InstrumentSessionReplay,
|
|
31
|
+
InstrumentGenericEvents,
|
|
32
|
+
InstrumentLogs
|
|
31
33
|
],
|
|
32
34
|
loaderType: 'browser-agent'
|
|
33
35
|
})
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { setAPI, setTopLevelCallers } from '../api/api'
|
|
2
2
|
import { addToNREUM, gosCDN } from '../../common/window/nreum'
|
|
3
|
-
import {
|
|
3
|
+
import { setInfo } from '../../common/config/info'
|
|
4
|
+
import { getConfiguration, setConfiguration } from '../../common/config/init'
|
|
5
|
+
import { setLoaderConfig } from '../../common/config/loader-config'
|
|
6
|
+
import { setRuntime } from '../../common/config/runtime'
|
|
4
7
|
import { activatedFeatures } from '../../common/util/feature-flags'
|
|
5
8
|
import { isWorkerScope } from '../../common/constants/runtime'
|
|
6
9
|
import { redefinePublicPath } from './public-path'
|
|
10
|
+
import { ee } from '../../common/event-emitter/contextual-ee'
|
|
7
11
|
|
|
8
12
|
let alreadySetOnce = false // the configure() function can run multiple times in agent lifecycle
|
|
9
13
|
|
|
@@ -12,7 +16,8 @@ let alreadySetOnce = false // the configure() function can run multiple times in
|
|
|
12
16
|
*/
|
|
13
17
|
export function configure (agent, opts = {}, loaderType, forceDrain) {
|
|
14
18
|
// eslint-disable-next-line camelcase
|
|
15
|
-
let { init, info, loader_config, runtime = {
|
|
19
|
+
let { init, info, loader_config, runtime = {}, exposed = true } = opts
|
|
20
|
+
runtime.loaderType = loaderType
|
|
16
21
|
const nr = gosCDN()
|
|
17
22
|
if (!info) {
|
|
18
23
|
init = nr.init
|
|
@@ -55,6 +60,8 @@ export function configure (agent, opts = {}, loaderType, forceDrain) {
|
|
|
55
60
|
runtime.ptid = agent.agentIdentifier
|
|
56
61
|
setRuntime(agent.agentIdentifier, runtime)
|
|
57
62
|
|
|
63
|
+
agent.ee = ee.get(agent.agentIdentifier)
|
|
64
|
+
|
|
58
65
|
if (agent.api === undefined) agent.api = setAPI(agent.agentIdentifier, forceDrain, agent.runSoftNavOverSpa)
|
|
59
66
|
if (agent.exposed === undefined) agent.exposed = exposed
|
|
60
67
|
alreadySetOnce = true
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
export const FEATURE_NAMES = {
|
|
2
2
|
ajax: 'ajax',
|
|
3
|
+
genericEvents: 'generic_events',
|
|
3
4
|
jserrors: 'jserrors',
|
|
4
5
|
logging: 'logging',
|
|
5
6
|
metrics: 'metrics',
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release
|
|
9
|
+
*/
|
|
6
10
|
pageAction: 'page_action',
|
|
7
11
|
pageViewEvent: 'page_view_event',
|
|
8
12
|
pageViewTiming: 'page_view_timing',
|
|
@@ -24,8 +28,8 @@ export const featurePriority = {
|
|
|
24
28
|
[FEATURE_NAMES.spa]: 5,
|
|
25
29
|
[FEATURE_NAMES.ajax]: 6,
|
|
26
30
|
[FEATURE_NAMES.sessionTrace]: 7,
|
|
27
|
-
[FEATURE_NAMES.
|
|
28
|
-
[FEATURE_NAMES.
|
|
29
|
-
[FEATURE_NAMES.
|
|
30
|
-
[FEATURE_NAMES.
|
|
31
|
+
[FEATURE_NAMES.softNav]: 8,
|
|
32
|
+
[FEATURE_NAMES.sessionReplay]: 9,
|
|
33
|
+
[FEATURE_NAMES.logging]: 10,
|
|
34
|
+
[FEATURE_NAMES.genericEvents]: 11
|
|
31
35
|
}
|
|
@@ -5,7 +5,10 @@ import { configure } from './configure/configure'
|
|
|
5
5
|
// core files
|
|
6
6
|
import { Aggregator } from '../common/aggregate/aggregator'
|
|
7
7
|
import { setNREUMInitializedAgent } from '../common/window/nreum'
|
|
8
|
-
import {
|
|
8
|
+
import { getInfo } from '../common/config/info'
|
|
9
|
+
import { getConfiguration, getConfigurationValue } from '../common/config/init'
|
|
10
|
+
import { getLoaderConfig } from '../common/config/loader-config'
|
|
11
|
+
import { getRuntime } from '../common/config/runtime'
|
|
9
12
|
import { FEATURE_NAMES } from './features/features'
|
|
10
13
|
import { warn } from '../common/util/console'
|
|
11
14
|
import { onWindowLoad } from '../common/window/load'
|
|
@@ -13,7 +16,7 @@ import { AgentBase } from './agent-base'
|
|
|
13
16
|
|
|
14
17
|
const nonAutoFeatures = [
|
|
15
18
|
FEATURE_NAMES.jserrors,
|
|
16
|
-
FEATURE_NAMES.
|
|
19
|
+
FEATURE_NAMES.genericEvents,
|
|
17
20
|
FEATURE_NAMES.metrics
|
|
18
21
|
]
|
|
19
22
|
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("../polyfills.js");
|
|
4
|
-
var _agent = require("../../loaders/agent");
|
|
5
|
-
var _instrument = require("../../features/page_view_event/instrument");
|
|
6
|
-
var _instrument2 = require("../../features/page_view_timing/instrument");
|
|
7
|
-
var _instrument3 = require("../../features/metrics/instrument");
|
|
8
|
-
/**
|
|
9
|
-
* @file Creates a version of the "Lite" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
|
|
10
|
-
* polyfills for pre-ES6 browsers and IE 11.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
new _agent.Agent({
|
|
14
|
-
features: [_instrument.Instrument, _instrument2.Instrument, _instrument3.Instrument],
|
|
15
|
-
loaderType: 'lite-polyfills'
|
|
16
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("../polyfills.js");
|
|
4
|
-
var _agent = require("../../loaders/agent");
|
|
5
|
-
var _instrument = require("../../features/page_view_event/instrument");
|
|
6
|
-
var _instrument2 = require("../../features/page_view_timing/instrument");
|
|
7
|
-
var _instrument3 = require("../../features/metrics/instrument");
|
|
8
|
-
var _instrument4 = require("../../features/jserrors/instrument");
|
|
9
|
-
var _instrument5 = require("../../features/ajax/instrument");
|
|
10
|
-
var _instrument6 = require("../../features/session_trace/instrument");
|
|
11
|
-
var _instrument7 = require("../../features/page_action/instrument");
|
|
12
|
-
var _instrument8 = require("../../features/logging/instrument");
|
|
13
|
-
/**
|
|
14
|
-
* @file Creates a version of the "PRO" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
|
|
15
|
-
* polyfills for pre-ES6 browsers and IE 11.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
new _agent.Agent({
|
|
19
|
-
features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument7.Instrument, _instrument4.Instrument, _instrument8.Instrument],
|
|
20
|
-
loaderType: 'pro-polyfills'
|
|
21
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("../polyfills.js");
|
|
4
|
-
var _agent = require("../../loaders/agent");
|
|
5
|
-
var _instrument = require("../../features/page_view_event/instrument");
|
|
6
|
-
var _instrument2 = require("../../features/page_view_timing/instrument");
|
|
7
|
-
var _instrument3 = require("../../features/metrics/instrument");
|
|
8
|
-
var _instrument4 = require("../../features/jserrors/instrument");
|
|
9
|
-
var _instrument5 = require("../../features/ajax/instrument");
|
|
10
|
-
var _instrument6 = require("../../features/session_trace/instrument");
|
|
11
|
-
var _instrument7 = require("../../features/spa/instrument");
|
|
12
|
-
var _instrument8 = require("../../features/page_action/instrument");
|
|
13
|
-
var _instrument9 = require("../../features/logging/instrument");
|
|
14
|
-
/**
|
|
15
|
-
* @file Creates a version of the "SPA" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
|
|
16
|
-
* polyfills for pre-ES6 browsers and IE 11.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
new _agent.Agent({
|
|
20
|
-
features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument9.Instrument, _instrument7.Instrument],
|
|
21
|
-
loaderType: 'spa-polyfills'
|
|
22
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
require("core-js/stable/promise");
|
|
4
|
-
require("core-js/stable/array/includes");
|
|
5
|
-
require("core-js/stable/array/find");
|
|
6
|
-
require("core-js/stable/array/flat");
|
|
7
|
-
require("core-js/stable/array/flat-map");
|
|
8
|
-
require("core-js/stable/array/from");
|
|
9
|
-
require("core-js/stable/array/some");
|
|
10
|
-
require("core-js/stable/array/find-index");
|
|
11
|
-
require("core-js/stable/object/assign");
|
|
12
|
-
require("core-js/stable/object/entries");
|
|
13
|
-
require("core-js/stable/object/values");
|
|
14
|
-
require("core-js/stable/object/from-entries");
|
|
15
|
-
require("core-js/stable/map");
|
|
16
|
-
require("core-js/stable/reflect");
|
|
17
|
-
require("core-js/stable/set");
|
|
18
|
-
require("core-js/stable/weak-set");
|
|
19
|
-
require("core-js/stable/object/get-own-property-descriptors");
|
|
20
|
-
require("core-js/stable/url");
|
|
21
|
-
require("core-js/stable/url-search-params");
|
|
22
|
-
require("core-js/stable/string/starts-with");
|
|
23
|
-
require("core-js/stable/number/is-nan");
|
|
24
|
-
require("core-js/stable/string/includes");
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "getConfiguration", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _init.getConfiguration;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "getConfigurationValue", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _init.getConfigurationValue;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "getInfo", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _info.getInfo;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "getLoaderConfig", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function () {
|
|
27
|
-
return _loaderConfig.getLoaderConfig;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "getRuntime", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function () {
|
|
33
|
-
return _runtime.getRuntime;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
exports.isConfigured = isConfigured;
|
|
37
|
-
Object.defineProperty(exports, "originals", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
get: function () {
|
|
40
|
-
return _originals.originals;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
Object.defineProperty(exports, "setConfiguration", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return _init.setConfiguration;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(exports, "setInfo", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
get: function () {
|
|
52
|
-
return _info.setInfo;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(exports, "setLoaderConfig", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
get: function () {
|
|
58
|
-
return _loaderConfig.setLoaderConfig;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
Object.defineProperty(exports, "setRuntime", {
|
|
62
|
-
enumerable: true,
|
|
63
|
-
get: function () {
|
|
64
|
-
return _runtime.setRuntime;
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
var _info = require("./state/info");
|
|
68
|
-
var _init = require("./state/init");
|
|
69
|
-
var _loaderConfig = require("./state/loader-config");
|
|
70
|
-
var _originals = require("./state/originals");
|
|
71
|
-
var _runtime = require("./state/runtime");
|
|
72
|
-
function isConfigured(agentIdentifier) {
|
|
73
|
-
return (0, _info.isValid)(agentIdentifier);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// This module acts as a hub that bundles the static and dynamic properties used by each agent instance into one single interface
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mapOwn = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
9
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {function} MapOwnCallback
|
|
14
|
-
* @param {string} key Object key
|
|
15
|
-
* @param {any} value Object value
|
|
16
|
-
* @returns {any}
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Iterates the own enumerable properties of an object passing the key and value pair to a given
|
|
21
|
-
* callback function.
|
|
22
|
-
* @param {object} obj Input object to iterate over. If null or undefined, an empty array will be returned.
|
|
23
|
-
* @param {MapOwnCallback} fn A callback function called for each property. The callback should take the key
|
|
24
|
-
* and value from the object iteration and return some value.
|
|
25
|
-
* @returns {any[]} An array of values returned by the callback function.
|
|
26
|
-
*/
|
|
27
|
-
const mapOwn = (obj, fn) => Object.entries(obj || {}).map(_ref => {
|
|
28
|
-
let [key, value] = _ref;
|
|
29
|
-
return fn(key, value);
|
|
30
|
-
});
|
|
31
|
-
exports.mapOwn = mapOwn;
|