@newrelic/browser-agent 1.264.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 +24 -0
- package/dist/cjs/common/aggregate/aggregator.js +1 -2
- 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} +5 -5
- 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/context/shared-context.js +1 -2
- package/dist/cjs/common/dispatch/global-event.js +1 -2
- package/dist/cjs/common/drain/drain.js +10 -16
- 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 +29 -56
- package/dist/cjs/common/serialize/bel-serializer.js +6 -11
- package/dist/cjs/common/session/session-entity.js +9 -12
- 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 +2 -4
- 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 -20
- 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 +6 -8
- 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 +20 -23
- 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 +15 -13
- package/dist/cjs/features/generic_events/aggregate/index.js +49 -58
- package/dist/cjs/features/generic_events/constants.js +4 -2
- package/dist/cjs/features/generic_events/instrument/index.js +7 -7
- package/dist/cjs/features/jserrors/aggregate/index.js +24 -44
- package/dist/cjs/features/jserrors/instrument/index.js +5 -5
- package/dist/cjs/features/logging/aggregate/index.js +34 -37
- package/dist/cjs/features/logging/constants.js +2 -3
- package/dist/cjs/features/logging/instrument/index.js +6 -7
- 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 +35 -18
- 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 +13 -5
- package/dist/cjs/features/page_action/instrument/index.js +8 -4
- package/dist/cjs/features/page_view_event/aggregate/index.js +20 -40
- package/dist/cjs/features/page_view_event/instrument/index.js +5 -5
- package/dist/cjs/features/page_view_timing/aggregate/index.js +24 -40
- package/dist/cjs/features/page_view_timing/instrument/index.js +5 -5
- package/dist/cjs/features/session_replay/aggregate/index.js +37 -44
- package/dist/cjs/features/session_replay/constants.js +1 -5
- package/dist/cjs/features/session_replay/instrument/index.js +6 -10
- 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 +3 -3
- package/dist/cjs/features/session_replay/shared/utils.js +5 -4
- package/dist/cjs/features/session_trace/aggregate/index.js +26 -43
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +7 -5
- package/dist/cjs/features/session_trace/instrument/index.js +9 -8
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +23 -31
- package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +2 -2
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +9 -10
- package/dist/cjs/features/soft_navigations/instrument/index.js +15 -14
- package/dist/cjs/features/spa/aggregate/index.js +17 -27
- package/dist/cjs/features/spa/aggregate/interaction.js +7 -6
- package/dist/cjs/features/spa/aggregate/serializer.js +3 -3
- package/dist/cjs/features/spa/constants.js +2 -2
- package/dist/cjs/features/spa/instrument/index.js +21 -20
- package/dist/cjs/features/utils/agent-session.js +6 -4
- package/dist/cjs/features/utils/aggregate-base.js +15 -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 +11 -11
- package/dist/cjs/features/utils/nr1-debugger.js +1 -3
- package/dist/cjs/loaders/agent-base.js +4 -8
- package/dist/cjs/loaders/agent.js +7 -2
- package/dist/cjs/loaders/api/api.js +22 -34
- package/dist/cjs/loaders/api/apiAsync.js +9 -12
- package/dist/cjs/loaders/configure/configure.js +12 -12
- package/dist/cjs/loaders/features/enabled-features.js +2 -2
- package/dist/cjs/loaders/micro-agent.js +15 -14
- package/dist/esm/common/aggregate/aggregator.js +1 -2
- 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} +5 -5
- 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/context/shared-context.js +1 -2
- package/dist/esm/common/dispatch/global-event.js +1 -2
- package/dist/esm/common/drain/drain.js +10 -16
- 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 +21 -48
- package/dist/esm/common/serialize/bel-serializer.js +6 -11
- package/dist/esm/common/session/session-entity.js +8 -11
- 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 +2 -4
- 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 -20
- 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 +6 -8
- 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 +17 -20
- 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 +11 -9
- package/dist/esm/features/generic_events/aggregate/index.js +41 -50
- package/dist/esm/features/generic_events/constants.js +3 -1
- package/dist/esm/features/generic_events/instrument/index.js +5 -5
- package/dist/esm/features/jserrors/aggregate/index.js +19 -39
- package/dist/esm/features/jserrors/instrument/index.js +4 -4
- package/dist/esm/features/logging/aggregate/index.js +32 -35
- package/dist/esm/features/logging/constants.js +1 -2
- package/dist/esm/features/logging/instrument/index.js +5 -6
- 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 +29 -12
- 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 +13 -5
- package/dist/esm/features/page_action/instrument/index.js +7 -3
- package/dist/esm/features/page_view_event/aggregate/index.js +18 -38
- package/dist/esm/features/page_view_event/instrument/index.js +4 -4
- package/dist/esm/features/page_view_timing/aggregate/index.js +21 -37
- package/dist/esm/features/page_view_timing/instrument/index.js +4 -4
- package/dist/esm/features/session_replay/aggregate/index.js +27 -34
- 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 +6 -9
- 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 +3 -3
- package/dist/esm/features/session_replay/shared/utils.js +3 -2
- package/dist/esm/features/session_trace/aggregate/index.js +21 -38
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +7 -5
- package/dist/esm/features/session_trace/instrument/index.js +6 -5
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +22 -30
- package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +7 -8
- package/dist/esm/features/soft_navigations/instrument/index.js +12 -11
- package/dist/esm/features/spa/aggregate/index.js +11 -21
- package/dist/esm/features/spa/aggregate/interaction.js +6 -5
- package/dist/esm/features/spa/aggregate/serializer.js +1 -1
- package/dist/esm/features/spa/constants.js +2 -2
- package/dist/esm/features/spa/instrument/index.js +13 -12
- package/dist/esm/features/utils/agent-session.js +3 -1
- package/dist/esm/features/utils/aggregate-base.js +13 -8
- 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 +11 -11
- package/dist/esm/features/utils/nr1-debugger.js +1 -3
- package/dist/esm/loaders/agent-base.js +4 -8
- package/dist/esm/loaders/agent.js +7 -2
- package/dist/esm/loaders/api/api.js +17 -29
- package/dist/esm/loaders/api/apiAsync.js +2 -5
- package/dist/esm/loaders/configure/configure.js +5 -5
- package/dist/esm/loaders/features/enabled-features.js +1 -1
- package/dist/esm/loaders/micro-agent.js +10 -9
- 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/drain/drain.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/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/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/generic_events/aggregate/index.d.ts +6 -8
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/constants.d.ts +2 -0
- package/dist/types/features/generic_events/constants.d.ts.map +1 -1
- package/dist/types/features/generic_events/instrument/index.d.ts +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -1
- 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 +4 -0
- 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/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/loaders/agent-base.d.ts +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/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +55 -59
- 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} +5 -5
- 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/drain/drain.js +5 -2
- package/src/common/event-emitter/contextual-ee.js +1 -1
- package/src/common/harvest/harvest.js +7 -21
- package/src/common/serialize/bel-serializer.js +5 -7
- package/src/common/session/session-entity.js +2 -2
- package/src/common/timing/__mocks__/time-keeper.js +6 -2
- package/src/common/timing/time-keeper.js +15 -5
- 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/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 +43 -37
- package/src/features/generic_events/constants.js +2 -0
- package/src/features/generic_events/instrument/index.js +3 -1
- package/src/features/jserrors/aggregate/index.js +14 -4
- 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 +5 -0
- package/src/features/page_view_event/aggregate/index.js +8 -23
- package/src/features/page_view_event/instrument/index.js +2 -0
- package/src/features/page_view_timing/aggregate/index.js +14 -16
- 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 +11 -18
- package/src/features/spa/aggregate/interaction.js +5 -3
- package/src/features/spa/aggregate/serializer.js +1 -1
- 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 +10 -2
- 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/loaders/agent-base.js +2 -2
- package/src/loaders/agent.js +7 -2
- package/src/loaders/api/api.js +2 -1
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/configure/configure.js +4 -1
- package/src/loaders/features/enabled-features.js +1 -1
- package/src/loaders/micro-agent.js +4 -1
- package/dist/cjs/common/config/config.js +0 -76
- package/dist/cjs/common/config/state/originals.js +0 -8
- package/dist/cjs/common/wrap/index.js +0 -61
- package/dist/esm/common/config/config.js +0 -11
- package/dist/esm/common/config/state/originals.js +0 -2
- package/dist/esm/common/wrap/index.js +0 -13
- 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/wrap/index.d.ts +0 -10
- package/dist/types/common/wrap/index.d.ts.map +0 -1
- 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/wrap/index.js +0 -16
- /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
|
@@ -2,13 +2,19 @@
|
|
|
2
2
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
-
import { wrapMutation, wrapPromise, wrapHistory, wrapTimer, wrapFetch, wrapXhr, wrapJsonP } from '../../../common/wrap';
|
|
6
5
|
import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
|
|
7
6
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
8
7
|
import * as CONSTANTS from '../constants';
|
|
9
8
|
import { isBrowserScope } from '../../../common/constants/runtime';
|
|
10
9
|
import { now } from '../../../common/timing/now';
|
|
11
10
|
import { handle } from '../../../common/event-emitter/handle';
|
|
11
|
+
import { wrapJsonP } from '../../../common/wrap/wrap-jsonp';
|
|
12
|
+
import { wrapPromise } from '../../../common/wrap/wrap-promise';
|
|
13
|
+
import { wrapTimer } from '../../../common/wrap/wrap-timer';
|
|
14
|
+
import { wrapXhr } from '../../../common/wrap/wrap-xhr';
|
|
15
|
+
import { wrapFetch } from '../../../common/wrap/wrap-fetch';
|
|
16
|
+
import { wrapHistory } from '../../../common/wrap/wrap-history';
|
|
17
|
+
import { wrapMutation } from '../../../common/wrap/wrap-mutation';
|
|
12
18
|
const {
|
|
13
19
|
FEATURE_NAME,
|
|
14
20
|
START,
|
|
@@ -22,12 +28,9 @@ const {
|
|
|
22
28
|
FN_END
|
|
23
29
|
} = CONSTANTS;
|
|
24
30
|
export class Instrument extends InstrumentBase {
|
|
25
|
-
static featureName =
|
|
26
|
-
constructor(agentIdentifier, aggregator) {
|
|
27
|
-
var _this;
|
|
28
|
-
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
31
|
+
static featureName = FEATURE_NAME;
|
|
32
|
+
constructor(agentIdentifier, aggregator, auto = true) {
|
|
29
33
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
30
|
-
_this = this;
|
|
31
34
|
if (!isBrowserScope) return; // SPA not supported outside web env
|
|
32
35
|
|
|
33
36
|
try {
|
|
@@ -50,11 +53,8 @@ export class Instrument extends InstrumentBase {
|
|
|
50
53
|
this.ee.on(FN_END, endTimestamp);
|
|
51
54
|
promiseEE.on(CB_END, endTimestamp);
|
|
52
55
|
jsonpEE.on(CB_END, endTimestamp);
|
|
53
|
-
this.ee.on('fn-err',
|
|
54
|
-
|
|
55
|
-
args[_key] = arguments[_key];
|
|
56
|
-
}
|
|
57
|
-
if (!args[2]?.__newrelic?.[agentIdentifier]) handle('function-err', [...args], undefined, _this.featureName, _this.ee);
|
|
56
|
+
this.ee.on('fn-err', (...args) => {
|
|
57
|
+
if (!args[2]?.__newrelic?.[agentIdentifier]) handle('function-err', [...args], undefined, this.featureName, this.ee);
|
|
58
58
|
});
|
|
59
59
|
this.ee.buffer([FN_START, FN_END, 'xhr-resolved'], this.featureName);
|
|
60
60
|
eventsEE.buffer([FN_START], this.featureName);
|
|
@@ -109,4 +109,5 @@ export class Instrument extends InstrumentBase {
|
|
|
109
109
|
this.removeOnAbort?.abort();
|
|
110
110
|
this.abortHandler = undefined; // weakly allow this abort op to run only once
|
|
111
111
|
}
|
|
112
|
-
}
|
|
112
|
+
}
|
|
113
|
+
export const Spa = Instrument;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getInfo } from '../../common/config/info';
|
|
2
|
+
import { getConfiguration } from '../../common/config/init';
|
|
3
|
+
import { getRuntime } from '../../common/config/runtime';
|
|
2
4
|
import { drain } from '../../common/drain/drain';
|
|
3
5
|
import { ee } from '../../common/event-emitter/contextual-ee';
|
|
4
6
|
import { registerHandler } from '../../common/event-emitter/register-handler';
|
|
@@ -1,13 +1,16 @@
|
|
|
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
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
|
export class AggregateBase extends FeatureBase {
|
|
8
|
-
constructor() {
|
|
9
|
-
super(...
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
10
12
|
this.checkConfiguration();
|
|
13
|
+
this.obfuscator = getRuntime(this.agentIdentifier).obfuscator;
|
|
11
14
|
}
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -15,14 +18,12 @@ export class AggregateBase extends FeatureBase {
|
|
|
15
18
|
* @param {string[]} flagNames
|
|
16
19
|
* @returns {Promise}
|
|
17
20
|
*/
|
|
18
|
-
waitForFlags() {
|
|
19
|
-
let flagNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
21
|
+
waitForFlags(flagNames = []) {
|
|
20
22
|
const flagsPromise = new Promise((resolve, reject) => {
|
|
21
23
|
if (activatedFeatures[this.agentIdentifier]) {
|
|
22
24
|
resolve(buildOutput(activatedFeatures[this.agentIdentifier]));
|
|
23
25
|
} else {
|
|
24
|
-
this.ee.on('rumresp',
|
|
25
|
-
let resp = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
26
|
+
this.ee.on('rumresp', (resp = {}) => {
|
|
26
27
|
resolve(buildOutput(resp));
|
|
27
28
|
});
|
|
28
29
|
}
|
|
@@ -50,7 +51,7 @@ export class AggregateBase extends FeatureBase {
|
|
|
50
51
|
*/
|
|
51
52
|
checkConfiguration() {
|
|
52
53
|
// NOTE: This check has to happen at aggregator load time
|
|
53
|
-
if (!
|
|
54
|
+
if (!isValid(this.agentIdentifier)) {
|
|
54
55
|
const cdn = gosCDN();
|
|
55
56
|
let jsAttributes = {
|
|
56
57
|
...cdn.info?.jsAttributes
|
|
@@ -74,5 +75,9 @@ export class AggregateBase extends FeatureBase {
|
|
|
74
75
|
runtime: getRuntime(this.agentIdentifier)
|
|
75
76
|
});
|
|
76
77
|
}
|
|
78
|
+
const runtime = getRuntime(this.agentIdentifier);
|
|
79
|
+
if (!runtime.obfuscator) {
|
|
80
|
+
runtime.obfuscator = new Obfuscator(this.agentIdentifier);
|
|
81
|
+
}
|
|
77
82
|
}
|
|
78
83
|
}
|
|
@@ -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';
|
|
@@ -29,8 +29,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
29
29
|
* of its pooled instrumentation data handled by the agent's centralized drain functionality, rather than draining
|
|
30
30
|
* immediately. Primarily useful for fine-grained control in tests.
|
|
31
31
|
*/
|
|
32
|
-
constructor(agentIdentifier, aggregator, featureName) {
|
|
33
|
-
let auto = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
32
|
+
constructor(agentIdentifier, aggregator, featureName, auto = true) {
|
|
34
33
|
super(agentIdentifier, aggregator, featureName);
|
|
35
34
|
this.auto = auto;
|
|
36
35
|
|
|
@@ -46,6 +45,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
46
45
|
/**
|
|
47
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
|
|
48
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.
|
|
49
49
|
*/
|
|
50
50
|
this.onAggregateImported = undefined;
|
|
51
51
|
|
|
@@ -69,8 +69,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
69
69
|
* @param {Object} [argsObjFromInstrument] - any values or references to pass down to aggregate
|
|
70
70
|
* @returns void
|
|
71
71
|
*/
|
|
72
|
-
importAggregator() {
|
|
73
|
-
let argsObjFromInstrument = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
72
|
+
importAggregator(argsObjFromInstrument = {}) {
|
|
74
73
|
if (this.featAggregate || !this.auto) return;
|
|
75
74
|
let loadedSuccessfully;
|
|
76
75
|
this.onAggregateImported = new Promise(resolve => {
|
|
@@ -83,7 +82,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
83
82
|
// would require some setup before certain features start
|
|
84
83
|
const {
|
|
85
84
|
setupAgentSession
|
|
86
|
-
} = await import(
|
|
85
|
+
} = await import(/* webpackChunkName: "session-manager" */'./agent-session');
|
|
87
86
|
session = setupAgentSession(this.agentIdentifier);
|
|
88
87
|
}
|
|
89
88
|
} catch (e) {
|
|
@@ -104,7 +103,7 @@ export class InstrumentBase extends FeatureBase {
|
|
|
104
103
|
}
|
|
105
104
|
const {
|
|
106
105
|
lazyFeatureLoader
|
|
107
|
-
} = await import(
|
|
106
|
+
} = await import(/* webpackChunkName: "lazy-feature-loader" */'./lazy-feature-loader');
|
|
108
107
|
const {
|
|
109
108
|
Aggregate
|
|
110
109
|
} = await lazyFeatureLoader(this.featureName, 'aggregate');
|
|
@@ -15,27 +15,27 @@ export function lazyFeatureLoader(featureName, featurePart) {
|
|
|
15
15
|
if (featurePart === 'aggregate') {
|
|
16
16
|
switch (featureName) {
|
|
17
17
|
case FEATURE_NAMES.ajax:
|
|
18
|
-
return import(
|
|
18
|
+
return import(/* webpackChunkName: "ajax-aggregate" */'../ajax/aggregate');
|
|
19
19
|
case FEATURE_NAMES.jserrors:
|
|
20
|
-
return import(
|
|
20
|
+
return import(/* webpackChunkName: "jserrors-aggregate" */'../jserrors/aggregate');
|
|
21
21
|
case FEATURE_NAMES.genericEvents:
|
|
22
|
-
return import(
|
|
22
|
+
return import(/* webpackChunkName: "generic_events-aggregate" */'../generic_events/aggregate');
|
|
23
23
|
case FEATURE_NAMES.logging:
|
|
24
|
-
return import(
|
|
24
|
+
return import(/* webpackChunkName: "logging-aggregate" */'../logging/aggregate');
|
|
25
25
|
case FEATURE_NAMES.metrics:
|
|
26
|
-
return import(
|
|
26
|
+
return import(/* webpackChunkName: "metrics-aggregate" */'../metrics/aggregate');
|
|
27
27
|
case FEATURE_NAMES.pageViewEvent:
|
|
28
|
-
return import(
|
|
28
|
+
return import(/* webpackChunkName: "page_view_event-aggregate" */'../page_view_event/aggregate');
|
|
29
29
|
case FEATURE_NAMES.pageViewTiming:
|
|
30
|
-
return import(
|
|
30
|
+
return import(/* webpackChunkName: "page_view_timing-aggregate" */'../page_view_timing/aggregate');
|
|
31
31
|
case FEATURE_NAMES.sessionReplay:
|
|
32
|
-
return import(
|
|
32
|
+
return import(/* webpackChunkName: "session_replay-aggregate" */'../session_replay/aggregate');
|
|
33
33
|
case FEATURE_NAMES.sessionTrace:
|
|
34
|
-
return import(
|
|
34
|
+
return import(/* webpackChunkName: "session_trace-aggregate" */'../session_trace/aggregate');
|
|
35
35
|
case FEATURE_NAMES.spa:
|
|
36
|
-
return import(
|
|
36
|
+
return import(/* webpackChunkName: "spa-aggregate" */'../spa/aggregate');
|
|
37
37
|
case FEATURE_NAMES.softNav:
|
|
38
|
-
return import(
|
|
38
|
+
return import(/* webpackChunkName: "basic-spa-aggregate" */'../soft_navigations/aggregate');
|
|
39
39
|
default:
|
|
40
40
|
throw new Error("Attempted to load unsupported agent feature: ".concat(featureName, " ").concat(featurePart));
|
|
41
41
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { gosCDN } from '../../common/window/nreum';
|
|
2
2
|
const debugId = 1;
|
|
3
3
|
const newrelic = gosCDN();
|
|
4
|
-
export function debugNR1(agentIdentifier, location, event) {
|
|
5
|
-
let otherprops = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
6
|
-
let debugName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'SR';
|
|
4
|
+
export function debugNR1(agentIdentifier, location, event, otherprops = {}, debugName = 'SR') {
|
|
7
5
|
const api = agentIdentifier ? newrelic.initializedAgents[agentIdentifier].api.addPageAction : newrelic.addPageAction;
|
|
8
6
|
let url;
|
|
9
7
|
try {
|
|
@@ -10,8 +10,7 @@ import { generateRandomHexString } from '../common/ids/unique-id';
|
|
|
10
10
|
|
|
11
11
|
export class AgentBase {
|
|
12
12
|
agentIdentifier;
|
|
13
|
-
constructor() {
|
|
14
|
-
let agentIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : generateRandomHexString(16);
|
|
13
|
+
constructor(agentIdentifier = generateRandomHexString(16)) {
|
|
15
14
|
this.agentIdentifier = agentIdentifier;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -20,10 +19,7 @@ export class AgentBase {
|
|
|
20
19
|
* @param {string} methodName
|
|
21
20
|
* @param {...any} args
|
|
22
21
|
*/
|
|
23
|
-
#callMethod(methodName) {
|
|
24
|
-
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
25
|
-
args[_key - 1] = arguments[_key];
|
|
26
|
-
}
|
|
22
|
+
#callMethod(methodName, ...args) {
|
|
27
23
|
if (typeof this.api?.[methodName] !== 'function') warn(35, methodName);else return this.api[methodName](...args);
|
|
28
24
|
}
|
|
29
25
|
|
|
@@ -182,12 +178,12 @@ export class AgentBase {
|
|
|
182
178
|
|
|
183
179
|
/**
|
|
184
180
|
* Capture a single log.
|
|
185
|
-
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/
|
|
181
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/log/}
|
|
186
182
|
* @param {string} message String to be captured as log message
|
|
187
183
|
* @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
|
|
188
184
|
*/
|
|
189
185
|
log(message, options) {
|
|
190
|
-
return this.#callMethod('
|
|
186
|
+
return this.#callMethod('log', message, options);
|
|
191
187
|
}
|
|
192
188
|
|
|
193
189
|
/**
|
|
@@ -67,8 +67,13 @@ export class Agent extends AgentBase {
|
|
|
67
67
|
if (this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.spa) return;
|
|
68
68
|
if (!this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.softNav) return;
|
|
69
69
|
const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName);
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
70
|
+
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
|
|
71
|
+
if (missingDependencies.length > 0) {
|
|
72
|
+
warn(36, {
|
|
73
|
+
targetFeature: InstrumentCtor.featureName,
|
|
74
|
+
missingDependencies
|
|
75
|
+
});
|
|
76
|
+
}
|
|
72
77
|
this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator);
|
|
73
78
|
});
|
|
74
79
|
} catch (err) {
|
|
@@ -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';
|
|
@@ -22,17 +23,9 @@ import { wrapLogger } from '../../common/wrap/wrap-logger';
|
|
|
22
23
|
export function setTopLevelCallers() {
|
|
23
24
|
const nr = gosCDN();
|
|
24
25
|
apiMethods.forEach(f => {
|
|
25
|
-
nr[f] =
|
|
26
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
27
|
-
args[_key] = arguments[_key];
|
|
28
|
-
}
|
|
29
|
-
return caller(f, ...args);
|
|
30
|
-
};
|
|
26
|
+
nr[f] = (...args) => caller(f, ...args);
|
|
31
27
|
});
|
|
32
|
-
function caller(fnName) {
|
|
33
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
34
|
-
args[_key2 - 1] = arguments[_key2];
|
|
35
|
-
}
|
|
28
|
+
function caller(fnName, ...args) {
|
|
36
29
|
let returnVals = [];
|
|
37
30
|
Object.values(nr.initializedAgents).forEach(val => {
|
|
38
31
|
if (!val || !val.api) {
|
|
@@ -45,8 +38,7 @@ export function setTopLevelCallers() {
|
|
|
45
38
|
}
|
|
46
39
|
}
|
|
47
40
|
const replayRunning = {};
|
|
48
|
-
export function setAPI(agentIdentifier, forceDrain) {
|
|
49
|
-
let runSoftNavOverSpa = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
41
|
+
export function setAPI(agentIdentifier, forceDrain, runSoftNavOverSpa = false) {
|
|
50
42
|
if (!forceDrain) registerDrain(agentIdentifier, 'api');
|
|
51
43
|
const apiInterface = {};
|
|
52
44
|
var instanceEE = ee.get(agentIdentifier);
|
|
@@ -57,19 +49,17 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
57
49
|
});
|
|
58
50
|
var prefix = 'api-';
|
|
59
51
|
var spaPrefix = prefix + 'ixn-';
|
|
60
|
-
apiInterface.log = function (message
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
52
|
+
apiInterface.log = function (message, {
|
|
53
|
+
customAttributes = {},
|
|
54
|
+
level = LOG_LEVELS.INFO
|
|
55
|
+
} = {}) {
|
|
65
56
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/log/called'], undefined, FEATURE_NAMES.metrics, instanceEE);
|
|
66
57
|
bufferLog(instanceEE, message, customAttributes, level);
|
|
67
58
|
};
|
|
68
|
-
apiInterface.wrapLogger =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
59
|
+
apiInterface.wrapLogger = (parent, functionName, {
|
|
60
|
+
customAttributes = {},
|
|
61
|
+
level = LOG_LEVELS.INFO
|
|
62
|
+
} = {}) => {
|
|
73
63
|
handle(SUPPORTABILITY_METRIC_CHANNEL, ['API/wrapLogger/called'], undefined, FEATURE_NAMES.metrics, instanceEE);
|
|
74
64
|
wrapLogger(instanceEE, parent, functionName, {
|
|
75
65
|
customAttributes,
|
|
@@ -112,8 +102,7 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
112
102
|
}
|
|
113
103
|
return apiCall(prefix, apiName, true, !!addToBrowserStorage || value === null ? 'session' : undefined)(key, value);
|
|
114
104
|
}
|
|
115
|
-
apiInterface.setCustomAttribute = function (name, value) {
|
|
116
|
-
let persistAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
105
|
+
apiInterface.setCustomAttribute = function (name, value, persistAttribute = false) {
|
|
117
106
|
if (typeof name !== 'string') {
|
|
118
107
|
warn(39, typeof name);
|
|
119
108
|
return;
|
|
@@ -216,10 +205,9 @@ export function setAPI(agentIdentifier, forceDrain) {
|
|
|
216
205
|
// try to stay out of the way of the window.load event, lazy load once that has finished.
|
|
217
206
|
else onWindowLoad(() => lazyLoad(), true);
|
|
218
207
|
function lazyLoad() {
|
|
219
|
-
import(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
} = _ref;
|
|
208
|
+
import(/* webpackChunkName: "async-api" */'./apiAsync').then(({
|
|
209
|
+
setAPI
|
|
210
|
+
}) => {
|
|
223
211
|
setAPI(agentIdentifier);
|
|
224
212
|
drain(agentIdentifier, 'api');
|
|
225
213
|
}).catch(err => {
|
|
@@ -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';
|
|
@@ -16,10 +16,7 @@ export function setAPI(agentIdentifier) {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// Hook all of the api functions up to the queues/stubs created in loader/api.js
|
|
19
|
-
Object.entries(api).forEach(
|
|
20
|
-
let [fnName, fnCall] = _ref;
|
|
21
|
-
return registerHandler('api-' + fnName, fnCall, 'api', instanceEE);
|
|
22
|
-
});
|
|
19
|
+
Object.entries(api).forEach(([fnName, fnCall]) => registerHandler('api-' + fnName, fnCall, 'api', instanceEE));
|
|
23
20
|
|
|
24
21
|
// All API functions get passed the time they were called as their
|
|
25
22
|
// first parameter. These functions can be called asynchronously.
|
|
@@ -1,6 +1,9 @@
|
|
|
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,10 +13,7 @@ let alreadySetOnce = false; // the configure() function can run multiple times i
|
|
|
10
13
|
/**
|
|
11
14
|
* Sets or re-sets the agent's configuration values from global settings. This also attach those as properties to the agent instance.
|
|
12
15
|
*/
|
|
13
|
-
export function configure(agent) {
|
|
14
|
-
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15
|
-
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
16
|
-
let forceDrain = arguments.length > 3 ? arguments[3] : undefined;
|
|
16
|
+
export function configure(agent, opts = {}, loaderType, forceDrain) {
|
|
17
17
|
// eslint-disable-next-line camelcase
|
|
18
18
|
let {
|
|
19
19
|
init,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FEATURE_NAMES } from './features';
|
|
2
|
-
import { getConfigurationValue } from '../../common/config/
|
|
2
|
+
import { getConfigurationValue } from '../../common/config/init';
|
|
3
3
|
const featureNames = Object.values(FEATURE_NAMES);
|
|
4
4
|
function isEnabled(name, agentIdentifier) {
|
|
5
5
|
return getConfigurationValue(agentIdentifier, "".concat(name, ".enabled")) === true;
|
|
@@ -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';
|
|
@@ -76,15 +79,13 @@ export class MicroAgent extends AgentBase {
|
|
|
76
79
|
// these features do not import an "instrument" file, meaning they are only hooked up to the API.
|
|
77
80
|
nonAutoFeatures.forEach(f => {
|
|
78
81
|
if (enabledFeatures[f] && features.includes(f)) {
|
|
79
|
-
import(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} = _ref;
|
|
82
|
+
import(/* webpackChunkName: "lazy-feature-loader" */'../features/utils/lazy-feature-loader').then(({
|
|
83
|
+
lazyFeatureLoader
|
|
84
|
+
}) => {
|
|
83
85
|
return lazyFeatureLoader(f, 'aggregate');
|
|
84
|
-
}).then(
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
} = _ref2;
|
|
86
|
+
}).then(({
|
|
87
|
+
Aggregate
|
|
88
|
+
}) => {
|
|
88
89
|
this.features[f] = new Aggregate(this.agentIdentifier, this.sharedAggregator);
|
|
89
90
|
}).catch(err => warn(25, err));
|
|
90
91
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../src/common/config/configurable.js"],"names":[],"mappings":"AAEA,4DA0BC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../../../src/common/config/info.js"],"names":[],"mappings":"AA6BA,0CAOC;AAED,sCAIC;AAED,iDAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/common/config/init.js"],"names":[],"mappings":"AAkHA,+CAIC;AAED,0DAKC;AAED,+DAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-config.d.ts","sourceRoot":"","sources":["../../../../src/common/config/loader-config.js"],"names":[],"mappings":"AAcA,8CAIC;AAED,yDAKC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AAsCA,yCAIC;AAED,oDAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-constants.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/agent-constants.js"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../../../src/common/drain/drain.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"drain.d.ts","sourceRoot":"","sources":["../../../../src/common/drain/drain.js"],"names":[],"mappings":"AAYA;;;;;;;GAOG;AACH,+CAHW,MAAM,SACN,MAAM,QAQhB;AAED;;;;GAIG;AACH,iDAHW,GAAC,SACD,GAAC,QAOX;AAYD;;;;;;GAMG;AACH,wCAJW,MAAM,gBACN,MAAM,UACN,OAAO,QAajB"}
|