@newrelic/browser-agent 1.237.0 → 1.237.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.
@@ -12,7 +12,7 @@ exports.VERSION = exports.DIST_METHOD = exports.BUILD_ENV = void 0;
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.237.0";
15
+ const VERSION = "1.237.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -12,7 +12,7 @@ exports.VERSION = exports.DIST_METHOD = exports.BUILD_ENV = void 0;
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.237.0";
15
+ const VERSION = "1.237.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -258,9 +258,8 @@ class Harvest extends _sharedContext.SharedContext {
258
258
  cleanPayload() {
259
259
  let payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
260
260
  const clean = input => {
261
- if (typeof Uint8Array !== 'undefined' && input instanceof Uint8Array || typeof input === 'string') {
262
- return input.length > 0 ? input : null;
263
- }
261
+ if (typeof Uint8Array !== 'undefined' && input instanceof Uint8Array || Array.isArray(input)) return input;
262
+ if (typeof input === 'string') return input.length > 0 ? input : null;
264
263
  return Object.entries(input || {}).reduce((accumulator, _ref2) => {
265
264
  let [key, value] = _ref2;
266
265
  if (typeof value === 'number' || typeof value === 'string' && value.length > 0 || typeof value === 'object' && Object.keys(value || {}).length > 0) {
@@ -154,6 +154,14 @@ class Aggregate extends _aggregateBase.AggregateBase {
154
154
  // Capture metrics for size of custom attributes
155
155
  const jsAttributes = (0, _stringify.stringify)(info.jsAttributes);
156
156
  this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length);
157
+
158
+ // Capture metrics for performance markers and measures
159
+ if (typeof performance !== 'undefined') {
160
+ const markers = performance.getEntriesByType('mark');
161
+ const measures = performance.getEntriesByType('measure');
162
+ this.storeSupportabilityMetrics('Generic/Performance/Mark/Seen', markers.length);
163
+ this.storeSupportabilityMetrics('Generic/Performance/Measure/Seen', measures.length);
164
+ }
157
165
  } catch (e) {
158
166
  // do nothing
159
167
  }
@@ -407,7 +407,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
407
407
  (0, _registerHandler.registerHandler)(FETCH_DONE, function (err, res) {
408
408
  var node = this[SPA_NODE];
409
409
  if (node) {
410
- if (err) {
410
+ if (err || !(0, _denyList.shouldCollectEvent)(this.params)) {
411
411
  node.cancel();
412
412
  return;
413
413
  }
@@ -36,7 +36,8 @@ function configure(agentIdentifier) {
36
36
  info.jsAttributes.isWorker = true;
37
37
  }
38
38
  (0, _config.setInfo)(agentIdentifier, info);
39
- runtime.denyList = init.ajax?.block_internal ? (init.ajax.deny_list || []).concat(info.beacon, info.errorBeacon) : init.ajax?.deny_list;
39
+ const updatedInit = (0, _config.getConfiguration)(agentIdentifier);
40
+ runtime.denyList = [...(updatedInit.ajax?.deny_list || []), ...(updatedInit.ajax?.block_internal ? [info.beacon, info.errorBeacon] : [])];
40
41
  (0, _config.setRuntime)(agentIdentifier, runtime);
41
42
  (0, _api.setTopLevelCallers)();
42
43
  const api = (0, _api.setAPI)(agentIdentifier, forceDrain);
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.237.0";
9
+ export const VERSION = "1.237.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.237.0";
9
+ export const VERSION = "1.237.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -250,9 +250,8 @@ export class Harvest extends SharedContext {
250
250
  cleanPayload() {
251
251
  let payload = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
252
252
  const clean = input => {
253
- if (typeof Uint8Array !== 'undefined' && input instanceof Uint8Array || typeof input === 'string') {
254
- return input.length > 0 ? input : null;
255
- }
253
+ if (typeof Uint8Array !== 'undefined' && input instanceof Uint8Array || Array.isArray(input)) return input;
254
+ if (typeof input === 'string') return input.length > 0 ? input : null;
256
255
  return Object.entries(input || {}).reduce((accumulator, _ref2) => {
257
256
  let [key, value] = _ref2;
258
257
  if (typeof value === 'number' || typeof value === 'string' && value.length > 0 || typeof value === 'object' && Object.keys(value || {}).length > 0) {
@@ -148,6 +148,14 @@ export class Aggregate extends AggregateBase {
148
148
  // Capture metrics for size of custom attributes
149
149
  const jsAttributes = stringify(info.jsAttributes);
150
150
  this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length);
151
+
152
+ // Capture metrics for performance markers and measures
153
+ if (typeof performance !== 'undefined') {
154
+ const markers = performance.getEntriesByType('mark');
155
+ const measures = performance.getEntriesByType('measure');
156
+ this.storeSupportabilityMetrics('Generic/Performance/Mark/Seen', markers.length);
157
+ this.storeSupportabilityMetrics('Generic/Performance/Measure/Seen', measures.length);
158
+ }
151
159
  } catch (e) {
152
160
  // do nothing
153
161
  }
@@ -398,7 +398,7 @@ export class Aggregate extends AggregateBase {
398
398
  register(FETCH_DONE, function (err, res) {
399
399
  var node = this[SPA_NODE];
400
400
  if (node) {
401
- if (err) {
401
+ if (err || !shouldCollectEvent(this.params)) {
402
402
  node.cancel();
403
403
  return;
404
404
  }
@@ -1,6 +1,6 @@
1
1
  import { setAPI, setTopLevelCallers } from '../api/api';
2
2
  import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum';
3
- import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config';
3
+ import { getConfiguration, setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config';
4
4
  import { activatedFeatures } from '../../common/util/feature-flags';
5
5
  import { isWorkerScope } from '../../common/constants/runtime';
6
6
  export function configure(agentIdentifier) {
@@ -30,7 +30,8 @@ export function configure(agentIdentifier) {
30
30
  info.jsAttributes.isWorker = true;
31
31
  }
32
32
  setInfo(agentIdentifier, info);
33
- runtime.denyList = init.ajax?.block_internal ? (init.ajax.deny_list || []).concat(info.beacon, info.errorBeacon) : init.ajax?.deny_list;
33
+ const updatedInit = getConfiguration(agentIdentifier);
34
+ runtime.denyList = [...(updatedInit.ajax?.deny_list || []), ...(updatedInit.ajax?.block_internal ? [info.beacon, info.errorBeacon] : [])];
34
35
  setRuntime(agentIdentifier, runtime);
35
36
  setTopLevelCallers();
36
37
  const api = setAPI(agentIdentifier, forceDrain);
@@ -1 +1 @@
1
- {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAUzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CAmFnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAwB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BApPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
1
+ {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAUzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CAmFnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAnPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,qBA+BC;IAED,0BAQC;IAED,eAoDC;IA5CG,mCAAyB;CA6C9B;8BA5I6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,qBA+BC;IAED,0BAQC;IAED,eA4DC;IApDG,mCAAyB;CAqD9B;8BApJ6B,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;EA4BC"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;EAqCC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.237.0",
3
+ "version": "1.237.1",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "Tests for the New Relic JavaScript agent",
@@ -230,9 +230,8 @@ export class Harvest extends SharedContext {
230
230
  */
231
231
  cleanPayload (payload = {}) {
232
232
  const clean = (input) => {
233
- if ((typeof Uint8Array !== 'undefined' && input instanceof Uint8Array) || typeof input === 'string') {
234
- return input.length > 0 ? input : null
235
- }
233
+ if ((typeof Uint8Array !== 'undefined' && input instanceof Uint8Array) || Array.isArray(input)) return input
234
+ if (typeof input === 'string') return input.length > 0 ? input : null
236
235
  return Object.entries(input || {})
237
236
  .reduce((accumulator, [key, value]) => {
238
237
  if ((typeof value === 'number') ||
@@ -147,6 +147,14 @@ export class Aggregate extends AggregateBase {
147
147
  // Capture metrics for size of custom attributes
148
148
  const jsAttributes = stringify(info.jsAttributes)
149
149
  this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length)
150
+
151
+ // Capture metrics for performance markers and measures
152
+ if (typeof performance !== 'undefined') {
153
+ const markers = performance.getEntriesByType('mark')
154
+ const measures = performance.getEntriesByType('measure')
155
+ this.storeSupportabilityMetrics('Generic/Performance/Mark/Seen', markers.length)
156
+ this.storeSupportabilityMetrics('Generic/Performance/Measure/Seen', measures.length)
157
+ }
150
158
  } catch (e) {
151
159
  // do nothing
152
160
  }
@@ -415,7 +415,7 @@ export class Aggregate extends AggregateBase {
415
415
  register(FETCH_DONE, function (err, res) {
416
416
  var node = this[SPA_NODE]
417
417
  if (node) {
418
- if (err) {
418
+ if (err || !shouldCollectEvent(this.params)) {
419
419
  node.cancel()
420
420
  return
421
421
  }
@@ -1,6 +1,6 @@
1
1
  import { setAPI, setTopLevelCallers } from '../api/api'
2
2
  import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum'
3
- import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config'
3
+ import { getConfiguration, setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config'
4
4
  import { activatedFeatures } from '../../common/util/feature-flags'
5
5
  import { isWorkerScope } from '../../common/constants/runtime'
6
6
 
@@ -22,7 +22,16 @@ export function configure (agentIdentifier, opts = {}, loaderType, forceDrain) {
22
22
  }
23
23
  setInfo(agentIdentifier, info)
24
24
 
25
- runtime.denyList = init.ajax?.block_internal ? (init.ajax.deny_list || []).concat(info.beacon, info.errorBeacon) : init.ajax?.deny_list
25
+ const updatedInit = getConfiguration(agentIdentifier)
26
+ runtime.denyList = [
27
+ ...(updatedInit.ajax?.deny_list || []),
28
+ ...(updatedInit.ajax?.block_internal
29
+ ? [
30
+ info.beacon,
31
+ info.errorBeacon
32
+ ]
33
+ : [])
34
+ ]
26
35
  setRuntime(agentIdentifier, runtime)
27
36
 
28
37
  setTopLevelCallers()