@newrelic/browser-agent 1.232.1 → 1.233.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.
Files changed (233) hide show
  1. package/dist/cjs/cdn/polyfills.js +5 -2
  2. package/dist/cjs/common/config/state/configurable.js +15 -26
  3. package/dist/cjs/common/config/state/info.js +1 -1
  4. package/dist/cjs/common/config/state/init.js +101 -56
  5. package/dist/cjs/common/config/state/loader-config.js +1 -1
  6. package/dist/cjs/common/config/state/runtime.js +1 -5
  7. package/dist/cjs/common/constants/env.cdn.js +1 -1
  8. package/dist/cjs/common/constants/env.npm.js +1 -1
  9. package/dist/cjs/common/drain/drain.js +1 -1
  10. package/dist/cjs/common/harvest/harvest-scheduler.js +30 -10
  11. package/dist/cjs/common/harvest/harvest.js +119 -55
  12. package/dist/cjs/common/session/session-entity.js +35 -22
  13. package/dist/cjs/common/session/session-entity.test.js +73 -49
  14. package/dist/cjs/common/timer/interaction-timer.js +9 -12
  15. package/dist/cjs/common/url/protocol.test.js +0 -1
  16. package/dist/cjs/common/util/feature-flags.js +2 -1
  17. package/dist/cjs/common/util/submit-data.js +57 -18
  18. package/dist/cjs/common/wrap/wrap-fetch.js +1 -1
  19. package/dist/cjs/common/wrap/wrap-function.js +1 -1
  20. package/dist/cjs/common/wrap/wrap-promise.js +1 -1
  21. package/dist/cjs/features/ajax/aggregate/index.js +2 -2
  22. package/dist/cjs/features/jserrors/aggregate/index.js +7 -5
  23. package/dist/cjs/features/metrics/aggregate/framework-detection.js +67 -0
  24. package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +137 -0
  25. package/dist/cjs/features/metrics/aggregate/index.js +7 -3
  26. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +14 -0
  27. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +17 -0
  28. package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +53 -0
  29. package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +165 -0
  30. package/dist/cjs/features/page_action/aggregate/index.js +2 -2
  31. package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
  32. package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -2
  33. package/dist/cjs/features/session_replay/aggregate/index.js +333 -0
  34. package/dist/cjs/features/session_replay/constants.js +9 -0
  35. package/dist/cjs/features/session_replay/index.js +12 -0
  36. package/dist/cjs/features/session_replay/instrument/index.js +29 -0
  37. package/dist/cjs/features/session_trace/aggregate/index.js +163 -162
  38. package/dist/cjs/features/session_trace/constants.js +2 -9
  39. package/dist/cjs/features/session_trace/instrument/index.js +24 -66
  40. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  41. package/dist/cjs/features/utils/agent-session.js +1 -2
  42. package/dist/cjs/features/utils/aggregate-base.js +64 -0
  43. package/dist/cjs/features/utils/feature-base.js +0 -31
  44. package/dist/cjs/features/utils/handler-cache.js +3 -4
  45. package/dist/cjs/features/utils/instrument-base.js +42 -10
  46. package/dist/cjs/features/utils/{lazy-loader.js → lazy-feature-loader.js} +4 -2
  47. package/dist/cjs/loaders/agent.js +1 -1
  48. package/dist/cjs/loaders/api/apiAsync.js +3 -1
  49. package/dist/cjs/loaders/configure/configure.js +3 -3
  50. package/dist/cjs/loaders/features/featureDependencies.js +0 -12
  51. package/dist/cjs/loaders/features/features.js +3 -1
  52. package/dist/cjs/loaders/micro-agent.js +6 -6
  53. package/dist/esm/cdn/polyfills.js +5 -2
  54. package/dist/esm/common/config/state/configurable.js +14 -24
  55. package/dist/esm/common/config/state/info.js +2 -2
  56. package/dist/esm/common/config/state/init.js +102 -57
  57. package/dist/esm/common/config/state/loader-config.js +2 -2
  58. package/dist/esm/common/config/state/runtime.js +2 -4
  59. package/dist/esm/common/constants/env.cdn.js +1 -1
  60. package/dist/esm/common/constants/env.npm.js +1 -1
  61. package/dist/esm/common/drain/drain.js +1 -1
  62. package/dist/esm/common/harvest/harvest-scheduler.js +30 -10
  63. package/dist/esm/common/harvest/harvest.js +121 -56
  64. package/dist/esm/common/session/session-entity.js +35 -22
  65. package/dist/esm/common/session/session-entity.test.js +73 -49
  66. package/dist/esm/common/timer/interaction-timer.js +9 -12
  67. package/dist/esm/common/url/protocol.test.js +0 -1
  68. package/dist/esm/common/util/feature-flags.js +2 -1
  69. package/dist/esm/common/util/submit-data.js +57 -18
  70. package/dist/esm/common/wrap/wrap-fetch.js +1 -1
  71. package/dist/esm/common/wrap/wrap-function.js +1 -1
  72. package/dist/esm/common/wrap/wrap-promise.js +1 -1
  73. package/dist/esm/features/ajax/aggregate/index.js +2 -2
  74. package/dist/esm/features/jserrors/aggregate/index.js +7 -5
  75. package/dist/esm/features/metrics/aggregate/framework-detection.js +61 -0
  76. package/dist/esm/features/metrics/aggregate/framework-detection.test.js +133 -0
  77. package/dist/esm/features/metrics/aggregate/index.js +7 -3
  78. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +8 -0
  79. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +15 -0
  80. package/dist/esm/features/metrics/aggregate/polyfill-detection.js +47 -0
  81. package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  82. package/dist/esm/features/page_action/aggregate/index.js +2 -2
  83. package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
  84. package/dist/esm/features/page_view_timing/aggregate/index.js +2 -2
  85. package/dist/esm/features/session_replay/aggregate/index.js +327 -0
  86. package/dist/esm/features/session_replay/constants.js +2 -0
  87. package/dist/esm/features/session_replay/index.js +12 -0
  88. package/dist/esm/features/session_replay/instrument/index.js +21 -0
  89. package/dist/esm/features/session_trace/aggregate/index.js +163 -162
  90. package/dist/esm/features/session_trace/constants.js +1 -5
  91. package/dist/esm/features/session_trace/instrument/index.js +24 -66
  92. package/dist/esm/features/spa/aggregate/index.js +2 -2
  93. package/dist/esm/features/utils/agent-session.js +1 -2
  94. package/dist/esm/features/utils/aggregate-base.js +57 -0
  95. package/dist/esm/features/utils/feature-base.js +1 -32
  96. package/dist/esm/features/utils/handler-cache.js +3 -4
  97. package/dist/esm/features/utils/instrument-base.js +42 -10
  98. package/dist/esm/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  99. package/dist/esm/loaders/agent.js +1 -1
  100. package/dist/esm/loaders/api/apiAsync.js +3 -1
  101. package/dist/esm/loaders/configure/configure.js +3 -3
  102. package/dist/esm/loaders/features/featureDependencies.js +0 -11
  103. package/dist/esm/loaders/features/features.js +3 -1
  104. package/dist/esm/loaders/micro-agent.js +6 -6
  105. package/dist/types/common/config/state/configurable.d.ts +1 -3
  106. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  107. package/dist/types/common/config/state/init.d.ts.map +1 -1
  108. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  109. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  110. package/dist/types/common/harvest/harvest.d.ts +37 -34
  111. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  112. package/dist/types/common/session/session-entity.d.ts +6 -3
  113. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  114. package/dist/types/common/timer/interaction-timer.d.ts +2 -1
  115. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
  116. package/dist/types/common/util/feature-flags.d.ts.map +1 -1
  117. package/dist/types/common/util/submit-data.d.ts +40 -14
  118. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  119. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  120. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  121. package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
  122. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  123. package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -0
  124. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  125. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  126. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +6 -0
  127. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +1 -0
  128. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +7 -0
  129. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -0
  130. package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
  131. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  132. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  133. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  134. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  135. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  136. package/dist/types/features/session_replay/aggregate/index.d.ts +96 -0
  137. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -0
  138. package/dist/types/features/session_replay/constants.d.ts +2 -0
  139. package/dist/types/features/session_replay/constants.d.ts.map +1 -0
  140. package/dist/types/features/session_replay/index.d.ts +2 -0
  141. package/dist/types/features/session_replay/index.d.ts.map +1 -0
  142. package/dist/types/features/session_replay/instrument/index.d.ts +6 -0
  143. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -0
  144. package/dist/types/features/session_trace/aggregate/index.d.ts +8 -57
  145. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  146. package/dist/types/features/session_trace/constants.d.ts +0 -3
  147. package/dist/types/features/session_trace/constants.d.ts.map +1 -1
  148. package/dist/types/features/session_trace/instrument/index.d.ts +1 -3
  149. package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
  150. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  151. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  152. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  153. package/dist/types/features/utils/aggregate-base.d.ts +11 -0
  154. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
  155. package/dist/types/features/utils/feature-base.d.ts +0 -5
  156. package/dist/types/features/utils/feature-base.d.ts.map +1 -1
  157. package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
  158. package/dist/types/features/utils/instrument-base.d.ts +3 -1
  159. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  160. package/dist/types/features/utils/{lazy-loader.d.ts → lazy-feature-loader.d.ts} +2 -2
  161. package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -0
  162. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  163. package/dist/types/loaders/features/featureDependencies.d.ts +0 -1
  164. package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
  165. package/dist/types/loaders/features/features.d.ts +1 -0
  166. package/dist/types/loaders/features/features.d.ts.map +1 -1
  167. package/package.json +28 -19
  168. package/src/cdn/polyfills.js +4 -1
  169. package/src/common/config/state/configurable.js +18 -24
  170. package/src/common/config/state/info.js +2 -2
  171. package/src/common/config/state/init.js +62 -28
  172. package/src/common/config/state/loader-config.js +2 -2
  173. package/src/common/config/state/runtime.js +2 -4
  174. package/src/common/drain/drain.js +1 -1
  175. package/src/common/harvest/harvest-scheduler.js +35 -10
  176. package/src/common/harvest/harvest.js +73 -50
  177. package/src/common/session/session-entity.js +34 -23
  178. package/src/common/session/session-entity.test.js +57 -51
  179. package/src/common/timer/interaction-timer.js +9 -12
  180. package/src/common/url/protocol.test.js +0 -1
  181. package/src/common/util/feature-flags.js +2 -2
  182. package/src/common/util/submit-data.js +28 -17
  183. package/src/common/wrap/wrap-fetch.js +1 -1
  184. package/src/common/wrap/wrap-function.js +1 -1
  185. package/src/common/wrap/wrap-promise.js +1 -1
  186. package/src/features/ajax/aggregate/index.js +2 -2
  187. package/src/features/jserrors/aggregate/index.js +7 -5
  188. package/src/features/metrics/aggregate/framework-detection.js +73 -0
  189. package/src/features/metrics/aggregate/framework-detection.test.js +201 -0
  190. package/src/features/metrics/aggregate/index.js +8 -3
  191. package/src/features/metrics/aggregate/polyfill-detection.es5.js +9 -0
  192. package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +16 -0
  193. package/src/features/metrics/aggregate/polyfill-detection.js +48 -0
  194. package/src/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  195. package/src/features/page_action/aggregate/index.js +2 -2
  196. package/src/features/page_view_event/aggregate/index.js +5 -5
  197. package/src/features/page_view_timing/aggregate/index.js +2 -2
  198. package/src/features/session_replay/aggregate/index.js +314 -0
  199. package/src/features/session_replay/constants.js +3 -0
  200. package/src/features/session_replay/index.js +12 -0
  201. package/src/features/session_replay/instrument/index.js +22 -0
  202. package/src/features/session_trace/aggregate/index.js +148 -187
  203. package/src/features/session_trace/constants.js +0 -4
  204. package/src/features/session_trace/instrument/index.js +17 -69
  205. package/src/features/spa/aggregate/index.js +2 -2
  206. package/src/features/utils/agent-session.js +1 -2
  207. package/src/features/utils/aggregate-base.js +51 -0
  208. package/src/features/utils/feature-base.js +1 -31
  209. package/src/features/utils/handler-cache.js +3 -4
  210. package/src/features/utils/instrument-base.js +40 -8
  211. package/src/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  212. package/src/loaders/agent.js +1 -1
  213. package/src/loaders/api/apiAsync.js +1 -1
  214. package/src/loaders/configure/configure.js +4 -3
  215. package/src/loaders/features/featureDependencies.js +0 -12
  216. package/src/loaders/features/features.js +3 -1
  217. package/src/loaders/micro-agent.js +4 -4
  218. package/dist/cjs/common/metrics/framework-detection.js +0 -72
  219. package/dist/cjs/common/util/user-agent.js +0 -57
  220. package/dist/cjs/common/window/supports-performance-observer.js +0 -15
  221. package/dist/esm/common/metrics/framework-detection.js +0 -66
  222. package/dist/esm/common/util/user-agent.js +0 -48
  223. package/dist/esm/common/window/supports-performance-observer.js +0 -9
  224. package/dist/types/common/metrics/framework-detection.d.ts.map +0 -1
  225. package/dist/types/common/util/user-agent.d.ts +0 -5
  226. package/dist/types/common/util/user-agent.d.ts.map +0 -1
  227. package/dist/types/common/window/supports-performance-observer.d.ts +0 -2
  228. package/dist/types/common/window/supports-performance-observer.d.ts.map +0 -1
  229. package/dist/types/features/utils/lazy-loader.d.ts.map +0 -1
  230. package/src/common/metrics/framework-detection.js +0 -71
  231. package/src/common/util/user-agent.js +0 -56
  232. package/src/common/window/supports-performance-observer.js +0 -10
  233. /package/dist/types/{common/metrics → features/metrics/aggregate}/framework-detection.d.ts +0 -0
@@ -6,91 +6,67 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Aggregate = void 0;
7
7
  var _registerHandler = require("../../../common/event-emitter/register-handler");
8
8
  var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
9
- var _mapOwn = require("../../../common/util/map-own");
10
9
  var _stringify = require("../../../common/util/stringify");
11
10
  var _parseUrl = require("../../../common/url/parse-url");
12
- var _supportsPerformanceObserver = require("../../../common/window/supports-performance-observer");
13
11
  var _config = require("../../../common/config/config");
14
12
  var _now = require("../../../common/timing/now");
15
13
  var _constants = require("../constants");
16
14
  var _drain = require("../../../common/drain/drain");
17
15
  var _handlerCache = require("../../utils/handler-cache");
18
- var _featureBase = require("../../utils/feature-base");
16
+ var _aggregateBase = require("../../utils/aggregate-base");
19
17
  /*
20
18
  * Copyright 2020 New Relic Corporation. All rights reserved.
21
19
  * SPDX-License-Identifier: Apache-2.0
22
20
  */
23
21
 
24
- class Aggregate extends _featureBase.FeatureBase {
22
+ const ignoredEvents = {
23
+ // we find that certain events make the data too noisy to be useful
24
+ global: {
25
+ mouseup: true,
26
+ mousedown: true
27
+ },
28
+ // certain events are present both in the window and in PVT metrics. PVT metrics are prefered so the window events should be ignored
29
+ window: {
30
+ load: true,
31
+ pagehide: true
32
+ },
33
+ // when ajax instrumentation is disabled, all XMLHttpRequest events will return with origin = xhrOriginMissing and should be ignored
34
+ xhrOriginMissing: {
35
+ ignoreAll: true
36
+ }
37
+ };
38
+ const toAggregate = {
39
+ typing: [1000, 2000],
40
+ scrolling: [100, 1000],
41
+ mousing: [1000, 2000],
42
+ touching: [1000, 2000]
43
+ };
44
+ const MAX_TRACE_DURATION = 15 * 60 * 1000; // 15 minutes
45
+
46
+ class Aggregate extends _aggregateBase.AggregateBase {
25
47
  static featureName = _constants.FEATURE_NAME;
26
- constructor(agentIdentifier, aggregator) {
48
+ constructor(agentIdentifier, aggregator, argsObj) {
27
49
  var _this;
28
50
  // Very unlikely, but in case the existing XMLHttpRequest.prototype object on the page couldn't be wrapped.
29
51
  super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
30
52
  _this = this;
31
53
  if (!(0, _config.getRuntime)(agentIdentifier).xhrWrappable) return;
32
- const handlerCache = new _handlerCache.HandlerCache();
54
+ this.resourceObserver = argsObj?.resourceObserver; // undefined if observer couldn't be created
33
55
  this.ptid = '';
34
- this.ignoredEvents = {
35
- // we find that certain events make the data too noisy to be useful
36
- global: {
37
- mouseup: true,
38
- mousedown: true
39
- },
40
- // certain events are present both in the window and in PVT metrics. PVT metrics are prefered so the window events should be ignored
41
- window: {
42
- load: true,
43
- pagehide: true
44
- },
45
- // when ajax instrumentation is disabled, all XMLHttpRequest events will return with origin = xhrOriginMissing and should be ignored
46
- xhrOriginMissing: {
47
- ignoreAll: true
48
- }
49
- };
50
- this.toAggregate = {
51
- typing: [1000, 2000],
52
- scrolling: [100, 1000],
53
- mousing: [1000, 2000],
54
- touching: [1000, 2000]
55
- };
56
- this.rename = {
57
- typing: {
58
- keydown: true,
59
- keyup: true,
60
- keypress: true
61
- },
62
- mousing: {
63
- mousemove: true,
64
- mouseenter: true,
65
- mouseleave: true,
66
- mouseover: true,
67
- mouseout: true
68
- },
69
- scrolling: {
70
- scroll: true
71
- },
72
- touching: {
73
- touchstart: true,
74
- touchmove: true,
75
- touchend: true,
76
- touchcancel: true,
77
- touchenter: true,
78
- touchleave: true
79
- }
80
- };
81
56
  this.trace = {};
82
57
  this.nodeCount = 0;
83
58
  this.sentTrace = null;
84
59
  this.harvestTimeSeconds = (0, _config.getConfigurationValue)(agentIdentifier, 'session_trace.harvestTimeSeconds') || 10;
85
60
  this.maxNodesPerHarvest = (0, _config.getConfigurationValue)(agentIdentifier, 'session_trace.maxNodesPerHarvest') || 1000;
86
61
  this.laststart = 0;
62
+ const handlerCache = new _handlerCache.HandlerCache();
87
63
  (0, _registerHandler.registerHandler)('feat-stn', () => {
88
64
  if (typeof PerformanceNavigationTiming !== 'undefined') {
89
- this.storeTiming(window.performance?.getEntriesByType('navigation')?.[0] || {});
65
+ this.storeTiming(window.performance.getEntriesByType('navigation')[0]);
90
66
  } else {
91
- this.storeTiming(window.performance?.timing);
67
+ this.storeTiming(window.performance.timing);
92
68
  }
93
- var scheduler = new _harvestScheduler.HarvestScheduler('resources', {
69
+ const scheduler = new _harvestScheduler.HarvestScheduler('resources', {
94
70
  onFinished: onHarvestFinished.bind(this),
95
71
  retryDelay: this.harvestTimeSeconds
96
72
  }, this);
@@ -98,38 +74,37 @@ class Aggregate extends _featureBase.FeatureBase {
98
74
  scheduler.runHarvest({
99
75
  needResponse: true
100
76
  }); // sends first stn harvest immediately
101
-
77
+ handlerCache.decide(true);
102
78
  function onHarvestFinished(result) {
103
- // start timer only if ptid was returned by server
104
79
  if (result.sent && result.responseText && !this.ptid) {
105
- this.ptid = result.responseText;
106
- (0, _config.getRuntime)(this.agentIdentifier).ptid = this.ptid;
80
+ // continue interval harvest only if ptid was returned by server on the first
81
+ (0, _config.getRuntime)(this.agentIdentifier).ptid = this.ptid = result.responseText;
107
82
  scheduler.startTimer(this.harvestTimeSeconds);
108
83
  }
109
84
  if (result.sent && result.retry && this.sentTrace) {
110
- (0, _mapOwn.mapOwn)(this.sentTrace, (name, nodes) => {
111
- this.mergeSTNs(name, nodes);
85
+ // merge previous trace back into buffer to retry for next harvest
86
+ Object.entries(this.sentTrace).forEach(_ref => {
87
+ let [name, listOfSTNodes] = _ref;
88
+ if (this.nodeCount >= this.maxNodesPerHarvest) return;
89
+ this.nodeCount += listOfSTNodes.length;
90
+ this.trace[name] = this.trace[name] ? listOfSTNodes.concat(this.trace[name]) : listOfSTNodes;
112
91
  });
113
92
  this.sentTrace = null;
114
93
  }
115
94
  }
116
95
  function prepareHarvest(options) {
117
- if ((0, _now.now)() > 15 * 60 * 1000) {
96
+ if ((0, _now.now)() > MAX_TRACE_DURATION) {
118
97
  // been collecting for over 15 min, empty trace object and bail
119
98
  scheduler.stopTimer();
120
99
  this.trace = {};
121
100
  return;
122
101
  }
123
-
124
- // only send when there are more than 30 nodes to send
102
+ // Only harvest when there are more than 30 nodes to send after the very first.
125
103
  if (this.ptid && this.nodeCount <= 30) return;
126
104
  return this.takeSTNs(options.retry);
127
105
  }
128
- handlerCache.decide(true);
129
- }, this.featureName, this.ee);
130
- (0, _registerHandler.registerHandler)('block-stn', () => {
131
- handlerCache.decide(false);
132
106
  }, this.featureName, this.ee);
107
+ (0, _registerHandler.registerHandler)('block-stn', () => handlerCache.decide(false), this.featureName, this.ee);
133
108
 
134
109
  // register the handlers immediately... but let the handlerCache decide if the data should actually get stored...
135
110
  (0, _registerHandler.registerHandler)('bst', function () {
@@ -182,19 +157,28 @@ class Aggregate extends _featureBase.FeatureBase {
182
157
  }, this.featureName, this.ee);
183
158
  (0, _drain.drain)(this.agentIdentifier, this.featureName);
184
159
  }
160
+
161
+ // PageViewTiming (FEATURE) events and metrics, such as 'load', 'lcp', etc. pipes into ST here.
185
162
  processPVT(name, value, attrs) {
186
- var t = {};
187
- t[name] = value;
188
- this.storeTiming(t);
189
- if (this.hasFID(name, attrs)) this.storeEvent({
163
+ this.storeTiming({
164
+ [name]: value
165
+ });
166
+ if (hasFID(name, attrs)) this.storeEvent({
190
167
  type: 'fid',
191
168
  target: 'document'
192
169
  }, 'document', value, value + attrs.fid);
170
+ function hasFID(name, attrs) {
171
+ return name === 'fi' && !!attrs && typeof attrs.fid === 'number';
172
+ }
193
173
  }
194
- storeTiming(_t) {
174
+
175
+ // This processes the aforementioned PVT and the first navigation entry of the page.
176
+ storeTiming(timingEntry) {
177
+ if (!timingEntry) return;
178
+
195
179
  // loop iterates through prototype also (for FF)
196
- for (let key in _t) {
197
- const val = _t[key];
180
+ for (let key in timingEntry) {
181
+ let val = timingEntry[key];
198
182
 
199
183
  // ignore size and status type nodes that do not map to timestamp metrics
200
184
  const lck = key.toLowerCase();
@@ -203,31 +187,33 @@ class Aggregate extends _featureBase.FeatureBase {
203
187
  // ignore inherited methods, meaningless 0 values, and bogus timestamps
204
188
  // that are in the future (Microsoft Edge seems to sometimes produce these)
205
189
  if (!(typeof val === 'number' && val >= 0)) continue;
206
- const timeOffset = Math.round(_t[key]);
190
+ val = Math.round(val);
207
191
  this.storeSTN({
208
192
  n: key,
209
- s: timeOffset,
210
- e: timeOffset,
193
+ s: val,
194
+ e: val,
211
195
  o: 'document',
212
196
  t: 'timing'
213
197
  });
214
198
  }
215
199
  }
200
+
201
+ // Tracks duration of native APIs wrapped by wrap-timer & wrap-raf.
216
202
  storeTimer(target, start, end, type) {
217
- var category = 'timer';
218
- if (type === 'requestAnimationFrame') category = type;
219
- var evt = {
203
+ const evt = {
220
204
  n: type,
221
205
  s: start,
222
206
  e: end,
223
207
  o: 'window',
224
- t: category
208
+ t: type === 'requestAnimationFrame' ? type : 'timer'
225
209
  };
226
210
  this.storeSTN(evt);
227
211
  }
212
+
213
+ // Tracks the events and their listener's duration on objects wrapped by wrap-events.
228
214
  storeEvent(currentEvent, target, start, end) {
229
- if (this.shouldIgnoreEvent(currentEvent, target)) return false;
230
- var evt = {
215
+ if (this.shouldIgnoreEvent(currentEvent, target)) return;
216
+ const evt = {
231
217
  n: this.evtName(currentEvent.type),
232
218
  s: start,
233
219
  e: end,
@@ -242,31 +228,60 @@ class Aggregate extends _featureBase.FeatureBase {
242
228
  }
243
229
  this.storeSTN(evt);
244
230
  }
231
+ shouldIgnoreEvent(event, target) {
232
+ const origin = this.evtOrigin(event.target, target);
233
+ if (event.type in ignoredEvents.global) return true;
234
+ if (!!ignoredEvents[origin] && ignoredEvents[origin].ignoreAll) return true;
235
+ if (!!ignoredEvents[origin] && event.type in ignoredEvents[origin]) return true;
236
+ return false;
237
+ }
245
238
  evtName(type) {
246
- var name = type;
247
- (0, _mapOwn.mapOwn)(this.rename, function (key, val) {
248
- if (type in val) name = key;
249
- });
250
- return name;
239
+ switch (type) {
240
+ case 'keydown':
241
+ case 'keyup':
242
+ case 'keypress':
243
+ return 'typing';
244
+ case 'mousemove':
245
+ case 'mouseenter':
246
+ case 'mouseleave':
247
+ case 'mouseover':
248
+ case 'mouseout':
249
+ return 'mousing';
250
+ case 'scroll':
251
+ return 'scrolling';
252
+ case 'touchstart':
253
+ case 'touchmove':
254
+ case 'touchend':
255
+ case 'touchcancel':
256
+ case 'touchenter':
257
+ case 'touchleave':
258
+ return 'touching';
259
+ default:
260
+ return type;
261
+ }
251
262
  }
252
263
  evtOrigin(t, target) {
253
- var origin = 'unknown';
264
+ let origin = 'unknown';
254
265
  if (t && t instanceof XMLHttpRequest) {
255
- var params = this.ee.context(t).params;
266
+ const params = this.ee.context(t).params;
256
267
  if (!params || !params.status || !params.method || !params.host || !params.pathname) return 'xhrOriginMissing';
257
268
  origin = params.status + ' ' + params.method + ': ' + params.host + params.pathname;
258
269
  } else if (t && typeof t.tagName === 'string') {
259
270
  origin = t.tagName.toLowerCase();
260
271
  if (t.id) origin += '#' + t.id;
261
- if (t.className) origin += '.' + Array.from(t.classList).join('.');
272
+ if (t.className) {
273
+ for (let i = 0; i < t.classList.length; i++) origin += '.' + t.classList[i];
274
+ }
262
275
  }
263
276
  if (origin === 'unknown') {
264
277
  if (typeof target === 'string') origin = target;else if (target === document) origin = 'document';else if (target === window) origin = 'window';else if (target instanceof FileReader) origin = 'FileReader';
265
278
  }
266
279
  return origin;
267
280
  }
281
+
282
+ // Tracks when the window history API specified by wrap-history is used.
268
283
  storeHist(path, old, time) {
269
- var node = {
284
+ const node = {
270
285
  n: 'history.pushState',
271
286
  s: time,
272
287
  e: time,
@@ -275,11 +290,15 @@ class Aggregate extends _featureBase.FeatureBase {
275
290
  };
276
291
  this.storeSTN(node);
277
292
  }
293
+
294
+ // Processes all the PerformanceResourceTiming entries captured (by observer).
278
295
  storeResources(resources) {
279
296
  if (!resources || resources.length === 0) return;
280
297
  resources.forEach(currentResource => {
281
- var parsed = (0, _parseUrl.parseUrl)(currentResource.name);
282
- var res = {
298
+ if ((currentResource.fetchStart | 0) <= this.laststart) return; // don't recollect already-seen resources
299
+
300
+ const parsed = (0, _parseUrl.parseUrl)(currentResource.name);
301
+ const res = {
283
302
  n: currentResource.initiatorType,
284
303
  s: currentResource.fetchStart | 0,
285
304
  e: currentResource.responseEnd | 0,
@@ -287,16 +306,15 @@ class Aggregate extends _featureBase.FeatureBase {
287
306
  // resource.name is actually a URL so it's the source
288
307
  t: currentResource.entryType
289
308
  };
290
-
291
- // don't recollect old resources
292
- if (res.s <= this.laststart) return;
293
309
  this.storeSTN(res);
294
310
  });
295
311
  this.laststart = resources[resources.length - 1].fetchStart | 0;
296
312
  }
313
+
314
+ // JavascriptError (FEATURE) events pipes into ST here.
297
315
  storeErrorAgg(type, name, params, metrics) {
298
- if (type !== 'err') return;
299
- var node = {
316
+ if (type !== 'err') return; // internal errors are purposefully ignored
317
+ const node = {
300
318
  n: 'error',
301
319
  s: metrics.time,
302
320
  e: metrics.time,
@@ -305,9 +323,11 @@ class Aggregate extends _featureBase.FeatureBase {
305
323
  };
306
324
  this.storeSTN(node);
307
325
  }
326
+
327
+ // Ajax (FEATURE) events--XML & fetches--pipes into ST here.
308
328
  storeXhrAgg(type, name, params, metrics) {
309
329
  if (type !== 'xhr') return;
310
- var node = {
330
+ const node = {
311
331
  n: 'Ajax',
312
332
  s: metrics.time,
313
333
  e: metrics.time + metrics.duration,
@@ -316,46 +336,46 @@ class Aggregate extends _featureBase.FeatureBase {
316
336
  };
317
337
  this.storeSTN(node);
318
338
  }
339
+
340
+ // Central function called by all the other store__ & addToTrace API to append a trace node.
319
341
  storeSTN(stn) {
320
- // limit the number of data that is stored
321
- if (this.nodeCount >= this.maxNodesPerHarvest) return;
322
- var traceArr = this.trace[stn.n];
323
- if (!traceArr) traceArr = this.trace[stn.n] = [];
324
- traceArr.push(stn);
342
+ if (this.nodeCount >= this.maxNodesPerHarvest) return; // limit the amount of data that is stored at once
343
+
344
+ if (this.trace[stn.n]) this.trace[stn.n].push(stn);else this.trace[stn.n] = [stn];
325
345
  this.nodeCount++;
326
346
  }
327
- mergeSTNs(key, nodes) {
328
- // limit the number of data that is stored
329
- if (this.nodeCount >= this.maxNodesPerHarvest) return;
330
- var traceArr = this.trace[key];
331
- if (!traceArr) traceArr = this.trace[key] = [];
332
- this.trace[key] = nodes.concat(traceArr);
333
- this.nodeCount += nodes.length;
334
- }
347
+
348
+ // Used by session trace's harvester to create the payload body.
335
349
  takeSTNs(retry) {
336
- // if the observer is not being used, this checks resourcetiming buffer every harvest
337
- if (!(0, _supportsPerformanceObserver.supportsPerformanceObserver)()) {
350
+ if (!this.resourceObserver) {
351
+ // if PO isn't supported, this checks resourcetiming buffer every harvest.
338
352
  this.storeResources(window.performance.getEntriesByType('resource'));
339
353
  }
340
- var stns = (0, _mapOwn.mapOwn)(this.trace, (name, nodes) => {
341
- if (!(name in this.toAggregate)) return nodes;
342
- return (0, _mapOwn.mapOwn)(nodes.sort(this.byStart).reduce(this.smearEvtsByOrigin(name), {}), this.val).reduce(this.flatten, []);
343
- }).reduce(this.flatten, []);
354
+ const stns = Object.entries(this.trace).flatMap(_ref2 => {
355
+ let [name, listOfSTNodes] = _ref2;
356
+ // basically take the "this.trace" map-obj and concat all the list-type values
357
+ if (!(name in toAggregate)) return listOfSTNodes;
358
+ // Special processing for event nodes dealing with user inputs:
359
+ const reindexByOriginFn = this.smearEvtsByOrigin(name);
360
+ const partitionListByOriginMap = listOfSTNodes.sort((a, b) => a.s - b.s).reduce(reindexByOriginFn, {});
361
+ return Object.values(partitionListByOriginMap).flat(); // join the partitions back into 1-D, now ordered by origin then start time
362
+ }, this);
344
363
  if (stns.length === 0) return {};
345
364
  if (retry) {
346
365
  this.sentTrace = this.trace;
347
366
  }
348
367
  this.trace = {};
349
368
  this.nodeCount = 0;
350
- var stnInfo = {
369
+ const stnInfo = {
351
370
  qs: {
352
- st: '' + (0, _config.getRuntime)(this.agentIdentifier).offset
371
+ st: String((0, _config.getRuntime)(this.agentIdentifier).offset)
353
372
  },
354
373
  body: {
355
374
  res: stns
356
375
  }
357
376
  };
358
377
  if (!this.ptid) {
378
+ // send custom and user attributes on the very first ST harvest only
359
379
  const {
360
380
  userAttributes,
361
381
  atts,
@@ -363,54 +383,35 @@ class Aggregate extends _featureBase.FeatureBase {
363
383
  } = (0, _config.getInfo)(this.agentIdentifier);
364
384
  stnInfo.qs.ua = userAttributes;
365
385
  stnInfo.qs.at = atts;
366
- var ja = (0, _stringify.stringify)(jsAttributes);
386
+ const ja = (0, _stringify.stringify)(jsAttributes);
367
387
  stnInfo.qs.ja = ja === '{}' ? null : ja;
368
388
  }
369
389
  return stnInfo;
370
390
  }
371
- byStart(a, b) {
372
- return a.s - b.s;
373
- }
374
391
  smearEvtsByOrigin(name) {
375
- var maxGap = this.toAggregate[name][0];
376
- var maxLen = this.toAggregate[name][1];
377
- var lastO = {};
378
- return (byOrigin, evt) => {
379
- var lastArr = byOrigin[evt.o];
380
- lastArr || (lastArr = byOrigin[evt.o] = []);
381
- var last = lastO[evt.o];
382
- if (name === 'scrolling' && !this.trivial(evt)) {
383
- lastO[evt.o] = null;
384
- evt.n = 'scroll';
385
- lastArr.push(evt);
386
- } else if (last && evt.s - last.s < maxLen && last.e > evt.s - maxGap) {
387
- last.e = evt.e;
392
+ const maxGap = toAggregate[name][0];
393
+ const maxLen = toAggregate[name][1];
394
+ const lastO = {};
395
+ return (byOrigin, evtNode) => {
396
+ let lastArr = byOrigin[evtNode.o];
397
+ if (!lastArr) lastArr = byOrigin[evtNode.o] = [];
398
+ const last = lastO[evtNode.o];
399
+ if (name === 'scrolling' && !trivial(evtNode)) {
400
+ lastO[evtNode.o] = null;
401
+ evtNode.n = 'scroll';
402
+ lastArr.push(evtNode);
403
+ } else if (last && evtNode.s - last.s < maxLen && last.e > evtNode.s - maxGap) {
404
+ last.e = evtNode.e;
388
405
  } else {
389
- lastO[evt.o] = evt;
390
- lastArr.push(evt);
406
+ lastO[evtNode.o] = evtNode;
407
+ lastArr.push(evtNode);
391
408
  }
392
409
  return byOrigin;
393
410
  };
394
- }
395
- val(key, value) {
396
- return value;
397
- }
398
- flatten(a, b) {
399
- return a.concat(b);
400
- }
401
- hasFID(name, attrs) {
402
- return name === 'fi' && !!attrs && typeof attrs.fid === 'number';
403
- }
404
- trivial(node) {
405
- var limit = 4;
406
- if (node && typeof node.e === 'number' && typeof node.s === 'number' && node.e - node.s < limit) return true;else return false;
407
- }
408
- shouldIgnoreEvent(event, target) {
409
- var origin = this.evtOrigin(event.target, target);
410
- if (event.type in this.ignoredEvents.global) return true;
411
- if (!!this.ignoredEvents[origin] && this.ignoredEvents[origin].ignoreAll) return true;
412
- if (!!this.ignoredEvents[origin] && event.type in this.ignoredEvents[origin]) return true;
413
- return false;
411
+ function trivial(node) {
412
+ const limit = 4;
413
+ if (node && typeof node.e === 'number' && typeof node.s === 'number' && node.e - node.s < limit) return true;else return false;
414
+ }
414
415
  }
415
416
  }
416
417
  exports.Aggregate = Aggregate;
@@ -3,13 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.START = exports.RESOURCE_TIMING_BUFFER_FULL = exports.RESOURCE = exports.PUSH_STATE = exports.ORIG_EVENT = exports.FN_START = exports.FN_END = exports.FEATURE_NAME = exports.END = exports.BST_TIMER = exports.BST_RESOURCE = exports.ADD_EVENT_LISTENER = void 0;
7
- var _config = require("../../common/config/config");
6
+ exports.START = exports.RESOURCE = exports.PUSH_STATE = exports.FN_START = exports.FN_END = exports.FEATURE_NAME = exports.END = exports.BST_TIMER = exports.BST_RESOURCE = void 0;
8
7
  var _features = require("../../loaders/features/features");
9
8
  const FEATURE_NAME = _features.FEATURE_NAMES.sessionTrace;
10
9
  exports.FEATURE_NAME = FEATURE_NAME;
11
- const RESOURCE_TIMING_BUFFER_FULL = 'resourcetimingbufferfull';
12
- exports.RESOURCE_TIMING_BUFFER_FULL = RESOURCE_TIMING_BUFFER_FULL;
13
10
  const BST_RESOURCE = 'bstResource';
14
11
  exports.BST_RESOURCE = BST_RESOURCE;
15
12
  const RESOURCE = 'resource';
@@ -25,8 +22,4 @@ exports.FN_END = FN_END;
25
22
  const BST_TIMER = 'bstTimer';
26
23
  exports.BST_TIMER = BST_TIMER;
27
24
  const PUSH_STATE = 'pushState';
28
- exports.PUSH_STATE = PUSH_STATE;
29
- const ORIG_EVENT = _config.originals.EV;
30
- exports.ORIG_EVENT = ORIG_EVENT;
31
- const ADD_EVENT_LISTENER = 'addEventListener';
32
- exports.ADD_EVENT_LISTENER = ADD_EVENT_LISTENER;
25
+ exports.PUSH_STATE = PUSH_STATE;
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.Instrument = void 0;
7
7
  var _handle = require("../../../common/event-emitter/handle");
8
8
  var _wrap = require("../../../common/wrap");
9
- var _supportsPerformanceObserver = require("../../../common/window/supports-performance-observer");
10
- var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
11
9
  var _now = require("../../../common/timing/now");
12
10
  var _instrumentBase = require("../../utils/instrument-base");
13
11
  var CONSTANTS = _interopRequireWildcard(require("../constants"));
@@ -22,19 +20,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
22
20
 
23
21
  const {
24
22
  BST_RESOURCE,
23
+ RESOURCE,
25
24
  BST_TIMER,
25
+ START,
26
26
  END,
27
27
  FEATURE_NAME,
28
28
  FN_END,
29
29
  FN_START,
30
- ADD_EVENT_LISTENER,
31
- PUSH_STATE,
32
- RESOURCE,
33
- RESOURCE_TIMING_BUFFER_FULL,
34
- START,
35
- ORIG_EVENT: origEvent
30
+ PUSH_STATE
36
31
  } = CONSTANTS;
37
- const CRT = 'clearResourceTimings';
38
32
  class Instrument extends _instrumentBase.InstrumentBase {
39
33
  static featureName = FEATURE_NAME;
40
34
  constructor(agentIdentifier, aggregator) {
@@ -46,20 +40,14 @@ class Instrument extends _instrumentBase.InstrumentBase {
46
40
  this.timerEE = (0, _wrap.wrapTimer)(thisInstrumentEE);
47
41
  this.rafEE = (0, _wrap.wrapRaf)(thisInstrumentEE);
48
42
  (0, _wrap.wrapHistory)(thisInstrumentEE);
49
- (0, _wrap.wrapEvents)(thisInstrumentEE);
50
- thisInstrumentEE.on(FN_START, function (args, target) {
51
- var evt = args[0];
52
- if (evt instanceof origEvent) {
53
- this.bstStart = (0, _now.now)();
54
- }
43
+ this.eventsEE = (0, _wrap.wrapEvents)(thisInstrumentEE);
44
+ this.eventsEE.on(FN_START, function (args, target) {
45
+ this.bstStart = (0, _now.now)();
55
46
  });
56
- thisInstrumentEE.on(FN_END, function (args, target) {
57
- var evt = args[0];
58
- if (evt instanceof origEvent) {
59
- // ISSUE: when target is XMLHttpRequest, nr@context should have params so we can calculate event origin
60
- // When ajax is disabled, this may fail without making ajax a dependency of session_trace
61
- (0, _handle.handle)('bst', [evt, target, this.bstStart, (0, _now.now)()], undefined, _features.FEATURE_NAMES.sessionTrace, thisInstrumentEE);
62
- }
47
+ this.eventsEE.on(FN_END, function (args, target) {
48
+ // ISSUE: when target is XMLHttpRequest, nr@context should have params so we can calculate event origin
49
+ // When ajax is disabled, this may fail without making ajax a dependency of session_trace
50
+ (0, _handle.handle)('bst', [args[0], target, this.bstStart, (0, _now.now)()], undefined, _features.FEATURE_NAMES.sessionTrace, thisInstrumentEE);
63
51
  });
64
52
  this.timerEE.on(FN_START, function (args, obj, type) {
65
53
  this.bstStart = (0, _now.now)();
@@ -81,54 +69,24 @@ class Instrument extends _instrumentBase.InstrumentBase {
81
69
  thisInstrumentEE.on(PUSH_STATE + END, function (args) {
82
70
  (0, _handle.handle)('bstHist', [location.pathname + location.hash, this.startPath, this.time], undefined, _features.FEATURE_NAMES.sessionTrace, thisInstrumentEE);
83
71
  });
84
- if ((0, _supportsPerformanceObserver.supportsPerformanceObserver)()) {
85
- // capture initial resources, in case our observer missed anything
86
- (0, _handle.handle)(BST_RESOURCE, [window.performance.getEntriesByType('resource')], undefined, _features.FEATURE_NAMES.sessionTrace, thisInstrumentEE);
87
- observeResourceTimings();
88
- } else {
89
- // collect resource timings once when buffer is full
90
- if (window.performance[CRT] && window.performance[ADD_EVENT_LISTENER]) {
91
- window.performance.addEventListener(RESOURCE_TIMING_BUFFER_FULL, this.onResourceTimingBufferFull, (0, _eventListenerOpts.eventListenerOpts)(false));
92
- }
93
- }
94
- function observeResourceTimings() {
95
- var observer = new PerformanceObserver((list, observer) => {
72
+ let observer;
73
+ try {
74
+ // Capture initial resources and watch for future ones. Don't defer this given there's a default cap on the number of buffered entries.
75
+ observer = new PerformanceObserver(list => {
96
76
  // eslint-disable-line no-undef
97
- var entries = list.getEntries();
77
+ const entries = list.getEntries();
98
78
  (0, _handle.handle)(BST_RESOURCE, [entries], undefined, _features.FEATURE_NAMES.sessionTrace, thisInstrumentEE);
99
79
  });
100
- try {
101
- observer.observe({
102
- entryTypes: ['resource']
103
- });
104
- } catch (e) {
105
- // do nothing
106
- }
107
- }
108
- document.addEventListener('scroll', this.noOp, (0, _eventListenerOpts.eventListenerOpts)(false));
109
- document.addEventListener('keypress', this.noOp, (0, _eventListenerOpts.eventListenerOpts)(false));
110
- document.addEventListener('click', this.noOp, (0, _eventListenerOpts.eventListenerOpts)(false));
111
- this.abortHandler = this.#abort;
112
- this.importAggregator();
113
- }
114
-
115
- /** Restoration and resource release tasks to be done if Session trace loader is being aborted. Unwind changes to globals. */
116
- #abort() {
117
- window.performance.removeEventListener(RESOURCE_TIMING_BUFFER_FULL, this.onResourceTimingBufferFull, false);
118
- // The doc interaction noOp listeners are harmless--cannot buffer data into EE.
119
- this.abortHandler = undefined; // weakly allow this abort op to run only once
120
- }
121
-
122
- noOp(e) {/* no-op */}
123
- onResourceTimingBufferFull(evt) {
124
- (0, _handle.handle)(BST_RESOURCE, [window.performance.getEntriesByType(RESOURCE)], undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
125
-
126
- // stop recording once buffer is full
127
- if (window.performance[CRT]) {
128
- try {
129
- window.performance.removeEventListener(RESOURCE_TIMING_BUFFER_FULL, this.onResourceTimingBufferFull, false);
130
- } catch (e) {}
80
+ observer.observe({
81
+ type: RESOURCE,
82
+ buffered: true
83
+ });
84
+ } catch (e) {
85
+ // Per NEWRELIC-8525, we don't have a fallback for capturing resources for older versions that don't support PO at this time.
131
86
  }
87
+ this.importAggregator({
88
+ resourceObserver: observer
89
+ });
132
90
  }
133
91
  }
134
92
  exports.Instrument = Instrument;