@newrelic/browser-agent 1.301.0 → 1.302.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/cjs/common/config/init-types.js +1 -1
- package/dist/cjs/common/config/init.js +7 -1
- package/dist/cjs/common/config/runtime.js +1 -1
- package/dist/cjs/common/constants/agent-constants.js +11 -2
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/drain/drain.js +1 -1
- package/dist/cjs/common/harvest/harvester.js +30 -39
- package/dist/cjs/common/util/mfe.js +45 -0
- package/dist/cjs/features/ajax/aggregate/index.js +5 -1
- package/dist/cjs/features/generic_events/aggregate/index.js +9 -8
- package/dist/cjs/features/generic_events/constants.js +3 -1
- package/dist/cjs/features/generic_events/instrument/index.js +38 -32
- package/dist/cjs/features/jserrors/aggregate/index.js +18 -17
- package/dist/cjs/features/logging/aggregate/index.js +19 -15
- package/dist/cjs/features/logging/shared/utils.js +3 -3
- package/dist/cjs/features/page_view_event/aggregate/index.js +3 -33
- package/dist/cjs/features/session_replay/aggregate/index.js +13 -13
- package/dist/cjs/features/session_replay/shared/recorder.js +3 -2
- package/dist/cjs/features/session_trace/aggregate/index.js +0 -2
- package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -2
- package/dist/cjs/features/utils/aggregate-base.js +45 -47
- package/dist/cjs/loaders/api/addPageAction.js +2 -2
- package/dist/cjs/loaders/api/log.js +2 -2
- package/dist/cjs/loaders/api/noticeError.js +2 -2
- package/dist/cjs/loaders/api/register-api-types.js +5 -5
- package/dist/cjs/loaders/api/register.js +80 -97
- package/dist/esm/common/config/init-types.js +1 -1
- package/dist/esm/common/config/init.js +7 -1
- package/dist/esm/common/config/runtime.js +1 -1
- package/dist/esm/common/constants/agent-constants.js +9 -1
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/drain/drain.js +1 -1
- package/dist/esm/common/harvest/harvester.js +30 -39
- package/dist/esm/common/util/mfe.js +38 -0
- package/dist/esm/features/ajax/aggregate/index.js +5 -1
- package/dist/esm/features/generic_events/aggregate/index.js +9 -8
- package/dist/esm/features/generic_events/constants.js +3 -1
- package/dist/esm/features/generic_events/instrument/index.js +38 -32
- package/dist/esm/features/jserrors/aggregate/index.js +18 -17
- package/dist/esm/features/logging/aggregate/index.js +19 -15
- package/dist/esm/features/logging/shared/utils.js +3 -3
- package/dist/esm/features/page_view_event/aggregate/index.js +3 -33
- package/dist/esm/features/session_replay/aggregate/index.js +13 -13
- package/dist/esm/features/session_replay/shared/recorder.js +3 -2
- package/dist/esm/features/session_trace/aggregate/index.js +0 -2
- package/dist/esm/features/soft_navigations/aggregate/index.js +1 -2
- package/dist/esm/features/utils/aggregate-base.js +46 -48
- package/dist/esm/loaders/api/addPageAction.js +2 -2
- package/dist/esm/loaders/api/log.js +2 -2
- package/dist/esm/loaders/api/noticeError.js +2 -2
- package/dist/esm/loaders/api/register-api-types.js +5 -5
- package/dist/esm/loaders/api/register.js +80 -97
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/common/config/init-types.d.ts +4 -1
- 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/agent-constants.d.ts +7 -4
- package/dist/types/common/constants/agent-constants.d.ts.map +1 -1
- package/dist/types/common/harvest/harvester.d.ts +2 -2
- package/dist/types/common/harvest/harvester.d.ts.map +1 -1
- package/dist/types/common/util/mfe.d.ts +20 -0
- package/dist/types/common/util/mfe.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/aggregate/index.d.ts +2 -2
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/generic_events/constants.d.ts +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +3 -3
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/aggregate/index.d.ts +3 -3
- package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/shared/utils.d.ts +2 -2
- package/dist/types/features/logging/shared/utils.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -4
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +13 -4
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts +1 -0
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts +13 -5
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/loaders/api/addPageAction.d.ts +1 -1
- package/dist/types/loaders/api/addPageAction.d.ts.map +1 -1
- package/dist/types/loaders/api/log.d.ts +1 -1
- package/dist/types/loaders/api/log.d.ts.map +1 -1
- package/dist/types/loaders/api/noticeError.d.ts +1 -1
- package/dist/types/loaders/api/noticeError.d.ts.map +1 -1
- package/dist/types/loaders/api/register-api-types.d.ts +4 -4
- package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
- package/dist/types/loaders/api/register.d.ts +8 -1
- package/dist/types/loaders/api/register.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/common/config/init-types.js +1 -1
- package/src/common/config/init.js +3 -1
- package/src/common/config/runtime.js +1 -1
- package/src/common/constants/agent-constants.js +10 -0
- package/src/common/drain/drain.js +1 -1
- package/src/common/harvest/harvester.js +27 -32
- package/src/common/util/mfe.js +35 -0
- package/src/features/ajax/aggregate/index.js +7 -1
- package/src/features/generic_events/aggregate/index.js +9 -8
- package/src/features/generic_events/constants.js +3 -1
- package/src/features/generic_events/instrument/index.js +44 -35
- package/src/features/jserrors/aggregate/index.js +17 -17
- package/src/features/logging/aggregate/index.js +20 -13
- package/src/features/logging/shared/utils.js +3 -3
- package/src/features/page_view_event/aggregate/index.js +3 -28
- package/src/features/session_replay/aggregate/index.js +12 -10
- package/src/features/session_replay/shared/recorder.js +3 -2
- package/src/features/session_trace/aggregate/index.js +0 -2
- package/src/features/soft_navigations/aggregate/index.js +1 -2
- package/src/features/utils/aggregate-base.js +47 -42
- package/src/loaders/api/addPageAction.js +2 -2
- package/src/loaders/api/log.js +2 -2
- package/src/loaders/api/noticeError.js +2 -2
- package/src/loaders/api/register-api-types.js +5 -5
- package/src/loaders/api/register.js +62 -89
- package/dist/cjs/common/util/target.js +0 -34
- package/dist/cjs/features/utils/entity-manager.js +0 -46
- package/dist/cjs/features/utils/event-store-manager.js +0 -174
- package/dist/cjs/loaders/api/register-api.js +0 -165
- package/dist/esm/common/util/target.js +0 -27
- package/dist/esm/features/utils/entity-manager.js +0 -39
- package/dist/esm/features/utils/event-store-manager.js +0 -166
- package/dist/esm/loaders/api/register-api.js +0 -159
- package/dist/types/common/util/target.d.ts +0 -18
- package/dist/types/common/util/target.d.ts.map +0 -1
- package/dist/types/features/utils/entity-manager.d.ts +0 -11
- package/dist/types/features/utils/entity-manager.d.ts.map +0 -1
- package/dist/types/features/utils/event-store-manager.d.ts +0 -85
- package/dist/types/features/utils/event-store-manager.d.ts.map +0 -1
- package/dist/types/loaders/api/register-api.d.ts +0 -14
- package/dist/types/loaders/api/register-api.d.ts.map +0 -1
- package/src/common/util/target.js +0 -27
- package/src/features/utils/entity-manager.js +0 -45
- package/src/features/utils/event-store-manager.js +0 -165
- package/src/loaders/api/register-api.js +0 -152
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IAEjC,2BAsCC;IAnCC,mBAAwB;IAqC1B,6FA0EC;IAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IAEjC,2BAsCC;IAnCC,mBAAwB;IAqC1B,6FA0EC;IAED,iDAmDC;CACF;8BAhL6B,4BAA4B"}
|
|
@@ -12,10 +12,10 @@ export class Aggregate extends AggregateBase {
|
|
|
12
12
|
* * sessionTraceId: set by the `ptid=` query param
|
|
13
13
|
* * userAgent*: set by the userAgent header
|
|
14
14
|
* @param {object=} obj the event object for storing in the event buffer
|
|
15
|
-
* @param {string=}
|
|
15
|
+
* @param {string=} target the target metadata for the event to scope buffering and harvesting. Defaults to container agent config if undefined
|
|
16
16
|
* @returns void
|
|
17
17
|
*/
|
|
18
|
-
addEvent(obj?: object | undefined,
|
|
18
|
+
addEvent(obj?: object | undefined, target?: string | undefined): void;
|
|
19
19
|
serializer(eventBuffer: any): Object;
|
|
20
20
|
queryStringsBuilder(): {
|
|
21
21
|
ua: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAkBA;IACE,2BAAiC;IAGjC,2BAgOC;IA9NC,gCAAkG;IAiOpG;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,WACP,MAAM,YAAC,QAmCjB;IAED,qCAEC;IAED;;;MAEC;IAED,gCAEC;;CAkBF;8BA5T6B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"AAuBA;IACE,2BAAiC;IACjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/instrument/index.js"],"names":[],"mappings":"AAuBA;IACE,2BAAiC;IACjC,2BAgGC;IAXG,2CAA0C;IAG5C,yBAGC;CAMJ;AAED,8CAAuC;+BA9GR,6BAA6B"}
|
|
@@ -33,14 +33,14 @@ export class Aggregate extends AggregateBase {
|
|
|
33
33
|
* @param {object=} target the target to buffer and harvest to, if undefined the default configuration target is used
|
|
34
34
|
* @returns
|
|
35
35
|
*/
|
|
36
|
-
storeError(err: Error | UncaughtError, time: number, internal?: boolean | undefined, customAttributes?: object | undefined, hasReplay?: boolean | undefined, swallowReason?: string | undefined,
|
|
36
|
+
storeError(err: Error | UncaughtError, time: number, internal?: boolean | undefined, customAttributes?: object | undefined, hasReplay?: boolean | undefined, swallowReason?: string | undefined, target?: object | undefined): void;
|
|
37
37
|
/**
|
|
38
38
|
* If the event lacks an entityGuid (the default behavior), the main agent should capture the data. If the data is assigned to a sub-entity target
|
|
39
39
|
* the main agent should not capture events unless it is configured to do so.
|
|
40
|
-
* @param {string}
|
|
40
|
+
* @param {string} target - the context object for the event
|
|
41
41
|
* @returns {boolean} - whether the main agent should capture the event to its internal target
|
|
42
42
|
*/
|
|
43
|
-
shouldAllowMainAgentToCapture(
|
|
43
|
+
shouldAllowMainAgentToCapture(target: string): boolean;
|
|
44
44
|
onInteractionDone(interaction: any, wasSaved: any): void;
|
|
45
45
|
onSoftNavNotification(interactionId: any, wasFinished: any, softNavAttrs: any, interactionEndTime: any): void;
|
|
46
46
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"AAwBA;;GAEG;AAEH;IACE,2BAAiC;IACjC,2BA4BC;IAvBC,kBAAuB;IACvB,eAAoB;IACpB,qBAA0B;IAC1B,2BAAgC;IAChC,qBAAwB;IAqB1B,oDAEC;IAED;;;MAcC;IAED;;;;;;OAMG;IACH,qCAHW,SAAS,GACP,MAAM,CAgBlB;IAED;;;;;;;;;;OAUG;IACH,gBATW,KAAK,GAAC,aAAa,QACnB,MAAM,aACN,OAAO,YAAC,qBACR,MAAM,YAAC,cACP,OAAO,YAAC,kBACR,MAAM,YAAC,WACP,MAAM,YAAC,QA8GjB;IA+BD;;;;;MAKE;IACF,sCAHU,MAAM,GACJ,OAAO,CAIlB;IAGD,yDA6BC;IAED,8GAWC;;CACF;wBAzRY,OAAO,0BAA0B,EAAE,SAAS;8BAR3B,4BAA4B"}
|
|
@@ -4,8 +4,8 @@ export class Aggregate extends AggregateBase {
|
|
|
4
4
|
isSessionTrackingEnabled: any;
|
|
5
5
|
loggingMode: any;
|
|
6
6
|
updateLoggingMode(loggingMode: any): void;
|
|
7
|
-
handleLog(timestamp: any, message: any, attributes: {} | undefined, level: string | undefined,
|
|
8
|
-
serializer(eventBuffer: any
|
|
7
|
+
handleLog(timestamp: any, message: any, attributes: {} | undefined, level: string | undefined, target: any): void;
|
|
8
|
+
serializer(eventBuffer: any): {
|
|
9
9
|
common: {
|
|
10
10
|
/** Attributes in the `common` section are added to `all` logs generated in the payload */
|
|
11
11
|
attributes: any;
|
|
@@ -13,7 +13,7 @@ export class Aggregate extends AggregateBase {
|
|
|
13
13
|
/** logs section contains individual unique log entries */
|
|
14
14
|
logs: Object;
|
|
15
15
|
}[];
|
|
16
|
-
queryStringsBuilder(
|
|
16
|
+
queryStringsBuilder(): {
|
|
17
17
|
browser_monitoring_key: any;
|
|
18
18
|
};
|
|
19
19
|
/** Abort the feature, once aborted it will not resume */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,2BAsCC;IApCC,8BAAmG;IAc5F,iBAAmC;IAwB5C,0CAKC;IAED,kHA4CC;IAED;;YAIM,0FAA0F;;;QAqB5F,0DAA0D;;QAM7D;IAED;;MAEC;IAED,yDAAyD;IACzD,yBASC;IAED,yCAIC;CACF;8BA/J6B,4BAA4B"}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @param {string} message - the log message string
|
|
4
4
|
* @param {{[key: string]: *}} customAttributes - The log's custom attributes if any
|
|
5
5
|
* @param {enum} level - the log level enum
|
|
6
|
-
* @param {object=}
|
|
6
|
+
* @param {object=} target - the optional target provided by an api call
|
|
7
7
|
*/
|
|
8
8
|
export function bufferLog(ee: ContextualEE, message: string, customAttributes?: {
|
|
9
9
|
[key: string]: any;
|
|
10
|
-
}, level?: enum,
|
|
10
|
+
}, level?: enum, target?: object | undefined, timestamp?: number): void;
|
|
11
11
|
/**
|
|
12
12
|
* Checks if a supplied log level is acceptable for use in generating a log event
|
|
13
13
|
* @param {string} level -- must be cast to uppercase before running this test
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/shared/utils.js"],"names":[],"mappings":"AAUA;;;;;;KAMK;AACL,8BANa,YAAY,WACZ,MAAM,qBACN;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAC,CAAA;CAAC,UAClB,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/shared/utils.js"],"names":[],"mappings":"AAUA;;;;;;KAMK;AACL,8BANa,YAAY,WACZ,MAAM,qBACN;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAC,CAAA;CAAC,UAClB,IAAI,WACJ,MAAM,YAAC,4BAKnB;AAED;;;;GAIG;AACH,uCAHW,MAAM,GACJ,OAAO,CAKnB"}
|
|
@@ -8,17 +8,15 @@ export class Aggregate extends AggregateBase {
|
|
|
8
8
|
*
|
|
9
9
|
* @param {Function} cb A function to run once the RUM call has finished - Defaults to activateFeatures
|
|
10
10
|
* @param {*} customAttributes custom attributes to attach to the RUM call - Defaults to info.js
|
|
11
|
-
* @param {*} target The target to harvest to
|
|
11
|
+
* @param {*} target The target to harvest to
|
|
12
12
|
*/
|
|
13
13
|
sendRum(customAttributes?: any, target?: any): void;
|
|
14
14
|
rumStartTime: number | undefined;
|
|
15
|
-
postHarvestCleanup({ status, responseText, xhr
|
|
15
|
+
postHarvestCleanup({ status, responseText, xhr }: {
|
|
16
16
|
status: any;
|
|
17
17
|
responseText: any;
|
|
18
18
|
xhr: any;
|
|
19
|
-
targetApp: any;
|
|
20
19
|
}): void;
|
|
21
|
-
processEntities(entities: any, targetApp: any): void;
|
|
22
20
|
}
|
|
23
21
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
24
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAA2C;IAC3C,2BA0BC;IAvBC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IAuBhC;;;;;OAKG;IACH,2BAHW,GAAC,WACD,GAAC,QAsEX;IAVC,iCAAyB;IAY3B;;;;aAyCC;CACF;8BA5J6B,4BAA4B"}
|
|
@@ -8,6 +8,8 @@ export class Aggregate extends AggregateBase {
|
|
|
8
8
|
gzipper: typeof import("fflate").gzipSync | undefined;
|
|
9
9
|
/** populated with the u8 string lib async */
|
|
10
10
|
u8: typeof import("fflate").strToU8 | undefined;
|
|
11
|
+
/** flips to false if the compressor libraries cannot import */
|
|
12
|
+
shouldCompress: boolean;
|
|
11
13
|
/** set by BCS response */
|
|
12
14
|
entitled: boolean;
|
|
13
15
|
/** set at BCS response, stored in runtime */
|
|
@@ -33,10 +35,17 @@ export class Aggregate extends AggregateBase {
|
|
|
33
35
|
PRELOAD: string;
|
|
34
36
|
}): void;
|
|
35
37
|
prepUtils(): Promise<void>;
|
|
36
|
-
makeHarvestPayload(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
makeHarvestPayload(): {
|
|
39
|
+
qs: {
|
|
40
|
+
browser_monitoring_key: any;
|
|
41
|
+
type: string;
|
|
42
|
+
app_id: any;
|
|
43
|
+
protocol_version: string;
|
|
44
|
+
timestamp: any;
|
|
45
|
+
attributes: string;
|
|
46
|
+
};
|
|
47
|
+
body: any;
|
|
48
|
+
} | undefined;
|
|
40
49
|
/**
|
|
41
50
|
* returns the timestamps for the earliest and latest nodes in the provided array, even if out of order
|
|
42
51
|
* @param {Object[]} [nodes] - the nodes to evaluate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAwBA;IACE,2BAAiC;IAIjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAwBA;IACE,2BAAiC;IAIjC,sCAyFC;IA5FD,aAAe;IAKb,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;IAmEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA8ChB;IAED,2BAUC;IAED;;;;;;;;;;kBAwCC;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,sCAKC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,+CASC;IAED,yCAIC;CACF;8BA5W6B,4BAA4B"}
|
|
@@ -15,6 +15,7 @@ export class Recorder {
|
|
|
15
15
|
backloggedEvents: RecorderEvents;
|
|
16
16
|
/** Only set to true once a snapshot node has been processed. Used to block harvests from sending before we know we have a snapshot */
|
|
17
17
|
hasSeenSnapshot: boolean;
|
|
18
|
+
hasSeenMeta: boolean;
|
|
18
19
|
/** Hold on to the last meta node, so that it can be re-inserted if the meta and snapshot nodes are broken up due to harvesting */
|
|
19
20
|
lastMeta: boolean;
|
|
20
21
|
/** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAqBA;IAUE,+
|
|
1
|
+
{"version":3,"file":"recorder.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/shared/recorder.js"],"names":[],"mappings":"AAqBA;IAUE,+BAkCC;IApCD,sBAAmB;IAGjB,iDAAiD;IACjD,kBAAgC;IAEhC,QAAyB;IACzB,mBAA6C;IAC7C,cAAqC;IAErC,qBAAwB;IACxB,0FAA0F;IAC1F,eAAkE;IAElE,iHAAiH;IACjH,uBAAgD;IAChD,mFAAmF;IACnF,iCAA0D;IAC1D,uIAAuI;IACvI,yBAA4B;IAC5B,qBAAwB;IACxB,kIAAkI;IAClI,kBAAqB;IACrB,uIAAuI;IACvI,0BAAwE;IAc1E,mBAEC;IAED;;;;;;;;;MAWC;IAED,kFAAkF;IAClF,oBAGC;IAED,qDAAqD;IACrD,8CAyCC;IAED;;;;;OAKG;IACH,aAHW,GAAC,cACD,GAAC,QAiCX;IAED,yHAAyH;IACzH,yCAiCC;IAED,0HAA0H;IAC1H,yBAOC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED;;;SAGK;IACL,oCAGC;;CACF;+BAtO8B,mBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IAEjC,2BAgBC;IAZC,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,0GAA0G;IAC1G,2BAA0C;IAO5C,gLAAgL;IAChL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IAEjC,2BAgBC;IAZC,0GAA0G;IAC1G,cAAyB;IACzB,mIAAmI;IACnI,uBAA0B;IAC1B,0CAA0C;IAC1C,oBAAuB;IACvB,0GAA0G;IAC1G,2BAA0C;IAO5C,gLAAgL;IAChL,mEA4DC;IAtDG,iCAAuB;IACvB,yJAAyJ;IACzJ,UAAsC;IACtC,eAA2D;IAyBD,UAAgE;IA4B9H,qCAWC;IAED,0CAIC;IAED;;;;;;;MAgDC;IAED,8DAA8D;IAC9D,qBAUC;IAED,2DAA2D;IAC3D,uBAMC;IAED,sCAGC;CACF;8BA9L6B,4BAA4B;6BAC7B,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;OAgEC;IA3DC,2BAAwC;IACxC,iBAA8B;IAE9B,uDAA0E;IAe1E,yBAA+B;IAC/B,0CAAiC;IACjC,yBAA4C;IAyC9C,qCAUC;IAED,0EAmBC;IAED,2BAiBC;IAED;;;;;;;OAOG;IACH,6BAHW,mBAAmB,OAsB7B;;CAwGF;8BAjQ6B,4BAA4B;2CAGf,iCAAiC;4BAChD,eAAe"}
|
|
@@ -14,6 +14,16 @@ export class AggregateBase extends FeatureBase {
|
|
|
14
14
|
isRetrying: boolean;
|
|
15
15
|
harvestOpts: {};
|
|
16
16
|
events: any;
|
|
17
|
+
/** @type {Boolean} indicates if the feature supports registered entities and the harvest requirements therein. Also read by getter "harvestEndpointVersion". Controlled by feature flag in pre-release phase. */
|
|
18
|
+
get supportsRegisteredEntities(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* the endpoint version the feature uses during harvests
|
|
21
|
+
* @type {number}
|
|
22
|
+
* @returns {boolean}
|
|
23
|
+
*/
|
|
24
|
+
get harvestEndpointVersion(): number;
|
|
25
|
+
waitForDrain(): void;
|
|
26
|
+
drained: boolean | undefined;
|
|
17
27
|
/**
|
|
18
28
|
* Evaluates whether a harvest should be made early by estimating the size of the current payload. Currently, this only happens if the event storage is EventBuffer, since that triggers this method directly.
|
|
19
29
|
* If conditions are met, a new harvest will be triggered immediately.
|
|
@@ -30,26 +40,24 @@ export class AggregateBase extends FeatureBase {
|
|
|
30
40
|
* Stages the feature to be drained
|
|
31
41
|
*/
|
|
32
42
|
drain(): void;
|
|
33
|
-
drained: boolean | undefined;
|
|
34
43
|
preHarvestChecks(opts: any): boolean;
|
|
35
44
|
/**
|
|
36
45
|
* Return harvest payload. A "serializer" function can be defined on a derived class to format the payload.
|
|
37
46
|
* @param {Boolean} shouldRetryOnFail - harvester flag to backup payload for retry later if harvest request fails; this should be moved to harvester logic
|
|
38
47
|
* @param {object|undefined} opts - opts passed from the harvester to help form the payload
|
|
39
|
-
* @param {string} opts.
|
|
48
|
+
* @param {string} opts.target - the target app metadata
|
|
40
49
|
* @returns {Array} Final payload tagged with their targeting browser app. The value of `payload` can be undefined if there are no pending events for an app. This should be a minimum length of 1.
|
|
41
50
|
*/
|
|
42
51
|
makeHarvestPayload(shouldRetryOnFail?: boolean, opts?: object | undefined): any[];
|
|
43
52
|
/**
|
|
44
53
|
* Cleanup task after a harvest.
|
|
45
54
|
* @param {object} result - the cbResult object from the harvester's send method
|
|
46
|
-
* @param {object=} result.targetApp - the target app object that was used to point the harvest to the correct app
|
|
47
|
-
* @param {string=} result.targetApp.entityGuid - the entity guid of the target app
|
|
48
55
|
* @param {boolean=} result.sent - whether the harvest was sent successfully
|
|
49
56
|
* @param {boolean=} result.retry - whether the harvest should be retried
|
|
50
57
|
*/
|
|
51
58
|
postHarvestCleanup(result?: {
|
|
52
|
-
|
|
59
|
+
sent?: boolean | undefined;
|
|
60
|
+
retry?: boolean | undefined;
|
|
53
61
|
}): void;
|
|
54
62
|
/**
|
|
55
63
|
* Checks for additional `jsAttributes` items to support backward compatibility with implementations of the agent where
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAmBA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EAoBhB;IAhBC,iBAAwB;IAIxB,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,gBAwBlB;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,6CAsBC;IAED;;;OAGG;IACH,2CAKC;IAHC,gBAA6C;IAK/C;;;;OAIG;IACH,uCAHW,GAAC,UACD,GAAC,QAIX;;CACF;4BApO2B,gBAAgB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export function setupAddPageActionAPI(agent: any): void;
|
|
2
|
-
export function addPageAction(name: any, attributes: any, agentRef: any,
|
|
2
|
+
export function addPageAction(name: any, attributes: any, agentRef: any, target: any, timestamp?: number): void;
|
|
3
3
|
//# sourceMappingURL=addPageAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addPageAction.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/addPageAction.js"],"names":[],"mappings":"AAUA,wDAEC;AAED,
|
|
1
|
+
{"version":3,"file":"addPageAction.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/addPageAction.js"],"names":[],"mappings":"AAUA,wDAEC;AAED,gHAEC"}
|
|
@@ -2,5 +2,5 @@ export function setupLogAPI(agent: any): void;
|
|
|
2
2
|
export function log(message: any, { customAttributes, level }: {
|
|
3
3
|
customAttributes?: {} | undefined;
|
|
4
4
|
level?: string | undefined;
|
|
5
|
-
} | undefined, agentRef: any,
|
|
5
|
+
} | undefined, agentRef: any, target: any, timestamp?: number): void;
|
|
6
6
|
//# sourceMappingURL=log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/log.js"],"names":[],"mappings":"AAWA,8CAEC;AAED
|
|
1
|
+
{"version":3,"file":"log.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/log.js"],"names":[],"mappings":"AAWA,8CAEC;AAED;;;qEAEC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export function setupNoticeErrorAPI(agent: any): void;
|
|
2
|
-
export function noticeError(err: any, customAttributes: any, agentRef: any,
|
|
2
|
+
export function noticeError(err: any, customAttributes: any, agentRef: any, target: any, timestamp?: number): void;
|
|
3
3
|
//# sourceMappingURL=noticeError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noticeError.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/noticeError.js"],"names":[],"mappings":"AAUA,sDAEC;AAED,
|
|
1
|
+
{"version":3,"file":"noticeError.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/noticeError.js"],"names":[],"mappings":"AAUA,sDAEC;AAED,mHAIC"}
|
|
@@ -35,8 +35,8 @@ export type RegisterAPIConstructor = {
|
|
|
35
35
|
* - The options for the registered entity.
|
|
36
36
|
*/
|
|
37
37
|
opts: {
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
id: string;
|
|
39
|
+
name: string;
|
|
40
40
|
};
|
|
41
41
|
};
|
|
42
42
|
export type RegisterAPIMetadata = {
|
|
@@ -49,8 +49,8 @@ export type RegisterAPIMetadata = {
|
|
|
49
49
|
*/
|
|
50
50
|
target: {
|
|
51
51
|
licenseKey: string;
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=register-api-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAac,mBAAmB;;;;;;UAM9B;QAAwB,
|
|
1
|
+
{"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAac,mBAAmB;;;;;;UAM9B;QAAwB,EAAE,EAAf,MAAM;QACO,IAAI,EAAjB,MAAM;KACnB;;;;;;sBAIa,MAAM;;;;YAEjB;QAA0B,UAAU,EAAzB,MAAM;QACS,EAAE,EAAjB,MAAM;QACS,IAAI,EAAnB,MAAM;KACnB"}
|
|
@@ -13,8 +13,15 @@ export function setupRegisterAPI(agent: any): void;
|
|
|
13
13
|
* @param {Object} agentRef the reference to the base agent instance
|
|
14
14
|
* @param {Object} handlers the shared handlers to be used by both the base agent's API and the external target's API
|
|
15
15
|
* @param {Object} target the target information to be used by the external target's API to send data to the correct location
|
|
16
|
+
* @param {string} [target.licenseKey] the license key of the target to report data to
|
|
17
|
+
* @param {string} target.id the entity ID of the target to report data to
|
|
18
|
+
* @param {string} target.name the entity name of the target to report data to
|
|
16
19
|
* @returns {RegisterAPI} the api object to be returned from the register api method
|
|
17
20
|
*/
|
|
18
|
-
export function buildRegisterApi(agentRef: Object, target:
|
|
21
|
+
export function buildRegisterApi(agentRef: Object, target: {
|
|
22
|
+
licenseKey?: string | undefined;
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}): RegisterAPI;
|
|
19
26
|
export type RegisterAPI = import("./register-api-types").RegisterAPI;
|
|
20
27
|
//# sourceMappingURL=register.d.ts.map
|
|
@@ -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":"AAiBA;;GAEG;AAEH;;;;GAIG;AACH,mDAIC;AAED;;;;;;;;;;GAUG;AACH,2CARW,MAAM,UAGd;IAAwB,UAAU;IACX,EAAE,EAAjB,MAAM;IACS,IAAI,EAAnB,MAAM;CACd,GAAU,WAAW,CAmGvB;0BA1HY,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.302.0-alpha.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
|
|
6
6
|
"description": "New Relic Browser Agent",
|
|
@@ -170,7 +170,7 @@
|
|
|
170
170
|
"runtime": {
|
|
171
171
|
"name": "node",
|
|
172
172
|
"onFail": "error",
|
|
173
|
-
"version": "22.11.0"
|
|
173
|
+
"version": ">=22.11.0"
|
|
174
174
|
},
|
|
175
175
|
"packageManager": {
|
|
176
176
|
"name": "npm",
|
|
@@ -291,4 +291,4 @@
|
|
|
291
291
|
"README.md",
|
|
292
292
|
"CHANGELOG.md"
|
|
293
293
|
]
|
|
294
|
-
}
|
|
294
|
+
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* @property {Object} [metrics]
|
|
36
36
|
* @property {boolean} [metrics.enabled] - Turn on/off the metrics feature (on by default).
|
|
37
37
|
* @property {boolean} [metrics.autoStart] - If true, the agent will automatically start the metrics feature. Otherwise, it will be in a deferred state until the `start` API method is called.
|
|
38
|
-
* @property {
|
|
38
|
+
* @property {{regex: RegExp | string, replacement: string}[]} [obfuscate] - Array of regexp and corresponding replacement patterns for obfuscating data.
|
|
39
39
|
* @property {Object} [page_action]
|
|
40
40
|
* @property {boolean} [page_action.enabled] - Must be true to allow PageAction events to be captured.
|
|
41
41
|
* @property {Object} [page_view_event]
|
|
@@ -21,6 +21,7 @@ const InitModelFn = () => {
|
|
|
21
21
|
const hiddenState = {
|
|
22
22
|
feature_flags: [],
|
|
23
23
|
experimental: {
|
|
24
|
+
allow_registered_children: false,
|
|
24
25
|
resources: false
|
|
25
26
|
},
|
|
26
27
|
mask_selector: '*',
|
|
@@ -48,7 +49,8 @@ const InitModelFn = () => {
|
|
|
48
49
|
return {
|
|
49
50
|
ajax: { deny_list: undefined, block_internal: true, enabled: true, autoStart: true },
|
|
50
51
|
api: {
|
|
51
|
-
allow_registered_children
|
|
52
|
+
get allow_registered_children () { return hiddenState.feature_flags.includes(FEATURE_FLAGS.REGISTER) || hiddenState.experimental.allow_registered_children },
|
|
53
|
+
set allow_registered_children (val) { hiddenState.experimental.allow_registered_children = val },
|
|
52
54
|
duplicate_registered_data: false
|
|
53
55
|
},
|
|
54
56
|
distributed_tracing: {
|
|
@@ -25,7 +25,6 @@ const RuntimeModel = {
|
|
|
25
25
|
customTransaction: undefined,
|
|
26
26
|
denyList: undefined,
|
|
27
27
|
disabled: false,
|
|
28
|
-
entityManager: undefined,
|
|
29
28
|
harvester: undefined,
|
|
30
29
|
isolatedBacklog: false,
|
|
31
30
|
isRecording: false, // true when actively recording, false when paused or stopped
|
|
@@ -37,6 +36,7 @@ const RuntimeModel = {
|
|
|
37
36
|
releaseIds: {},
|
|
38
37
|
session: undefined,
|
|
39
38
|
timeKeeper: undefined,
|
|
39
|
+
registeredEntities: [],
|
|
40
40
|
/** a proxy is set in agent-session to track jsAttributes changes for harvesting mechanics */
|
|
41
41
|
jsAttributesMetadata: { bytes: 0 },
|
|
42
42
|
get harvestCount () { return ++_harvestCount }
|
|
@@ -2,7 +2,17 @@
|
|
|
2
2
|
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
3
3
|
* SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
*/
|
|
5
|
+
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
6
|
+
|
|
5
7
|
export const IDEAL_PAYLOAD_SIZE = 16000
|
|
6
8
|
export const MAX_PAYLOAD_SIZE = 1000000
|
|
7
9
|
export const DEFAULT_KEY = 'NR_CONTAINER_AGENT'
|
|
8
10
|
export const SESSION_ERROR = 'SESSION_ERROR'
|
|
11
|
+
|
|
12
|
+
export const SUPPORTS_REGISTERED_ENTITIES = {
|
|
13
|
+
[FEATURE_NAMES.logging]: true,
|
|
14
|
+
// flip other features here when they are supported by DEM consumers
|
|
15
|
+
[FEATURE_NAMES.genericEvents]: false,
|
|
16
|
+
[FEATURE_NAMES.jserrors]: false,
|
|
17
|
+
[FEATURE_NAMES.ajax]: false
|
|
18
|
+
}
|
|
@@ -123,7 +123,7 @@ function drainGroup (agentIdentifier, group, activateGroup = true) {
|
|
|
123
123
|
|
|
124
124
|
if (!baseEE.isolatedBacklog) delete handlers[group]
|
|
125
125
|
baseEE.backlog[group] = null
|
|
126
|
-
baseEE.emit('drain-' + group, []) //
|
|
126
|
+
baseEE.emit('drain-' + group, []) // Informs the feature that it has drained its backlog of events, this kicks off an immediate harvest to capture any load-driven events that were buffered.
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
@@ -55,34 +55,30 @@ export class Harvester {
|
|
|
55
55
|
* @returns {boolean} True if 1+ network call was made. Note that this does not mean or guarantee that it was successful (or that all were in the case of more than 1).
|
|
56
56
|
*/
|
|
57
57
|
triggerHarvestFor (aggregateInst, localOpts = {}) {
|
|
58
|
-
|
|
58
|
+
const output = { ranSend: false, payload: undefined, endpointVersion: aggregateInst.harvestEndpointVersion || 1 }
|
|
59
|
+
if (aggregateInst.blocked) return output
|
|
59
60
|
|
|
60
61
|
const submitMethod = getSubmitMethod(localOpts)
|
|
61
|
-
if (!submitMethod) return
|
|
62
|
+
if (!submitMethod) return output
|
|
62
63
|
|
|
63
64
|
const shouldRetryOnFail = !localOpts.isFinalHarvest && submitMethod === xhrMethod // always retry all features harvests except for final
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
localOpts,
|
|
78
|
-
submitMethod,
|
|
79
|
-
cbFinished,
|
|
80
|
-
raw: aggregateInst.harvestOpts.raw,
|
|
81
|
-
featureName: aggregateInst.featureName
|
|
82
|
-
})
|
|
83
|
-
ranSend = true
|
|
65
|
+
output.payload = !localOpts.directSend ? aggregateInst.makeHarvestPayload(shouldRetryOnFail, localOpts) : localOpts.directSend?.payload // features like PVE can define the payload directly, bypassing the makeHarvestPayload logic
|
|
66
|
+
|
|
67
|
+
if (!output.payload) return output
|
|
68
|
+
|
|
69
|
+
send(this.agentRef, {
|
|
70
|
+
endpoint: FEATURE_TO_ENDPOINT[aggregateInst.featureName],
|
|
71
|
+
payload: output.payload,
|
|
72
|
+
localOpts,
|
|
73
|
+
submitMethod,
|
|
74
|
+
cbFinished,
|
|
75
|
+
raw: aggregateInst.harvestOpts.raw,
|
|
76
|
+
featureName: aggregateInst.featureName,
|
|
77
|
+
endpointVersion: output.endpointVersion
|
|
84
78
|
})
|
|
85
|
-
|
|
79
|
+
output.ranSend = true
|
|
80
|
+
|
|
81
|
+
return output
|
|
86
82
|
|
|
87
83
|
/**
|
|
88
84
|
* This is executed immediately after harvest sends the data via XHR, or if there's nothing to send. Note that this excludes on unloading / sendBeacon.
|
|
@@ -112,13 +108,13 @@ const warnings = {}
|
|
|
112
108
|
* @param {NetworkSendSpec} param0 Specification for sending data
|
|
113
109
|
* @returns {boolean} True if a network call was made. Note that this does not mean or guarantee that it was successful.
|
|
114
110
|
*/
|
|
115
|
-
export function send (agentRef, { endpoint,
|
|
111
|
+
export function send (agentRef, { endpoint, payload, localOpts = {}, submitMethod, cbFinished, raw, featureName, endpointVersion = 1 }) {
|
|
116
112
|
if (!agentRef.info.errorBeacon) return false
|
|
117
113
|
|
|
118
114
|
let { body, qs } = cleanPayload(payload)
|
|
119
115
|
|
|
120
116
|
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
|
|
117
|
+
if (cbFinished) cbFinished({ sent: false })
|
|
122
118
|
return false
|
|
123
119
|
}
|
|
124
120
|
|
|
@@ -126,8 +122,8 @@ export function send (agentRef, { endpoint, targetApp, payload, localOpts = {},
|
|
|
126
122
|
const perceivedBeacon = agentRef.init.proxy.beacon || agentRef.info.errorBeacon
|
|
127
123
|
const url = raw
|
|
128
124
|
? `${protocol}://${perceivedBeacon}/${endpoint}`
|
|
129
|
-
: `${protocol}://${perceivedBeacon}${endpoint !== RUM ? '/' + endpoint : ''}
|
|
130
|
-
const baseParams = !raw ? baseQueryString(agentRef, qs, endpoint
|
|
125
|
+
: `${protocol}://${perceivedBeacon}${endpoint !== RUM ? '/' + endpoint : ''}/${endpointVersion}/${agentRef.info.licenseKey}`
|
|
126
|
+
const baseParams = !raw ? baseQueryString(agentRef, qs, endpoint) : ''
|
|
131
127
|
let payloadParams = obj(qs, agentRef.runtime.maxBytes)
|
|
132
128
|
if (baseParams === '' && payloadParams.startsWith('&')) {
|
|
133
129
|
payloadParams = payloadParams.substring(1)
|
|
@@ -159,7 +155,7 @@ export function send (agentRef, { endpoint, targetApp, payload, localOpts = {},
|
|
|
159
155
|
result.addEventListener('loadend', function () {
|
|
160
156
|
// `this` here in block refers to the XHR object in this scope, do not change the anon function to an arrow function
|
|
161
157
|
// 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
|
|
158
|
+
const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this }
|
|
163
159
|
if (localOpts.needResponse) cbResult.responseText = this.responseText
|
|
164
160
|
cbFinished(cbResult)
|
|
165
161
|
|
|
@@ -169,7 +165,7 @@ export function send (agentRef, { endpoint, targetApp, payload, localOpts = {},
|
|
|
169
165
|
} else if (submitMethod === fetchMethod) {
|
|
170
166
|
result.then(async function (response) {
|
|
171
167
|
const status = response.status
|
|
172
|
-
const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response
|
|
168
|
+
const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response }
|
|
173
169
|
if (localOpts.needResponse) cbResult.responseText = await response.text()
|
|
174
170
|
cbFinished(cbResult)
|
|
175
171
|
/** temporary audit of consistency of harvest metadata flags */
|
|
@@ -207,7 +203,6 @@ export function send (agentRef, { endpoint, targetApp, payload, localOpts = {},
|
|
|
207
203
|
data: {
|
|
208
204
|
endpoint,
|
|
209
205
|
headers,
|
|
210
|
-
targetApp,
|
|
211
206
|
payload,
|
|
212
207
|
submitMethod: getSubmitMethodName(),
|
|
213
208
|
raw,
|
|
@@ -264,14 +259,14 @@ function cleanPayload (payload = {}) {
|
|
|
264
259
|
}
|
|
265
260
|
|
|
266
261
|
// The stuff that gets sent every time.
|
|
267
|
-
function baseQueryString (agentRef, qs, endpoint
|
|
262
|
+
function baseQueryString (agentRef, qs, endpoint) {
|
|
268
263
|
const ref = agentRef.runtime.obfuscator.obfuscateString(cleanURL('' + globalScope.location))
|
|
269
264
|
const session = agentRef.runtime.session
|
|
270
265
|
const hr = !!session?.state.sessionReplaySentFirstChunk && session?.state.sessionReplayMode === 1 && endpoint !== JSERRORS
|
|
271
266
|
const ht = !!session?.state.traceHarvestStarted && session?.state.sessionTraceMode === 1 && ![LOGS, BLOBS].includes(endpoint)
|
|
272
267
|
|
|
273
268
|
const qps = [
|
|
274
|
-
'a=' + applicationID,
|
|
269
|
+
'a=' + agentRef.info.applicationID,
|
|
275
270
|
param('sa', (agentRef.info.sa ? '' + agentRef.info.sa : '')),
|
|
276
271
|
param('v', VERSION),
|
|
277
272
|
transactionNameParam(),
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2020-2025 New Relic, Inc. All rights reserved.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @param {Object} [target] - the target to be validated
|
|
8
|
+
* @returns {boolean}
|
|
9
|
+
*/
|
|
10
|
+
export function isValidMFETarget (target = {}) {
|
|
11
|
+
return !!(target.id && target.name)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* When given a valid target, returns an object with the MFE payload attributes. Returns an empty object otherwise.
|
|
16
|
+
* @param {Object} [target] the registered target
|
|
17
|
+
* @param {AggregateInstance} [aggregateInstance] the aggregate instance calling the method
|
|
18
|
+
* @returns {{'mfe.id': *, 'mfe.name': String}|{}} returns an empty object if args are not supplied or the aggregate instance is not supporting version 2
|
|
19
|
+
*/
|
|
20
|
+
export function getVersion2Attributes (target, aggregateInstance) {
|
|
21
|
+
if (aggregateInstance?.harvestEndpointVersion !== 2) return {}
|
|
22
|
+
const containerAgentEntityGuid = aggregateInstance.agentRef.runtime.appMetadata.agents[0].entityGuid
|
|
23
|
+
if (!isValidMFETarget(target)) {
|
|
24
|
+
return {
|
|
25
|
+
'entity.guid': containerAgentEntityGuid,
|
|
26
|
+
appId: aggregateInstance.agentRef.info.applicationID
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
'mfe.id': target.id, // these field names may change as the schema is finalized
|
|
31
|
+
'mfe.name': target.name, // these field names may change as the schema is finalized
|
|
32
|
+
eventSource: 'MicroFrontendBrowserAgent', // these field names may change as the schema is finalized
|
|
33
|
+
'parent.id': containerAgentEntityGuid
|
|
34
|
+
}
|
|
35
|
+
}
|