@newrelic/browser-agent 1.316.0 → 1.317.0-rc.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.
- package/CHANGELOG.md +15 -0
- package/dist/cjs/common/config/configurable.js +1 -1
- package/dist/cjs/common/config/init-types.js +1 -0
- package/dist/cjs/common/config/init.js +6 -4
- package/dist/cjs/common/constants/env.cdn.js +2 -2
- package/dist/cjs/common/constants/env.npm.js +2 -2
- package/dist/cjs/common/constants/events.js +26 -0
- package/dist/cjs/common/harvest/harvester.js +9 -217
- package/dist/cjs/common/harvest/send.js +232 -0
- package/dist/cjs/common/harvest/types.js +9 -5
- package/dist/cjs/common/payloads/payloads.js +127 -0
- package/dist/cjs/common/serialize/bel-serializer.js +4 -3
- package/dist/cjs/common/session/session-entity.js +8 -8
- package/dist/cjs/common/util/data-size.js +2 -2
- package/dist/cjs/common/util/obfuscate.js +147 -3
- package/dist/cjs/common/v2/mfe-vitals.js +286 -0
- package/dist/cjs/common/wrap/wrap-websocket.js +2 -1
- package/dist/cjs/common/wrap/wrap-xhr.js +1 -1
- package/dist/cjs/features/ajax/aggregate/gql.js +40 -1
- package/dist/cjs/features/ajax/aggregate/index.js +51 -13
- package/dist/cjs/features/ajax/constants.js +6 -1
- package/dist/cjs/features/ajax/instrument/index.js +105 -17
- package/dist/cjs/features/generic_events/aggregate/index.js +15 -10
- package/dist/cjs/features/generic_events/constants.js +3 -2
- package/dist/cjs/features/jserrors/aggregate/format-stack-trace.js +2 -2
- package/dist/cjs/features/jserrors/aggregate/index.js +12 -3
- package/dist/cjs/features/logging/aggregate/index.js +12 -8
- package/dist/cjs/features/metrics/aggregate/index.js +5 -1
- package/dist/cjs/features/page_view_event/aggregate/index.js +72 -33
- package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -1
- package/dist/cjs/features/session_replay/aggregate/index.js +39 -29
- package/dist/cjs/features/session_trace/aggregate/index.js +35 -29
- package/dist/cjs/features/session_trace/constants.js +17 -3
- package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +36 -5
- package/dist/cjs/features/soft_navigations/aggregate/index.js +7 -1
- package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +6 -4
- package/dist/cjs/features/utils/aggregate-base.js +4 -3
- package/dist/cjs/loaders/api/register.js +26 -4
- package/dist/esm/common/config/configurable.js +1 -1
- package/dist/esm/common/config/init-types.js +1 -0
- package/dist/esm/common/config/init.js +3 -1
- package/dist/esm/common/constants/env.cdn.js +2 -2
- package/dist/esm/common/constants/env.npm.js +2 -2
- package/dist/esm/common/constants/events.js +20 -0
- package/dist/esm/common/harvest/harvester.js +9 -217
- package/dist/esm/common/harvest/send.js +226 -0
- package/dist/esm/common/harvest/types.js +9 -5
- package/dist/esm/common/payloads/payloads.js +118 -0
- package/dist/esm/common/serialize/bel-serializer.js +4 -3
- package/dist/esm/common/session/session-entity.js +9 -9
- package/dist/esm/common/util/data-size.js +2 -2
- package/dist/esm/common/util/obfuscate.js +147 -3
- package/dist/esm/common/v2/mfe-vitals.js +281 -0
- package/dist/esm/common/wrap/wrap-websocket.js +2 -1
- package/dist/esm/common/wrap/wrap-xhr.js +1 -1
- package/dist/esm/features/ajax/aggregate/gql.js +39 -1
- package/dist/esm/features/ajax/aggregate/index.js +52 -14
- package/dist/esm/features/ajax/constants.js +5 -0
- package/dist/esm/features/ajax/instrument/index.js +106 -18
- package/dist/esm/features/generic_events/aggregate/index.js +15 -10
- package/dist/esm/features/generic_events/constants.js +3 -2
- package/dist/esm/features/jserrors/aggregate/format-stack-trace.js +2 -2
- package/dist/esm/features/jserrors/aggregate/index.js +12 -3
- package/dist/esm/features/logging/aggregate/index.js +12 -8
- package/dist/esm/features/metrics/aggregate/index.js +5 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +71 -32
- package/dist/esm/features/page_view_timing/aggregate/index.js +6 -1
- package/dist/esm/features/session_replay/aggregate/index.js +39 -29
- package/dist/esm/features/session_trace/aggregate/index.js +36 -30
- package/dist/esm/features/session_trace/constants.js +16 -2
- package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +36 -5
- package/dist/esm/features/soft_navigations/aggregate/index.js +7 -1
- package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +6 -4
- package/dist/esm/features/utils/aggregate-base.js +4 -3
- package/dist/esm/loaders/api/register.js +26 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/init-types.d.ts +4 -0
- package/dist/types/common/config/init-types.d.ts.map +1 -1
- package/dist/types/common/config/init.d.ts.map +1 -1
- package/dist/types/common/constants/events.d.ts +16 -0
- package/dist/types/common/constants/events.d.ts.map +1 -0
- package/dist/types/common/harvest/harvester.d.ts +2 -16
- package/dist/types/common/harvest/harvester.d.ts.map +1 -1
- package/dist/types/common/harvest/send.d.ts +9 -0
- package/dist/types/common/harvest/send.d.ts.map +1 -0
- package/dist/types/common/harvest/types.d.ts +39 -10
- package/dist/types/common/harvest/types.d.ts.map +1 -1
- package/dist/types/common/payloads/payloads.d.ts +42 -0
- package/dist/types/common/payloads/payloads.d.ts.map +1 -0
- package/dist/types/common/serialize/bel-serializer.d.ts +1 -1
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/util/obfuscate.d.ts +23 -2
- package/dist/types/common/util/obfuscate.d.ts.map +1 -1
- package/dist/types/common/v2/mfe-vitals.d.ts +14 -0
- package/dist/types/common/v2/mfe-vitals.d.ts.map +1 -0
- package/dist/types/common/wrap/wrap-websocket.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/gql.d.ts +8 -0
- package/dist/types/features/ajax/aggregate/gql.d.ts.map +1 -1
- package/dist/types/features/ajax/aggregate/index.d.ts +2 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/ajax/constants.d.ts +5 -0
- package/dist/types/features/ajax/constants.d.ts.map +1 -1
- package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts +3 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/constants.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +8 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +3 -1
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts +2 -0
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +3 -0
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -0
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +4 -2
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +3 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/constants.d.ts +17 -0
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +6 -1
- package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/index.d.ts +3 -0
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +3 -1
- package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +0 -1
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/loaders/api/register.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/config/configurable.js +1 -1
- package/src/common/config/init-types.js +1 -0
- package/src/common/config/init.js +2 -1
- package/src/common/constants/events.js +20 -0
- package/src/common/harvest/harvester.js +9 -201
- package/src/common/harvest/send.js +209 -0
- package/src/common/harvest/types.js +9 -5
- package/src/common/payloads/payloads.js +135 -0
- package/src/common/serialize/bel-serializer.js +4 -3
- package/src/common/session/session-entity.js +8 -9
- package/src/common/util/data-size.js +2 -2
- package/src/common/util/obfuscate.js +154 -3
- package/src/common/v2/mfe-vitals.js +260 -0
- package/src/common/wrap/wrap-websocket.js +2 -1
- package/src/common/wrap/wrap-xhr.js +1 -1
- package/src/features/ajax/aggregate/gql.js +42 -1
- package/src/features/ajax/aggregate/index.js +43 -13
- package/src/features/ajax/constants.js +5 -1
- package/src/features/ajax/instrument/index.js +114 -18
- package/src/features/generic_events/aggregate/index.js +14 -9
- package/src/features/generic_events/constants.js +3 -2
- package/src/features/jserrors/aggregate/format-stack-trace.js +3 -3
- package/src/features/jserrors/aggregate/index.js +12 -3
- package/src/features/logging/aggregate/index.js +12 -11
- package/src/features/metrics/aggregate/index.js +5 -1
- package/src/features/page_view_event/aggregate/index.js +58 -29
- package/src/features/page_view_timing/aggregate/index.js +6 -1
- package/src/features/session_replay/aggregate/index.js +37 -28
- package/src/features/session_trace/aggregate/index.js +37 -30
- package/src/features/session_trace/constants.js +7 -1
- package/src/features/soft_navigations/aggregate/ajax-node.js +26 -5
- package/src/features/soft_navigations/aggregate/index.js +7 -1
- package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
- package/src/features/soft_navigations/aggregate/interaction.js +6 -4
- package/src/features/utils/aggregate-base.js +3 -3
- package/src/loaders/api/register.js +24 -4
|
@@ -3,6 +3,7 @@ export class Aggregate extends AggregateBase {
|
|
|
3
3
|
constructor(agentRef: any);
|
|
4
4
|
curSessEndRecorded: boolean;
|
|
5
5
|
firstIxnRecorded: boolean;
|
|
6
|
+
obfuscator: Obfuscator;
|
|
6
7
|
/**
|
|
7
8
|
* Add the time of _document visibilitychange to hidden_ to the next PVT harvest == NRDB pageHide attr.
|
|
8
9
|
* @param {number} timestamp
|
|
@@ -24,4 +25,5 @@ export class Aggregate extends AggregateBase {
|
|
|
24
25
|
#private;
|
|
25
26
|
}
|
|
26
27
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
28
|
+
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
27
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AA0BA;IACE,2BAAiC;IAMjC,2BA+BC;IA7BC,4BAA+B;IAC/B,0BAA6B;IAK7B,uBAA2D;IAyB7D;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;;;MA+BC;IAED;;;OAGG;IACH,4BAFa,IAAI,CAahB;IAED,gDAWC;IAED,4BAGC;IAGD,qCAwBC;;CACF;8BAjK6B,4BAA4B;2BAC/B,gCAAgC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export class Aggregate extends AggregateBase {
|
|
2
2
|
static featureName: string;
|
|
3
3
|
constructor(agentRef: any, args: any);
|
|
4
|
-
mode:
|
|
4
|
+
mode: null;
|
|
5
|
+
obfuscator: Obfuscator;
|
|
5
6
|
/** Set once the recorder has fully initialized after flag checks and sampling */
|
|
6
7
|
initialized: boolean;
|
|
7
8
|
/** populated with the gzipper lib async */
|
|
@@ -65,7 +66,8 @@ export class Aggregate extends AggregateBase {
|
|
|
65
66
|
forceStop(forceHarvest: any): void;
|
|
66
67
|
/** Abort the feature, once aborted it will not resume */
|
|
67
68
|
abort(reason: {} | undefined, data: any): void;
|
|
68
|
-
|
|
69
|
+
#private;
|
|
69
70
|
}
|
|
70
71
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
72
|
+
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
71
73
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AA2BA;IACE,2BAAiC;IAIjC,sCA+FC;IAlGD,WAAW;IAOT,uBAA0D;IAE1D,iFAAiF;IACjF,qBAAwB;IAGxB,2CAA2C;IAC3C,sDAAwB;IACxB,6CAA6C;IAC7C,gDAAmB;IACnB,+DAA+D;IAC/D,wBAA0B;IAE1B,0BAA0B;IAC1B,kBAAqB;IACrB,6CAA6C;IAC7C,gBAA2B;IAE3B,qBAA2B;IAE3B,cAA8C;IAI9C,kCAAqG;IAqEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA+ChB;IAED,2BAUC;IAED,0BA0CC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GACN;QAAE,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,GAAC,SAAS,CAAA;KAAE,CAUzE;IAED;;;;;;;;;;MAsEC;IAED,sCAcC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,+CASC;;CAOF;8BAjY6B,4BAA4B;2BAe/B,gCAAgC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export class Aggregate extends AggregateBase {
|
|
2
2
|
static featureName: string;
|
|
3
3
|
constructor(agentRef: any);
|
|
4
|
+
obfuscator: Obfuscator;
|
|
4
5
|
/** Tied to the entitlement flag response from BCS. Will short circuit operations of the agg if false */
|
|
5
6
|
entitled: any;
|
|
6
7
|
/** A flag used to decide if the 30 node threshold should be ignored on the first harvest to ensure sending on the first payload */
|
|
@@ -29,9 +30,10 @@ export class Aggregate extends AggregateBase {
|
|
|
29
30
|
/** Switch from "off" or "error" to full mode (if entitled) */
|
|
30
31
|
switchToFull(): void;
|
|
31
32
|
/** Stop running for the remainder of the page lifecycle */
|
|
32
|
-
abort(
|
|
33
|
+
abort(reason?: {}): void;
|
|
33
34
|
postHarvestCleanup(result: any): void;
|
|
34
35
|
}
|
|
35
36
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
37
|
+
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
36
38
|
import { TraceStorage } from './trace/storage';
|
|
37
39
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAkBA;IACE,2BAAiC;IAEjC,2BAmBC;IAdC,uBAA0D;IAE1D,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,0GAA0G;IAC1G,2BAA0C;IAO5C,gLAAgL;IAChL,mEA8DC;IArDG,iCAAuB;IACvB,yJAAyJ;IACzJ,UAAsC;IACtC,eAA2D;IAyBwB,UAAgE;IA2BvJ,qCAWC;IAED,0CAIC;IAED;;;;;;;MAgDC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,yBAMC;IAED,sCAGC;CACF;8BApM6B,4BAA4B;2BAK/B,gCAAgC;6BAJ9B,iBAAiB"}
|
|
@@ -8,4 +8,21 @@ export const FN_END: string;
|
|
|
8
8
|
export const PUSH_STATE: "pushState";
|
|
9
9
|
export const MAX_NODES_PER_HARVEST: 1000;
|
|
10
10
|
export const ERROR_MODE_SECONDS_WINDOW: number;
|
|
11
|
+
export namespace ABORT_REASONS {
|
|
12
|
+
namespace CROSS_TAB {
|
|
13
|
+
let message: string;
|
|
14
|
+
}
|
|
15
|
+
namespace ENTITLEMENTS {
|
|
16
|
+
let message_1: string;
|
|
17
|
+
export { message_1 as message };
|
|
18
|
+
}
|
|
19
|
+
namespace RESET {
|
|
20
|
+
let message_2: string;
|
|
21
|
+
export { message_2 as message };
|
|
22
|
+
}
|
|
23
|
+
namespace SESSION_CHANGED {
|
|
24
|
+
let message_3: string;
|
|
25
|
+
export { message_3 as message };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
11
28
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -13,8 +13,13 @@ export class AjaxNode extends BelNode {
|
|
|
13
13
|
spanTimestamp: any;
|
|
14
14
|
gql: any;
|
|
15
15
|
targetAttributes: any;
|
|
16
|
+
requestBody: any;
|
|
17
|
+
requestHeaders: any;
|
|
18
|
+
requestQuery: any;
|
|
19
|
+
responseBody: any;
|
|
20
|
+
responseHeaders: any;
|
|
16
21
|
callbackEnd: any;
|
|
17
|
-
serialize(parentStartTimestamp: any, agentRef: any): string;
|
|
22
|
+
serialize(parentStartTimestamp: any, agentRef: any, ajaxObfuscator: any): string;
|
|
18
23
|
"ajaxRequest.id": any;
|
|
19
24
|
}
|
|
20
25
|
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":"
|
|
1
|
+
{"version":3,"file":"ajax-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/ajax-node.js"],"names":[],"mappings":"AAUA;IACE,8CA8BC;IA5BC,gBAA6B;IAC7B,YAA8B;IAC9B,YAA8B;IAC9B,YAA8B;IAC9B,UAA0B;IAC1B,YAAmC;IACnC,YAAoC;IACpC,+BAAwD;IACxD,YAA8B;IAC9B,aAAgC;IAChC,mBAA4C;IAC5C,SAAwB;IACxB,sBAAkD;IAIlD,iBAAwC;IACxC,oBAA8C;IAC9C,kBAA0C;IAC1C,kBAA0C;IAC1C,qBAAgD;IAK9C,iBAAoE;IAKxE,iFA+CC;IAhEC,sBAAkC;CAiErC;wBAnFuB,YAAY"}
|
|
@@ -3,6 +3,8 @@ export class Aggregate extends AggregateBase {
|
|
|
3
3
|
constructor(agentRef: any, { domObserver }: {
|
|
4
4
|
domObserver: any;
|
|
5
5
|
});
|
|
6
|
+
interactionObfuscator: Obfuscator;
|
|
7
|
+
ajaxObfuscator: Obfuscator;
|
|
6
8
|
interactionsToHarvest: any;
|
|
7
9
|
domObserver: any;
|
|
8
10
|
initialPageLoadInteraction: InitialPageLoadInteraction;
|
|
@@ -24,6 +26,7 @@ export class Aggregate extends AggregateBase {
|
|
|
24
26
|
#private;
|
|
25
27
|
}
|
|
26
28
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
29
|
+
import { Obfuscator } from '../../../common/util/obfuscate';
|
|
27
30
|
import { InitialPageLoadInteraction } from './initial-page-load-interaction';
|
|
28
31
|
import { Interaction } from './interaction';
|
|
29
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC;;OAmEC;IA7DC,kCAAqE;IACrE,2BAAgE;IAEhE,2BAAwC;IACxC,iBAA8B;IAE9B,uDAA0E;IAc1E,yBAA+B;IAC/B,0CAAiC;IACjC,yBAA4C;IAyC9C,qCAUC;IAED,0EAmBC;IAED,2BAiBC;IAED;;;;;;;OAOG;IACH,6BAHW,mBAAmB,OAsB7B;;CAoHF;8BAlR6B,4BAA4B;2BAC/B,gCAAgC;2CAGhB,iCAAiC;4BAChD,eAAe"}
|
|
@@ -49,9 +49,11 @@ export class Interaction extends BelNode {
|
|
|
49
49
|
* Serializes (BEL) the interaction data for transmission.
|
|
50
50
|
* @param {Number} firstStartTimeOfPayload timestamp
|
|
51
51
|
* @param {Agent} agentRef Pass in the agent reference directly so that the event itself doesnt need to store the pointers and ruin the evaluation of the event size by including unused object references.
|
|
52
|
+
* @param {Obfuscator} interactionObfuscator Obfuscator for BrowserInteraction event type
|
|
53
|
+
* @param {Obfuscator} ajaxObfuscator Obfuscator for AjaxRequest event type (passed to child AjaxNodes)
|
|
52
54
|
* @returns {String} A string that is the serialized representation of this interaction.
|
|
53
55
|
*/
|
|
54
|
-
serialize(firstStartTimeOfPayload: number, agentRef: Agent): string;
|
|
56
|
+
serialize(firstStartTimeOfPayload: number, agentRef: Agent, interactionObfuscator: Obfuscator, ajaxObfuscator: Obfuscator): string;
|
|
55
57
|
#private;
|
|
56
58
|
}
|
|
57
59
|
import { BelNode } from './bel-node';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AAYA;;IAEI;AACJ;IAoBE,0FAaC;IAhCD,WAAmB;IACnB,uBAAgC;IAChC,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,kBAAa;IACb,uBAAiB;IACjB,wBAAkB;IAIhB,gBAAoC;IACpC,aAAsB;IAEtB,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAEzC,YAAsE;IAAxD,YAAwD;IAGxE,iDAKC;IAED,gCAGC;IAED,oCAUC;IAED,8BAIC;IAED,6DAeC;IAmBD;;;;;;OAMG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB
|
|
1
|
+
{"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AAYA;;IAEI;AACJ;IAoBE,0FAaC;IAhCD,WAAmB;IACnB,uBAAgC;IAChC,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,kBAAa;IACb,uBAAiB;IACjB,wBAAkB;IAIhB,gBAAoC;IACpC,aAAsB;IAEtB,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAEzC,YAAsE;IAAxD,YAAwD;IAGxE,iDAKC;IAED,gCAGC;IAED,oCAUC;IAED,8BAIC;IAED,6DAeC;IAmBD;;;;;;OAMG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB;;;;;;;OAOG;IACH,qDALW,KAAK,yBACL,UAAU,kBACV,UAAU,UAgDpB;;CACF;wBA/KuB,YAAY"}
|
|
@@ -63,7 +63,6 @@ export class AggregateBase extends FeatureBase {
|
|
|
63
63
|
* This method should run after checkConfiguration, which may reset the agent's info/runtime object that is used here.
|
|
64
64
|
*/
|
|
65
65
|
doOnceForAllAggregate(agentRef: any): void;
|
|
66
|
-
obfuscator: any;
|
|
67
66
|
/**
|
|
68
67
|
* Report a supportability metric
|
|
69
68
|
* @param {*} metricName The tag of the name matching the Angler aggregation tag
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAeA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EAkBhB;IAZC,uOAAuO;IACvO,qCAAwC;IACxC,gLAAgL;IAChL,yBAA2B;IAC3B,sFAAsF;IACtF,oBAAuB;IAEvB,gBAAqB;IAqBjB,YAAsE;IAW5E,iNAAiN;IACjN,0CAEC;IAED;;;;OAIG;IACH,8BAHU,MAAM,CAKf;IAED,qBAOC;IAFG,6BAAmB;IAIvB;;;;OAIG;IACH,2BAOC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAeA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EAkBhB;IAZC,uOAAuO;IACvO,qCAAwC;IACxC,gLAAgL;IAChL,yBAA2B;IAC3B,sFAAsF;IACtF,oBAAuB;IAEvB,gBAAqB;IAqBjB,YAAsE;IAW5E,iNAAiN;IACjN,0CAEC;IAED;;;;OAIG;IACH,8BAHU,MAAM,CAKf;IAED,qBAOC;IAFG,6BAAmB;IAIvB;;;;OAIG;IACH,2BAOC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAyBlB;IAED;;OAEG;IACH,cAEC;IAED,qCAEC;IAED;;;;;;OAMG;IACH,uDAJW,MAAM,GAAC,SAAS,SAsB1B;IAED;;;;;OAKG;IACH,4BAHG;QAAyB,IAAI,GAArB,OAAO,YAAC;QACS,KAAK,GAAtB,OAAO,YAAC;KAClB,QAKA;IAED;;;OAGG;IACH,2CAIC;IAED;;;;OAIG;IACH,uCAHW,GAAC,UACD,GAAC,QAIX;;CACF;4BAlM2B,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AAoDA;;;;GAIG;AACH,mDAIC;;;;;;;0BArCY,OAAO,sBAAsB,EAAE,WAAW"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/browser-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.317.0-rc.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
|
|
6
6
|
"description": "New Relic Browser Agent",
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
"url": "https://github.com/newrelic/newrelic-browser-agent.git"
|
|
214
214
|
},
|
|
215
215
|
"dependencies": {
|
|
216
|
-
"@newrelic/rrweb": "1.1.
|
|
216
|
+
"@newrelic/rrweb": "^1.1.2",
|
|
217
217
|
"fflate": "0.8.2",
|
|
218
218
|
"web-vitals": "4.2.4"
|
|
219
219
|
},
|
|
@@ -284,4 +284,4 @@
|
|
|
284
284
|
"README.md",
|
|
285
285
|
"CHANGELOG.md"
|
|
286
286
|
]
|
|
287
|
-
}
|
|
287
|
+
}
|
|
@@ -21,7 +21,7 @@ export function getModeledObject (obj, model) {
|
|
|
21
21
|
|
|
22
22
|
if (Array.isArray(obj[key]) && Array.isArray(model[key])) output[key] = Array.from(new Set([...obj[key], ...model[key]]))
|
|
23
23
|
else if (obj[key] instanceof Map || obj[key] instanceof Set || obj[key] instanceof Date || obj[key] instanceof RegExp) output[key] = obj[key]
|
|
24
|
-
else if (typeof obj[key] === 'object' && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key])
|
|
24
|
+
else if (typeof obj[key] === 'object' && model[key] !== null && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key])
|
|
25
25
|
else output[key] = obj[key]
|
|
26
26
|
} catch (e) {
|
|
27
27
|
if (!output[key]) warn(1, e)
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @property {boolean} [ajax.block_internal] - If true, agent requests going to harvest endpoint are treated as on deny list. In other words, agent will not self-report AJAX.
|
|
12
12
|
* @property {boolean} [ajax.enabled] - Turn on/off the ajax feature (on by default).
|
|
13
13
|
* @property {boolean} [ajax.autoStart] - If true, the agent will automatically start the ajax feature. Otherwise, it will be in a deferred state until the `start` API method is called.
|
|
14
|
+
* @property {('none'|'failures'|'all')} [ajax.capture_payloads] - Controls when AJAX request/response payloads are captured. 'none' = never capture, 'failures' = capture only on errors (4xx, 5xx, network errors, GraphQL errors), 'all' = always capture.
|
|
14
15
|
* @property {Object} [api]
|
|
15
16
|
* @property {Object} [api.register]
|
|
16
17
|
* @property {boolean} [api.register.enabled] - If true, the agent will allow registered children to be sent to the server.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { FEATURE_FLAGS } from '../../features/generic_events/constants'
|
|
6
|
+
import { CAPTURE_PAYLOAD_SETTINGS } from '../../features/ajax/constants'
|
|
6
7
|
import { isValidSelector } from '../dom/query-selector'
|
|
7
8
|
import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../session/constants'
|
|
8
9
|
import { warn } from '../util/console'
|
|
@@ -47,7 +48,7 @@ const InitModelFn = () => {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
return {
|
|
50
|
-
ajax: { deny_list: undefined, block_internal: true, enabled: true, autoStart: true },
|
|
51
|
+
ajax: { deny_list: undefined, block_internal: true, enabled: true, autoStart: true, capture_payloads: CAPTURE_PAYLOAD_SETTINGS.NONE },
|
|
51
52
|
api: {
|
|
52
53
|
register: {
|
|
53
54
|
get enabled () { return hiddenState.feature_flags.includes(FEATURE_FLAGS.REGISTER) || hiddenState.experimental.register },
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2020-2026 New Relic, Inc. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const EVENT_TYPES = {
|
|
7
|
+
AJAX: 'AjaxRequest',
|
|
8
|
+
PA: 'PageAction',
|
|
9
|
+
UA: 'UserAction',
|
|
10
|
+
BP: 'BrowserPerformance',
|
|
11
|
+
WS: 'WebSocket',
|
|
12
|
+
SPV: 'SecurityPolicyViolation',
|
|
13
|
+
JSE: 'JavaScriptError',
|
|
14
|
+
LOG: 'Log',
|
|
15
|
+
PVE: 'PageView',
|
|
16
|
+
PVT: 'PageViewTiming',
|
|
17
|
+
SR: 'SessionReplay',
|
|
18
|
+
ST: 'SessionTrace',
|
|
19
|
+
BI: 'BrowserInteraction'
|
|
20
|
+
}
|
|
@@ -3,19 +3,12 @@
|
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
5
|
import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants'
|
|
6
|
-
import { FEATURE_TO_ENDPOINT,
|
|
7
|
-
import { VERSION } from '../constants/env'
|
|
8
|
-
import { globalScope, isWorkerScope } from '../constants/runtime'
|
|
6
|
+
import { FEATURE_TO_ENDPOINT, FEATURE_NAMES } from '../../loaders/features/features'
|
|
9
7
|
import { handle } from '../event-emitter/handle'
|
|
10
|
-
import { eventListenerOpts } from '../event-listener/event-listener-opts'
|
|
11
|
-
import { now } from '../timing/now'
|
|
12
8
|
import { subscribeToEOL } from '../unload/eol'
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { stringify } from '../util/stringify'
|
|
17
|
-
import { getSubmitMethod, xhr as xhrMethod, xhrFetch as fetchMethod } from '../util/submit-data'
|
|
18
|
-
import { dispatchGlobalEvent } from '../dispatch/global-event'
|
|
9
|
+
import { getSubmitMethod, xhr as xhrMethod } from '../util/submit-data'
|
|
10
|
+
import { send } from './send'
|
|
11
|
+
import { Obfuscator } from '../util/obfuscate'
|
|
19
12
|
|
|
20
13
|
const RETRY = 'Harvester/Retry/'
|
|
21
14
|
const RETRY_ATTEMPTED = RETRY + 'Attempted/'
|
|
@@ -29,6 +22,10 @@ export class Harvester {
|
|
|
29
22
|
constructor (agentRef) {
|
|
30
23
|
this.agentRef = agentRef
|
|
31
24
|
|
|
25
|
+
// Create obfuscator for harvest metadata (referrer URL, etc.)
|
|
26
|
+
// No event type specified - applies to all harvests regardless of feature
|
|
27
|
+
this.obfuscator = new Obfuscator(agentRef)
|
|
28
|
+
|
|
32
29
|
subscribeToEOL(() => { // do one last harvest round or check
|
|
33
30
|
this.initializedAggregates.forEach(aggregateInst => { // let all features wrap up things needed to do before ANY harvest in case there's last minute cross-feature data dependencies
|
|
34
31
|
if (typeof aggregateInst.harvestOpts.beforeUnload === 'function') aggregateInst.harvestOpts.beforeUnload()
|
|
@@ -73,6 +70,7 @@ export class Harvester {
|
|
|
73
70
|
payload: output.payload,
|
|
74
71
|
localOpts,
|
|
75
72
|
submitMethod,
|
|
73
|
+
harvesterObfuscator: this.obfuscator,
|
|
76
74
|
cbFinished,
|
|
77
75
|
raw: aggregateInst.harvestOpts.raw,
|
|
78
76
|
featureName: aggregateInst.featureName,
|
|
@@ -101,193 +99,3 @@ export class Harvester {
|
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @typedef {import('./types.js').NetworkSendSpec} NetworkSendSpec
|
|
107
|
-
*/
|
|
108
|
-
|
|
109
|
-
const warnings = {}
|
|
110
|
-
/**
|
|
111
|
-
* Initiate a harvest call.
|
|
112
|
-
* @param {NetworkSendSpec} param0 Specification for sending data
|
|
113
|
-
* @returns {boolean} True if a network call was made. Note that this does not mean or guarantee that it was successful.
|
|
114
|
-
*/
|
|
115
|
-
export function send (agentRef, { endpoint, payload, localOpts = {}, submitMethod, cbFinished, raw, featureName, endpointVersion = 1 }) {
|
|
116
|
-
if (!agentRef.info.errorBeacon) return false
|
|
117
|
-
|
|
118
|
-
let { body, qs } = cleanPayload(payload)
|
|
119
|
-
|
|
120
|
-
if (Object.keys(body).length === 0 && !localOpts.sendEmptyBody) { // if there's no body to send, just run onfinish stuff and return
|
|
121
|
-
if (cbFinished) cbFinished({ sent: false })
|
|
122
|
-
return false
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const protocol = agentRef.init.ssl === false ? 'http' : 'https'
|
|
126
|
-
const perceivedBeacon = agentRef.init.proxy.beacon || agentRef.info.errorBeacon
|
|
127
|
-
const url = raw
|
|
128
|
-
? `${protocol}://${perceivedBeacon}/${endpoint}`
|
|
129
|
-
: `${protocol}://${perceivedBeacon}${endpoint !== RUM ? '/' + endpoint : ''}/${endpointVersion}/${agentRef.info.licenseKey}`
|
|
130
|
-
const baseParams = !raw ? baseQueryString(agentRef, qs, endpoint) : ''
|
|
131
|
-
let payloadParams = obj(qs, agentRef.runtime.maxBytes)
|
|
132
|
-
if (baseParams === '' && payloadParams.startsWith('&')) {
|
|
133
|
-
payloadParams = payloadParams.substring(1)
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const fullUrl = `${url}?${baseParams}${payloadParams}`
|
|
137
|
-
const gzip = !!qs?.attributes?.includes('gzip')
|
|
138
|
-
|
|
139
|
-
// all gzipped data is already in the correct format and needs no transformation
|
|
140
|
-
// all features going to 'events' endpoint should already be serialized & stringified
|
|
141
|
-
let stringBody = gzip || endpoint === EVENTS ? body : stringify(body)
|
|
142
|
-
|
|
143
|
-
// If body is null, undefined, or an empty object or array after stringifying, send an empty string instead.
|
|
144
|
-
if (!stringBody || stringBody.length === 0 || stringBody === '{}' || stringBody === '[]') stringBody = ''
|
|
145
|
-
|
|
146
|
-
// Warn--once per endpoint--if the agent tries to send large payloads
|
|
147
|
-
if (endpoint !== BLOBS && stringBody.length > 750000 && (warnings[endpoint] = (warnings[endpoint] || 0) + 1) === 1) warn(28, endpoint)
|
|
148
|
-
|
|
149
|
-
const headers = [{ key: 'content-type', value: 'text/plain' }]
|
|
150
|
-
|
|
151
|
-
/* Since workers don't support sendBeacon right now, they can only use XHR method.
|
|
152
|
-
Because they still do permit synch XHR, the idea is that at final harvest time (worker is closing),
|
|
153
|
-
we just make a BLOCKING request--trivial impact--with the remaining data as a temp fill-in for sendBeacon.
|
|
154
|
-
Following the removal of img-element method. */
|
|
155
|
-
let result = submitMethod({ url: fullUrl, body: stringBody, sync: localOpts.isFinalHarvest && isWorkerScope, headers })
|
|
156
|
-
|
|
157
|
-
if (!localOpts.isFinalHarvest && cbFinished) { // final harvests don't hold onto buffer data (shouldRetryOnFail is false), so cleanup isn't needed
|
|
158
|
-
if (submitMethod === xhrMethod) {
|
|
159
|
-
result.addEventListener('loadend', function () {
|
|
160
|
-
// `this` here in block refers to the XHR object in this scope, do not change the anon function to an arrow function
|
|
161
|
-
// status 0 refers to a local error, such as CORS or network failure, or a blocked request by the browser (e.g. adblocker)
|
|
162
|
-
const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this, responseText: this.responseText }
|
|
163
|
-
cbFinished(cbResult)
|
|
164
|
-
|
|
165
|
-
/** temporary audit of consistency of harvest metadata flags */
|
|
166
|
-
if (!shouldRetry(this.status)) trackHarvestMetadata()
|
|
167
|
-
}, eventListenerOpts(false))
|
|
168
|
-
} else if (submitMethod === fetchMethod) {
|
|
169
|
-
result.then(async function (response) {
|
|
170
|
-
const status = response.status
|
|
171
|
-
const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response, responseText: await response.text() }
|
|
172
|
-
cbFinished(cbResult)
|
|
173
|
-
/** temporary audit of consistency of harvest metadata flags */
|
|
174
|
-
if (!shouldRetry(status)) trackHarvestMetadata()
|
|
175
|
-
})
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function trackHarvestMetadata () {
|
|
179
|
-
try {
|
|
180
|
-
if (featureName === FEATURE_NAMES.jserrors && !body?.err) return
|
|
181
|
-
|
|
182
|
-
const hasReplay = baseParams.includes('hr=1')
|
|
183
|
-
const hasTrace = baseParams.includes('ht=1')
|
|
184
|
-
const hasError = qs?.attributes?.includes('hasError=true')
|
|
185
|
-
|
|
186
|
-
handle('harvest-metadata', [{
|
|
187
|
-
[featureName]: {
|
|
188
|
-
...(hasReplay && { hasReplay }),
|
|
189
|
-
...(hasTrace && { hasTrace }),
|
|
190
|
-
...(hasError && { hasError })
|
|
191
|
-
}
|
|
192
|
-
}], undefined, FEATURE_NAMES.metrics, agentRef.ee)
|
|
193
|
-
} catch (err) {
|
|
194
|
-
// do nothing
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
dispatchGlobalEvent({
|
|
200
|
-
drained: !!agentRef.runtime?.activatedFeatures,
|
|
201
|
-
type: 'data',
|
|
202
|
-
name: 'harvest',
|
|
203
|
-
feature: featureName,
|
|
204
|
-
data: {
|
|
205
|
-
endpoint,
|
|
206
|
-
headers,
|
|
207
|
-
payload,
|
|
208
|
-
submitMethod: getSubmitMethodName(),
|
|
209
|
-
raw,
|
|
210
|
-
synchronousXhr: !!(localOpts.isFinalHarvest && isWorkerScope)
|
|
211
|
-
}
|
|
212
|
-
})
|
|
213
|
-
|
|
214
|
-
return true
|
|
215
|
-
|
|
216
|
-
function shouldRetry (status) {
|
|
217
|
-
switch (status) {
|
|
218
|
-
case 408:
|
|
219
|
-
case 429:
|
|
220
|
-
case 500:
|
|
221
|
-
return true
|
|
222
|
-
}
|
|
223
|
-
return (status >= 502 && status <= 504) || (status >= 512 && status <= 530)
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function getSubmitMethodName () {
|
|
227
|
-
if (submitMethod === xhrMethod) return 'xhr'
|
|
228
|
-
if (submitMethod === fetchMethod) return 'fetch'
|
|
229
|
-
return 'beacon'
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Cleans and returns a payload object containing a body and qs
|
|
235
|
-
* object with key/value pairs. KV pairs where the value is null,
|
|
236
|
-
* undefined, or an empty string are removed to save on transmission
|
|
237
|
-
* size.
|
|
238
|
-
* @param {HarvestPayload} payload Payload to be sent to the endpoint.
|
|
239
|
-
* @returns {HarvestPayload} Cleaned payload payload to be sent to the endpoint.
|
|
240
|
-
*/
|
|
241
|
-
function cleanPayload (payload = {}) {
|
|
242
|
-
const clean = (input) => {
|
|
243
|
-
if ((typeof Uint8Array !== 'undefined' && input instanceof Uint8Array) || Array.isArray(input)) return input
|
|
244
|
-
if (typeof input === 'string') return input
|
|
245
|
-
return Object.entries(input || {}).reduce((accumulator, [key, value]) => {
|
|
246
|
-
if ((typeof value === 'number') ||
|
|
247
|
-
(typeof value === 'string' && value.length > 0) ||
|
|
248
|
-
(typeof value === 'object' && Object.keys(value || {}).length > 0)
|
|
249
|
-
) {
|
|
250
|
-
accumulator[key] = value
|
|
251
|
-
}
|
|
252
|
-
return accumulator
|
|
253
|
-
}, {})
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return {
|
|
257
|
-
body: clean(payload.body),
|
|
258
|
-
qs: clean(payload.qs)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
// The stuff that gets sent every time.
|
|
263
|
-
function baseQueryString (agentRef, qs, endpoint) {
|
|
264
|
-
const ref = agentRef.runtime.obfuscator.obfuscateString(cleanURL('' + globalScope.location))
|
|
265
|
-
const session = agentRef.runtime.session
|
|
266
|
-
const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS
|
|
267
|
-
const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint)
|
|
268
|
-
|
|
269
|
-
const qps = [
|
|
270
|
-
'a=' + agentRef.info.applicationID,
|
|
271
|
-
param('sa', (agentRef.info.sa ? '' + agentRef.info.sa : '')),
|
|
272
|
-
param('v', VERSION),
|
|
273
|
-
transactionNameParam(),
|
|
274
|
-
param('ct', agentRef.runtime.customTransaction),
|
|
275
|
-
'&rst=' + now(),
|
|
276
|
-
'&ck=0', // ck param DEPRECATED - still expected by backend
|
|
277
|
-
'&s=' + (session?.state.value || '0'), // the 0 id encaps all untrackable and default traffic
|
|
278
|
-
param('ref', ref),
|
|
279
|
-
param('ptid', (agentRef.runtime.ptid ? '' + agentRef.runtime.ptid : ''))
|
|
280
|
-
]
|
|
281
|
-
if (hr) qps.push(param('hr', '1', qs))
|
|
282
|
-
if (ht) qps.push(param('ht', '1', qs))
|
|
283
|
-
|
|
284
|
-
return qps.join('')
|
|
285
|
-
|
|
286
|
-
// Constructs the transaction name param for the beacon URL.
|
|
287
|
-
// Prefers the obfuscated transaction name over the plain text.
|
|
288
|
-
// Falls back to making up a name.
|
|
289
|
-
function transactionNameParam () {
|
|
290
|
-
if (agentRef.info.transactionName) return param('to', agentRef.info.transactionName)
|
|
291
|
-
return param('t', agentRef.info.tNamePlain || 'Unnamed Transaction')
|
|
292
|
-
}
|
|
293
|
-
}
|