@newrelic/browser-agent 1.260.0 → 1.260.1

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 (38) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/common/constants/env.cdn.js +1 -1
  3. package/dist/cjs/common/constants/env.npm.js +1 -1
  4. package/dist/cjs/common/constants/runtime.js +2 -1
  5. package/dist/cjs/common/timing/time-keeper.js +2 -2
  6. package/dist/cjs/features/session_trace/aggregate/index.js +1 -0
  7. package/dist/cjs/features/session_trace/aggregate/trace/storage.js +1 -1
  8. package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -2
  9. package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -1
  10. package/dist/cjs/features/soft_navigations/aggregate/interaction.js +5 -4
  11. package/dist/esm/common/constants/env.cdn.js +1 -1
  12. package/dist/esm/common/constants/env.npm.js +1 -1
  13. package/dist/esm/common/constants/runtime.js +3 -1
  14. package/dist/esm/common/timing/time-keeper.js +2 -2
  15. package/dist/esm/features/session_trace/aggregate/index.js +1 -0
  16. package/dist/esm/features/session_trace/aggregate/trace/storage.js +1 -1
  17. package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -2
  18. package/dist/esm/features/soft_navigations/aggregate/index.js +1 -1
  19. package/dist/esm/features/soft_navigations/aggregate/interaction.js +5 -4
  20. package/dist/types/common/constants/runtime.d.ts +0 -6
  21. package/dist/types/common/constants/runtime.d.ts.map +1 -1
  22. package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
  23. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  24. package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
  25. package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +0 -1
  26. package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
  27. package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts +1 -1
  28. package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts.map +1 -1
  29. package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +0 -1
  30. package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -1
  31. package/package.json +2 -1
  32. package/src/common/constants/runtime.js +3 -1
  33. package/src/common/timing/time-keeper.js +2 -2
  34. package/src/features/session_trace/aggregate/index.js +1 -0
  35. package/src/features/session_trace/aggregate/trace/storage.js +1 -2
  36. package/src/features/soft_navigations/aggregate/bel-node.js +1 -3
  37. package/src/features/soft_navigations/aggregate/index.js +1 -1
  38. package/src/features/soft_navigations/aggregate/interaction.js +5 -4
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.260.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.260.0...v1.260.1) (2024-05-16)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Undefined stns in blob Trace ([#1039](https://github.com/newrelic/newrelic-browser-agent/issues/1039)) ([1a87991](https://github.com/newrelic/newrelic-browser-agent/commit/1a87991143aa1f220ae29edbf1e8ea89598bcc44))
12
+
6
13
  ## [1.260.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.259.0...v1.260.0) (2024-05-13)
7
14
 
8
15
 
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = exports.VERSION = "1.260.0";
15
+ const VERSION = exports.VERSION = "1.260.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = exports.VERSION = "1.260.0";
15
+ const VERSION = exports.VERSION = "1.260.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.supportsSendBeacon = exports.originTime = exports.loadedAsDeferredBrowserScript = exports.isiOS = exports.isWorkerScope = exports.isIE = exports.isBrowserScope = exports.initiallyHidden = exports.initialLocation = exports.iOSBelow16 = exports.globalScope = exports.ffVersion = void 0;
7
+ var _now = require("../timing/now");
7
8
  /**
8
9
  * @file Contains constants about the environment the agent is running
9
10
  * within. These values are derived at the time the agent is first loaded.
@@ -50,4 +51,4 @@ const supportsSendBeacon = exports.supportsSendBeacon = !!globalScope.navigator?
50
51
  * according to the browser's local clock.
51
52
  * @type {number}
52
53
  */
53
- const originTime = exports.originTime = Math.floor(Date.now() - performance.now());
54
+ const originTime = exports.originTime = Date.now() - (0, _now.now)();
@@ -62,7 +62,7 @@ class TimeKeeper {
62
62
  throw new Error('Missing date header on rum response.');
63
63
  }
64
64
  const medianRumOffset = (endTime - startTime) / 2;
65
- const serverOffset = Math.floor(startTime + medianRumOffset);
65
+ const serverOffset = startTime + medianRumOffset;
66
66
 
67
67
  // Corrected page origin time
68
68
  this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
@@ -83,7 +83,7 @@ class TimeKeeper {
83
83
  * @returns {number} Corrected unix/epoch timestamp
84
84
  */
85
85
  convertRelativeTimestamp(relativeTime) {
86
- return this.#correctedOriginTime + relativeTime;
86
+ return Math.floor(this.#correctedOriginTime + relativeTime);
87
87
  }
88
88
 
89
89
  /**
@@ -137,6 +137,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
137
137
  earliestTimeStamp,
138
138
  latestTimeStamp
139
139
  } = this.traceStorage.takeSTNs();
140
+ if (!stns) return; // there are no trace nodes
140
141
  if (options.retry) {
141
142
  this.sentTrace = stns;
142
143
  }
@@ -278,7 +278,7 @@ class TraceStorage {
278
278
  // Ajax (FEATURE) events--XML & fetches--pipes into ST here.
279
279
  storeXhrAgg(type, name, params, metrics) {
280
280
  if (type !== 'xhr') return;
281
- this.storeSTN(new _node.TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, "".concat(params.status, " ").concat(params.method, ": ").concat(params.host).concat(params.pathname)));
281
+ this.storeSTN(new _node.TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, "".concat(params.status, " ").concat(params.method, ": ").concat(params.host).concat(params.pathname), 'ajax'));
282
282
  }
283
283
  restoreNode(name, listOfSTNodes) {
284
284
  if (this.nodeCount >= _constants2.MAX_NODES_PER_HARVEST) return;
@@ -4,13 +4,12 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.BelNode = void 0;
7
- var _now = require("../../../common/timing/now");
8
7
  let nodesSeen = 0;
9
8
  class BelNode {
10
9
  belType;
11
10
  /** List of other BelNode derivatives. Each children should be of a subclass that implements its own 'serialize' function. */
12
11
  children = [];
13
- start = (0, _now.now)();
12
+ start;
14
13
  end;
15
14
  callbackEnd = 0;
16
15
  callbackDuration = 0;
@@ -67,7 +67,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
67
67
  });
68
68
 
69
69
  // By default, a complete UI driven interaction requires event -> URL change -> DOM mod in that exact order.
70
- (0, _registerHandler.registerHandler)('newUIEvent', event => this.startUIInteraction(event.type, event.timeStamp, event.target), this.featureName, this.ee);
70
+ (0, _registerHandler.registerHandler)('newUIEvent', event => this.startUIInteraction(event.type, Math.floor(event.timeStamp), event.target), this.featureName, this.ee);
71
71
  (0, _registerHandler.registerHandler)('newURL', (timestamp, url) => this.interactionInProgress?.updateHistory(timestamp, url), this.featureName, this.ee);
72
72
  (0, _registerHandler.registerHandler)('newDom', timestamp => {
73
73
  this.interactionInProgress?.updateDom(timestamp);
@@ -8,6 +8,7 @@ var _config = require("../../../common/config/config");
8
8
  var _runtime = require("../../../common/constants/runtime");
9
9
  var _uniqueId = require("../../../common/ids/unique-id");
10
10
  var _belSerializer = require("../../../common/serialize/bel-serializer");
11
+ var _now = require("../../../common/timing/now");
11
12
  var _cleanUrl = require("../../../common/url/clean-url");
12
13
  var _constants = require("../constants");
13
14
  var _belNode = require("./bel-node");
@@ -44,11 +45,11 @@ class Interaction extends _belNode.BelNode {
44
45
  if (this.trigger === _constants.API_TRIGGER_NAME) this.createdByApi = true;
45
46
  }
46
47
  updateDom(timestamp) {
47
- this.domTimestamp = timestamp || performance.now(); // default timestamp should be precise for accurate isActiveDuring calculations
48
+ this.domTimestamp = timestamp || (0, _now.now)(); // default timestamp should be precise for accurate isActiveDuring calculations
48
49
  }
49
50
  updateHistory(timestamp, newUrl) {
50
51
  this.newURL = newUrl || '' + _runtime.globalScope?.location;
51
- this.historyTimestamp = timestamp || performance.now();
52
+ this.historyTimestamp = timestamp || (0, _now.now)();
52
53
  }
53
54
  seenHistoryAndDomChange() {
54
55
  return this.historyTimestamp > 0 && this.domTimestamp > this.historyTimestamp; // URL must change before DOM does
@@ -118,9 +119,9 @@ class Interaction extends _belNode.BelNode {
118
119
  // IMPORTANT: The order in which addString is called matters and correlates to the order in which string shows up in the harvest payload. Do not re-order the following code.
119
120
  const fields = [(0, _belSerializer.numeric)(this.belType), 0,
120
121
  // this will be overwritten below with number of attached nodes
121
- (0, _belSerializer.numeric)(Math.floor(this.start - firstStartTimeOfPayload)),
122
+ (0, _belSerializer.numeric)(this.start - firstStartTimeOfPayload),
122
123
  // relative to first node
123
- (0, _belSerializer.numeric)(Math.floor(this.end - this.start)),
124
+ (0, _belSerializer.numeric)(this.end - this.start),
124
125
  // end -- relative to start
125
126
  (0, _belSerializer.numeric)(this.callbackEnd),
126
127
  // cbEnd -- relative to start; not used by BrowserInteraction events
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.260.0";
9
+ export const VERSION = "1.260.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.260.0";
9
+ export const VERSION = "1.260.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -5,6 +5,8 @@
5
5
  * @license Apache-2.0
6
6
  */
7
7
 
8
+ import { now } from '../timing/now';
9
+
8
10
  /**
9
11
  * Indicates if the agent is running within a normal browser window context.
10
12
  */
@@ -44,4 +46,4 @@ export const supportsSendBeacon = !!globalScope.navigator?.sendBeacon;
44
46
  * according to the browser's local clock.
45
47
  * @type {number}
46
48
  */
47
- export const originTime = Math.floor(Date.now() - performance.now());
49
+ export const originTime = Date.now() - now();
@@ -57,7 +57,7 @@ export class TimeKeeper {
57
57
  throw new Error('Missing date header on rum response.');
58
58
  }
59
59
  const medianRumOffset = (endTime - startTime) / 2;
60
- const serverOffset = Math.floor(startTime + medianRumOffset);
60
+ const serverOffset = startTime + medianRumOffset;
61
61
 
62
62
  // Corrected page origin time
63
63
  this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset);
@@ -78,7 +78,7 @@ export class TimeKeeper {
78
78
  * @returns {number} Corrected unix/epoch timestamp
79
79
  */
80
80
  convertRelativeTimestamp(relativeTime) {
81
- return this.#correctedOriginTime + relativeTime;
81
+ return Math.floor(this.#correctedOriginTime + relativeTime);
82
82
  }
83
83
 
84
84
  /**
@@ -131,6 +131,7 @@ export class Aggregate extends AggregateBase {
131
131
  earliestTimeStamp,
132
132
  latestTimeStamp
133
133
  } = this.traceStorage.takeSTNs();
134
+ if (!stns) return; // there are no trace nodes
134
135
  if (options.retry) {
135
136
  this.sentTrace = stns;
136
137
  }
@@ -272,7 +272,7 @@ export class TraceStorage {
272
272
  // Ajax (FEATURE) events--XML & fetches--pipes into ST here.
273
273
  storeXhrAgg(type, name, params, metrics) {
274
274
  if (type !== 'xhr') return;
275
- this.storeSTN(new TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, "".concat(params.status, " ").concat(params.method, ": ").concat(params.host).concat(params.pathname)));
275
+ this.storeSTN(new TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, "".concat(params.status, " ").concat(params.method, ": ").concat(params.host).concat(params.pathname), 'ajax'));
276
276
  }
277
277
  restoreNode(name, listOfSTNodes) {
278
278
  if (this.nodeCount >= MAX_NODES_PER_HARVEST) return;
@@ -1,10 +1,9 @@
1
- import { now } from '../../../common/timing/now';
2
1
  let nodesSeen = 0;
3
2
  export class BelNode {
4
3
  belType;
5
4
  /** List of other BelNode derivatives. Each children should be of a subclass that implements its own 'serialize' function. */
6
5
  children = [];
7
- start = now();
6
+ start;
8
7
  end;
9
8
  callbackEnd = 0;
10
9
  callbackDuration = 0;
@@ -61,7 +61,7 @@ export class Aggregate extends AggregateBase {
61
61
  });
62
62
 
63
63
  // By default, a complete UI driven interaction requires event -> URL change -> DOM mod in that exact order.
64
- registerHandler('newUIEvent', event => this.startUIInteraction(event.type, event.timeStamp, event.target), this.featureName, this.ee);
64
+ registerHandler('newUIEvent', event => this.startUIInteraction(event.type, Math.floor(event.timeStamp), event.target), this.featureName, this.ee);
65
65
  registerHandler('newURL', (timestamp, url) => this.interactionInProgress?.updateHistory(timestamp, url), this.featureName, this.ee);
66
66
  registerHandler('newDom', timestamp => {
67
67
  this.interactionInProgress?.updateDom(timestamp);
@@ -2,6 +2,7 @@ import { getInfo } from '../../../common/config/config';
2
2
  import { globalScope, initialLocation } from '../../../common/constants/runtime';
3
3
  import { generateUuid } from '../../../common/ids/unique-id';
4
4
  import { addCustomAttributes, getAddStringContext, nullable, numeric } from '../../../common/serialize/bel-serializer';
5
+ import { now } from '../../../common/timing/now';
5
6
  import { cleanURL } from '../../../common/url/clean-url';
6
7
  import { NODE_TYPE, INTERACTION_STATUS, INTERACTION_TYPE, API_TRIGGER_NAME } from '../constants';
7
8
  import { BelNode } from './bel-node';
@@ -39,11 +40,11 @@ export class Interaction extends BelNode {
39
40
  if (this.trigger === API_TRIGGER_NAME) this.createdByApi = true;
40
41
  }
41
42
  updateDom(timestamp) {
42
- this.domTimestamp = timestamp || performance.now(); // default timestamp should be precise for accurate isActiveDuring calculations
43
+ this.domTimestamp = timestamp || now(); // default timestamp should be precise for accurate isActiveDuring calculations
43
44
  }
44
45
  updateHistory(timestamp, newUrl) {
45
46
  this.newURL = newUrl || '' + globalScope?.location;
46
- this.historyTimestamp = timestamp || performance.now();
47
+ this.historyTimestamp = timestamp || now();
47
48
  }
48
49
  seenHistoryAndDomChange() {
49
50
  return this.historyTimestamp > 0 && this.domTimestamp > this.historyTimestamp; // URL must change before DOM does
@@ -113,9 +114,9 @@ export class Interaction extends BelNode {
113
114
  // IMPORTANT: The order in which addString is called matters and correlates to the order in which string shows up in the harvest payload. Do not re-order the following code.
114
115
  const fields = [numeric(this.belType), 0,
115
116
  // this will be overwritten below with number of attached nodes
116
- numeric(Math.floor(this.start - firstStartTimeOfPayload)),
117
+ numeric(this.start - firstStartTimeOfPayload),
117
118
  // relative to first node
118
- numeric(Math.floor(this.end - this.start)),
119
+ numeric(this.end - this.start),
119
120
  // end -- relative to start
120
121
  numeric(this.callbackEnd),
121
122
  // cbEnd -- relative to start; not used by BrowserInteraction events
@@ -1,9 +1,3 @@
1
- /**
2
- * @file Contains constants about the environment the agent is running
3
- * within. These values are derived at the time the agent is first loaded.
4
- * @copyright 2023 New Relic Corporation. All rights reserved.
5
- * @license Apache-2.0
6
- */
7
1
  /**
8
2
  * Indicates if the agent is running within a normal browser window context.
9
3
  */
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,oDAA6F;AAE7F,sCAA2F;AAE3F,qCAAyD;AAEzD,4BAA8E;AAE9E;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,yCAAqE;AAErE;;;;GAIG;AACH,yBAFU,MAAM,CAEoD"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AASA;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,oDAA6F;AAE7F,sCAA2F;AAE3F,qCAAyD;AAEzD,4BAA8E;AAE9E;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,yCAAqE;AAErE;;;;GAIG;AACH,yBAFU,MAAM,CAE4B"}
@@ -4,7 +4,7 @@ export class Aggregate extends AggregateBase {
4
4
  agentRuntime: any;
5
5
  agentInfo: any;
6
6
  /** A buffer to hold on to harvested traces in the case that a retry must be made later */
7
- sentTrace: any[] | null | undefined;
7
+ sentTrace: any[] | null;
8
8
  harvestTimeSeconds: any;
9
9
  /** Tied to the entitlement flag response from BCS. Will short circuit operations of the agg if false */
10
10
  entitled: any;
@@ -31,7 +31,7 @@ export class Aggregate extends AggregateBase {
31
31
  timestamp: any;
32
32
  attributes: string;
33
33
  };
34
- body: any[] | undefined;
34
+ body: any[];
35
35
  } | undefined;
36
36
  /** When the harvest scheduler finishes, this callback is executed. It's main purpose is to determine if the payload needs to be retried
37
37
  * and if so, it will take all data from the temporary buffer and place it back into the traceStorage module
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAcA;IACE,2BAAiC;IAEjC,mDAmBC;IAjBC,kBAA+C;IAC/C,eAAyC;IAEzC,0FAA0F;IAC1F,oCAAqB;IACrB,wBAA0G;IAC1G,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,wIAAwI;IACxI,2BAA0C;IAM5C,gLAAgL;IAChL,mEA6DC;IA1CyD,UAA4D;IAGpH,iCAAuB;IAOvB,wCAKQ;IA6BV,kJAAkJ;IAClJ,wBAIC;IAED,iJAAiJ;IACjJ;;;;;;;;;;kBA4DC;IAED;;OAEG;IACH,qCAKC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,cAKC;CACF;8BAtM6B,4BAA4B;6BAC7B,iBAAiB;iCAJb,2CAA2C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAcA;IACE,2BAAiC;IAEjC,mDAmBC;IAjBC,kBAA+C;IAC/C,eAAyC;IAEzC,0FAA0F;IAC1F,wBAAqB;IACrB,wBAA0G;IAC1G,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,wIAAwI;IACxI,2BAA0C;IAM5C,gLAAgL;IAChL,mEA6DC;IA1CyD,UAA4D;IAGpH,iCAAuB;IAOvB,wCAKQ;IA6BV,kJAAkJ;IAClJ,wBAIC;IAED,iJAAiJ;IACjJ;;;;;;;;;;kBA6DC;IAED;;OAEG;IACH,qCAKC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,cAKC;CACF;8BAvM6B,4BAA4B;6BAC7B,iBAAiB;iCAJb,2CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/session_trace/aggregate/trace/storage.js"],"names":[],"mappings":"AAyBA,+HAA+H;AAC/H;IAQE,yBAEC;IATD,kBAAa;IACb,UAAU;IACV,0BAA4B;IAC5B,wBAAmB;IACnB,mBAAgB;IAChB,2BAA4B;IAG1B,YAAoB;IAGtB,gGAAgG;IAChG,yBAiBC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAED,oEAAoE;IACpE;;;;;;;;MAsBC;IAED,mEA6BC;IAED,oDAOC;IAED,oCAkBC;IAGD,uEAcC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDAEC;IAID,qCAaC;IAGD,qEAGC;IAGD,mEAIC;IAED,iDAKC;;CACF"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../../src/features/session_trace/aggregate/trace/storage.js"],"names":[],"mappings":"AAyBA,+HAA+H;AAC/H;IAQE,yBAEC;IATD,kBAAa;IACb,UAAU;IACV,0BAA4B;IAC5B,wBAAmB;IACnB,mBAAgB;IAChB,2BAA4B;IAG1B,YAAoB;IAGtB,gGAAgG;IAChG,yBAiBC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAED,oEAAoE;IACpE;;;;;;;;MAsBC;IAED,mEA6BC;IAED,oDAOC;IAED,oCAkBC;IAGD,uEAcC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDAEC;IAID,qCAaC;IAGD,qEAGC;IAGD,mEAGC;IAED,iDAKC;;CACF"}
@@ -12,7 +12,6 @@ export class AjaxNode extends BelNode {
12
12
  traceId: any;
13
13
  spanTimestamp: any;
14
14
  gql: any;
15
- start: any;
16
15
  serialize(parentStartTimestamp: any): string;
17
16
  }
18
17
  import { BelNode } from './bel-node';
@@ -1 +1 @@
1
- {"version":3,"file":"ajax-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/ajax-node.js"],"names":[],"mappings":"AAIA;IACE,kDAiBC;IAfC,gBAA6B;IAC7B,YAA8B;IAC9B,YAA8B;IAC9B,YAA8B;IAC9B,UAA0B;IAC1B,YAAmC;IACnC,YAAoC;IACpC,+BAAwD;IACxD,YAA8B;IAC9B,aAAgC;IAChC,mBAA4C;IAC5C,SAAwB;IAExB,WAAgC;IAIlC,6CA+BC;CACF;wBAtDuB,YAAY"}
1
+ {"version":3,"file":"ajax-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/ajax-node.js"],"names":[],"mappings":"AAIA;IACE,kDAiBC;IAfC,gBAA6B;IAC7B,YAA8B;IAC9B,YAA8B;IAC9B,YAA8B;IAC9B,UAA0B;IAC1B,YAAmC;IACnC,YAAoC;IACpC,+BAAwD;IACxD,YAA8B;IAC9B,aAAgC;IAChC,mBAA4C;IAC5C,SAAwB;IAM1B,6CA+BC;CACF;wBAtDuB,YAAY"}
@@ -3,7 +3,7 @@ export class BelNode {
3
3
  belType: any;
4
4
  /** List of other BelNode derivatives. Each children should be of a subclass that implements its own 'serialize' function. */
5
5
  children: any[];
6
- start: number;
6
+ start: any;
7
7
  end: any;
8
8
  callbackEnd: number;
9
9
  callbackDuration: number;
@@ -1 +1 @@
1
- {"version":3,"file":"bel-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/bel-node.js"],"names":[],"mappings":"AAIA;IAUE,kCAGC;IAZD,aAAO;IACP,6HAA6H;IAC7H,gBAAa;IACb,cAAa;IACb,SAAG;IACH,oBAAe;IACf,yBAAoB;IACpB,eAAoB;IAIlB,qBAAsC;IAGxC,2BAEC;IAED,+CAA+C;IAC/C,kBAAe;CAChB"}
1
+ {"version":3,"file":"bel-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/bel-node.js"],"names":[],"mappings":"AAEA;IAUE,kCAGC;IAZD,aAAO;IACP,6HAA6H;IAC7H,gBAAa;IACb,WAAK;IACL,SAAG;IACH,oBAAe;IACf,yBAAoB;IACpB,eAAoB;IAIlB,qBAAsC;IAGxC,2BAEC;IAED,+CAA+C;IAC/C,kBAAe;CAChB"}
@@ -23,7 +23,6 @@ export class Interaction extends BelNode {
23
23
  cancellationTimer: any;
24
24
  belType: number;
25
25
  trigger: any;
26
- start: any;
27
26
  oldRoute: any;
28
27
  eventSubscription: Map<string, never[]>;
29
28
  forceSave: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AAQA;;IAEI;AACJ;IAoBE,+FAYC;IA/BD,WAAmB;IACnB,uBAAgC;IAChC,eAAmC;IACnC,eAAmC;IACnC,gBAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,eAAS;IACT,aAAO;IACP,cAAQ;IACR,+EAA+E;IAC/E,eAA8B;IAC9B,qBAAgB;IAChB,yBAAoB;IACpB,sBAAoB;IACpB,6BAA2B;IAC3B,cAAW;IACX,uBAAiB;IAIf,gBAAoC;IACpC,aAAsB;IACtB,WAA6B;IAC7B,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAI3C,gCAEC;IAED,iDAGC;IAED,mCAEC;IAED,8BAIC;IAED,kCAUC;IAwBD;;;;;OAKG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB,gDA2CC;;CACF;wBAxJuB,YAAY"}
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AASA;;IAEI;AACJ;IAoBE,+FAYC;IA/BD,WAAmB;IACnB,uBAAgC;IAChC,eAAmC;IACnC,eAAmC;IACnC,gBAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,eAAS;IACT,aAAO;IACP,cAAQ;IACR,+EAA+E;IAC/E,eAA8B;IAC9B,qBAAgB;IAChB,yBAAoB;IACpB,sBAAoB;IACpB,6BAA2B;IAC3B,cAAW;IACX,uBAAiB;IAIf,gBAAoC;IACpC,aAAsB;IAEtB,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAI3C,gCAEC;IAED,iDAGC;IAED,mCAEC;IAED,8BAIC;IAED,kCAUC;IAwBD;;;;;OAKG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB,gDA2CC;;CACF;wBAxJuB,YAAY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.260.0",
3
+ "version": "1.260.1",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -214,6 +214,7 @@
214
214
  "eslint-plugin-sonarjs": "^0.23.0",
215
215
  "fastify": "^4.25.2",
216
216
  "fastify-plugin": "^4.5.1",
217
+ "form-data": "^4.0.0",
217
218
  "fs-extra": "^11.2.0",
218
219
  "function-bind": "^1.1.1",
219
220
  "glob": "^10.2.5",
@@ -5,6 +5,8 @@
5
5
  * @license Apache-2.0
6
6
  */
7
7
 
8
+ import { now } from '../timing/now'
9
+
8
10
  /**
9
11
  * Indicates if the agent is running within a normal browser window context.
10
12
  */
@@ -79,4 +81,4 @@ export const supportsSendBeacon = !!globalScope.navigator?.sendBeacon
79
81
  * according to the browser's local clock.
80
82
  * @type {number}
81
83
  */
82
- export const originTime = Math.floor(Date.now() - performance.now())
84
+ export const originTime = Date.now() - now()
@@ -61,7 +61,7 @@ export class TimeKeeper {
61
61
  }
62
62
 
63
63
  const medianRumOffset = (endTime - startTime) / 2
64
- const serverOffset = Math.floor(startTime + medianRumOffset)
64
+ const serverOffset = startTime + medianRumOffset
65
65
 
66
66
  // Corrected page origin time
67
67
  this.#correctedOriginTime = Math.floor(Date.parse(responseDateHeader) - serverOffset)
@@ -82,7 +82,7 @@ export class TimeKeeper {
82
82
  * @returns {number} Corrected unix/epoch timestamp
83
83
  */
84
84
  convertRelativeTimestamp (relativeTime) {
85
- return this.#correctedOriginTime + relativeTime
85
+ return Math.floor(this.#correctedOriginTime + relativeTime)
86
86
  }
87
87
 
88
88
  /**
@@ -116,6 +116,7 @@ export class Aggregate extends AggregateBase {
116
116
 
117
117
  /** Get the ST nodes from the traceStorage buffer. This also returns helpful metadata about the payload. */
118
118
  const { stns, earliestTimeStamp, latestTimeStamp } = this.traceStorage.takeSTNs()
119
+ if (!stns) return // there are no trace nodes
119
120
  if (options.retry) {
120
121
  this.sentTrace = stns
121
122
  }
@@ -274,8 +274,7 @@ export class TraceStorage {
274
274
  // Ajax (FEATURE) events--XML & fetches--pipes into ST here.
275
275
  storeXhrAgg (type, name, params, metrics) {
276
276
  if (type !== 'xhr') return
277
- this.storeSTN(new TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, `${params.status} ${params.method}: ${params.host}${params.pathname
278
- }`))
277
+ this.storeSTN(new TraceNode('Ajax', metrics.time, metrics.time + metrics.duration, `${params.status} ${params.method}: ${params.host}${params.pathname}`, 'ajax'))
279
278
  }
280
279
 
281
280
  restoreNode (name, listOfSTNodes) {
@@ -1,12 +1,10 @@
1
- import { now } from '../../../common/timing/now'
2
-
3
1
  let nodesSeen = 0
4
2
 
5
3
  export class BelNode {
6
4
  belType
7
5
  /** List of other BelNode derivatives. Each children should be of a subclass that implements its own 'serialize' function. */
8
6
  children = []
9
- start = now()
7
+ start
10
8
  end
11
9
  callbackEnd = 0
12
10
  callbackDuration = 0
@@ -55,7 +55,7 @@ export class Aggregate extends AggregateBase {
55
55
  })
56
56
 
57
57
  // By default, a complete UI driven interaction requires event -> URL change -> DOM mod in that exact order.
58
- registerHandler('newUIEvent', (event) => this.startUIInteraction(event.type, event.timeStamp, event.target), this.featureName, this.ee)
58
+ registerHandler('newUIEvent', (event) => this.startUIInteraction(event.type, Math.floor(event.timeStamp), event.target), this.featureName, this.ee)
59
59
  registerHandler('newURL', (timestamp, url) => this.interactionInProgress?.updateHistory(timestamp, url), this.featureName, this.ee)
60
60
  registerHandler('newDom', timestamp => {
61
61
  this.interactionInProgress?.updateDom(timestamp)
@@ -2,6 +2,7 @@ import { getInfo } from '../../../common/config/config'
2
2
  import { globalScope, initialLocation } from '../../../common/constants/runtime'
3
3
  import { generateUuid } from '../../../common/ids/unique-id'
4
4
  import { addCustomAttributes, getAddStringContext, nullable, numeric } from '../../../common/serialize/bel-serializer'
5
+ import { now } from '../../../common/timing/now'
5
6
  import { cleanURL } from '../../../common/url/clean-url'
6
7
  import { NODE_TYPE, INTERACTION_STATUS, INTERACTION_TYPE, API_TRIGGER_NAME } from '../constants'
7
8
  import { BelNode } from './bel-node'
@@ -44,12 +45,12 @@ export class Interaction extends BelNode {
44
45
  }
45
46
 
46
47
  updateDom (timestamp) {
47
- this.domTimestamp = (timestamp || performance.now()) // default timestamp should be precise for accurate isActiveDuring calculations
48
+ this.domTimestamp = (timestamp || now()) // default timestamp should be precise for accurate isActiveDuring calculations
48
49
  }
49
50
 
50
51
  updateHistory (timestamp, newUrl) {
51
52
  this.newURL = newUrl || '' + globalScope?.location
52
- this.historyTimestamp = (timestamp || performance.now())
53
+ this.historyTimestamp = (timestamp || now())
53
54
  }
54
55
 
55
56
  seenHistoryAndDomChange () {
@@ -124,8 +125,8 @@ export class Interaction extends BelNode {
124
125
  const fields = [
125
126
  numeric(this.belType),
126
127
  0, // this will be overwritten below with number of attached nodes
127
- numeric(Math.floor(this.start - firstStartTimeOfPayload)), // relative to first node
128
- numeric(Math.floor(this.end - this.start)), // end -- relative to start
128
+ numeric(this.start - firstStartTimeOfPayload), // relative to first node
129
+ numeric(this.end - this.start), // end -- relative to start
129
130
  numeric(this.callbackEnd), // cbEnd -- relative to start; not used by BrowserInteraction events
130
131
  numeric(this.callbackDuration), // not relative
131
132
  addString(this.trigger),