@newrelic/browser-agent 1.246.0 → 1.247.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 +19 -0
- package/README.md +29 -2
- package/dist/cjs/common/config/state/info.js +2 -1
- package/dist/cjs/common/config/state/init.js +2 -1
- package/dist/cjs/common/config/state/loader-config.js +2 -1
- package/dist/cjs/common/config/state/runtime.js +2 -1
- package/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/common/constants/runtime.js +3 -1
- package/dist/cjs/common/dispatch/global-event.js +19 -0
- package/dist/cjs/common/session/session-entity.js +14 -9
- package/dist/cjs/common/util/feature-flags.js +17 -12
- package/dist/cjs/common/window/load.js +1 -0
- package/dist/cjs/common/window/nreum.js +18 -17
- package/dist/cjs/features/metrics/aggregate/index.js +4 -2
- package/dist/cjs/features/session_replay/aggregate/index.js +56 -16
- package/dist/cjs/features/session_trace/aggregate/index.js +32 -18
- package/dist/cjs/features/spa/aggregate/index.js +2 -1
- package/dist/cjs/features/utils/aggregate-base.js +3 -1
- package/dist/cjs/features/utils/feature-base.js +2 -2
- package/dist/cjs/features/utils/instrument-base.js +3 -3
- package/dist/cjs/loaders/agent-base.js +19 -0
- package/dist/cjs/loaders/agent.js +6 -4
- package/dist/cjs/loaders/api/api.js +10 -1
- package/dist/cjs/loaders/configure/configure.js +14 -13
- package/dist/cjs/loaders/configure/nonce.js +13 -0
- package/dist/cjs/loaders/configure/nonce.npm.js +2 -0
- package/dist/cjs/loaders/micro-agent.js +5 -4
- package/dist/esm/common/config/state/info.js +3 -2
- package/dist/esm/common/config/state/init.js +3 -2
- package/dist/esm/common/config/state/loader-config.js +3 -2
- package/dist/esm/common/config/state/runtime.js +3 -2
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/common/constants/runtime.js +1 -0
- package/dist/esm/common/dispatch/global-event.js +13 -0
- package/dist/esm/common/session/session-entity.js +14 -9
- package/dist/esm/common/util/feature-flags.js +17 -12
- package/dist/esm/common/window/load.js +1 -1
- package/dist/esm/common/window/nreum.js +16 -16
- package/dist/esm/features/metrics/aggregate/index.js +4 -2
- package/dist/esm/features/session_replay/aggregate/index.js +56 -16
- package/dist/esm/features/session_trace/aggregate/index.js +32 -18
- package/dist/esm/features/spa/aggregate/index.js +2 -1
- package/dist/esm/features/utils/aggregate-base.js +3 -1
- package/dist/esm/features/utils/feature-base.js +2 -2
- package/dist/esm/features/utils/instrument-base.js +3 -3
- package/dist/esm/loaders/agent-base.js +19 -0
- package/dist/esm/loaders/agent.js +7 -5
- package/dist/esm/loaders/api/api.js +10 -1
- package/dist/esm/loaders/configure/configure.js +15 -14
- package/dist/esm/loaders/configure/nonce.js +11 -0
- package/dist/esm/loaders/configure/nonce.npm.js +1 -0
- package/dist/esm/loaders/micro-agent.js +6 -5
- package/dist/types/common/config/state/info.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/config/state/loader-config.d.ts.map +1 -1
- package/dist/types/common/config/state/runtime.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +1 -0
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/dispatch/global-event.d.ts +2 -0
- package/dist/types/common/dispatch/global-event.d.ts.map +1 -0
- package/dist/types/common/event-emitter/contextual-ee.d.ts +2 -2
- package/dist/types/common/event-emitter/register-handler.d.ts +1 -1
- package/dist/types/common/session/session-entity.d.ts +10 -9
- package/dist/types/common/session/session-entity.d.ts.map +1 -1
- package/dist/types/common/util/feature-flags.d.ts.map +1 -1
- package/dist/types/common/vitals/constants.d.ts +8 -8
- package/dist/types/common/window/load.d.ts +1 -0
- package/dist/types/common/window/load.d.ts.map +1 -1
- package/dist/types/common/window/nreum.d.ts +9 -3
- package/dist/types/common/window/nreum.d.ts.map +1 -1
- package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/aggregate/index.d.ts +17 -7
- package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/utils/feature-base.d.ts +4 -4
- package/dist/types/features/utils/feature-base.d.ts.map +1 -1
- package/dist/types/features/utils/instrument-base.d.ts +6 -6
- package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
- package/dist/types/loaders/agent-base.d.ts +13 -0
- package/dist/types/loaders/agent-base.d.ts.map +1 -1
- package/dist/types/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts +2 -0
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts +4 -11
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/configure/nonce.d.ts +1 -0
- package/dist/types/loaders/configure/nonce.d.ts.map +1 -0
- package/dist/types/loaders/configure/nonce.npm.d.ts +1 -0
- package/dist/types/loaders/configure/nonce.npm.d.ts.map +1 -0
- package/dist/types/loaders/features/features.d.ts +9 -9
- package/dist/types/loaders/micro-agent.d.ts +2 -2
- package/dist/types/loaders/micro-agent.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/common/config/state/info.js +3 -2
- package/src/common/config/state/init.js +3 -2
- package/src/common/config/state/loader-config.js +3 -2
- package/src/common/config/state/runtime.js +3 -2
- package/src/common/constants/runtime.js +2 -0
- package/src/common/dispatch/global-event.js +12 -0
- package/src/common/session/session-entity.js +13 -9
- package/src/common/util/feature-flags.js +15 -12
- package/src/common/window/__mocks__/nreum.js +2 -1
- package/src/common/window/load.js +1 -1
- package/src/common/window/nreum.js +15 -18
- package/src/features/metrics/aggregate/index.js +5 -1
- package/src/features/session_replay/aggregate/index.js +63 -20
- package/src/features/session_trace/aggregate/index.js +31 -14
- package/src/features/spa/aggregate/index.js +2 -1
- package/src/features/utils/aggregate-base.js +1 -1
- package/src/features/utils/feature-base.js +2 -2
- package/src/features/utils/instrument-base.js +3 -3
- package/src/loaders/agent-base.js +19 -0
- package/src/loaders/agent.js +5 -5
- package/src/loaders/api/api.js +12 -1
- package/src/loaders/configure/configure.js +17 -15
- package/src/loaders/configure/nonce.js +12 -0
- package/src/loaders/configure/nonce.npm.js +1 -0
- package/src/loaders/micro-agent.js +5 -4
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export namespace VITAL_NAMES {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
let FIRST_PAINT: string;
|
|
3
|
+
let FIRST_CONTENTFUL_PAINT: string;
|
|
4
|
+
let FIRST_INPUT_DELAY: string;
|
|
5
|
+
let LARGEST_CONTENTFUL_PAINT: string;
|
|
6
|
+
let CUMULATIVE_LAYOUT_SHIFT: string;
|
|
7
|
+
let INTERACTION_TO_NEXT_PAINT: string;
|
|
8
|
+
let LONG_TASK: string;
|
|
9
|
+
let TIME_TO_FIRST_BYTE: string;
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/common/window/load.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../../src/common/window/load.js"],"names":[],"mappings":"AAEA,sCAEC;AAED,4DAGC;AAED,iDAGC"}
|
|
@@ -3,12 +3,18 @@ export function gosNREUMInfo(): any;
|
|
|
3
3
|
export function gosNREUMLoaderConfig(): any;
|
|
4
4
|
export function gosNREUMInit(): any;
|
|
5
5
|
export function gosNREUMOriginals(): any;
|
|
6
|
-
export function
|
|
6
|
+
export function setNREUMInitializedAgent(id: any, newAgentInstance: any): void;
|
|
7
|
+
/**
|
|
8
|
+
* Get the agent instance under the associated identifier on the global newrelic object.
|
|
9
|
+
* @see setNREUMInitializedAgents
|
|
10
|
+
* @returns Existing agent instance under newrelic.initializedAgent[id], or undefined if it does not exist.
|
|
11
|
+
*/
|
|
12
|
+
export function getNREUMInitializedAgent(id: any): any;
|
|
7
13
|
export function addToNREUM(fnName: any, fn: any): void;
|
|
8
14
|
export function NREUMinitialized(): void;
|
|
9
15
|
export function gosCDN(): any;
|
|
10
16
|
export namespace defaults {
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
let beacon: string;
|
|
18
|
+
let errorBeacon: string;
|
|
13
19
|
}
|
|
14
20
|
//# sourceMappingURL=nreum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nreum.d.ts","sourceRoot":"","sources":["../../../../src/common/window/nreum.js"],"names":[],"mappings":"AAQA,gCAMC;AAED,oCAWC;AAED,4CASC;AAED,oCASC;AAED,yCAgBC;AAED,+
|
|
1
|
+
{"version":3,"file":"nreum.d.ts","sourceRoot":"","sources":["../../../../src/common/window/nreum.js"],"names":[],"mappings":"AAQA,gCAMC;AAED,oCAWC;AAED,4CASC;AAED,oCASC;AAED,yCAgBC;AAED,+EAQC;AAED;;;;GAIG;AACH,uDAGC;AAED,uDAGC;AAED,yCAGC;AAED,8BAMC"}
|
|
@@ -8,10 +8,10 @@ export class Aggregate extends AggregateBase {
|
|
|
8
8
|
observedAt: {};
|
|
9
9
|
pageviewReported: {};
|
|
10
10
|
errorCache: {};
|
|
11
|
-
currentBody:
|
|
11
|
+
currentBody: {} | null | undefined;
|
|
12
12
|
errorOnPage: boolean;
|
|
13
13
|
onHarvestStarted(options: any): {
|
|
14
|
-
body:
|
|
14
|
+
body: {} | null;
|
|
15
15
|
qs: {};
|
|
16
16
|
};
|
|
17
17
|
onHarvestFinished(result: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"AAuBA;;GAEG;AAEH;IACE,2BAAiC;IACjC,mDAoCC;IAjCC,kBAAuB;IACvB,eAAoB;IACpB,qBAA0B;IAC1B,eAAoB;IACpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/jserrors/aggregate/index.js"],"names":[],"mappings":"AAuBA;;GAEG;AAEH;IACE,2BAAiC;IACjC,mDAoCC;IAjCC,kBAAuB;IACvB,eAAoB;IACpB,qBAA0B;IAC1B,eAAoB;IACpB,mCAA4B;IAC5B,qBAAwB;IA8B1B;;;MAoBC;IAED,qCAWC;IAED,8BAEC;IAED,oEAMC;IAED;;;;;;OAMG;IACH,qCAHW,SAAS,GACP,MAAM,CAgBlB;IAED,4EA4FC;IAED,2CAgCC;IAED,+CA2BC;CACF;wBA7QY,OAAO,0BAA0B,EAAE,SAAS;8BAH3B,4BAA4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAYA;IACE,2BAAiC;IACjC,mDAwBC;IAED,wDAKC;IAED,iDAKC;IAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAYA;IACE,2BAAiC;IACjC,mDAwBC;IAED,wDAKC;IAED,iDAKC;IAED,qBAyCC;IAED,0BAOC;IAED,eA0CC;IAvCG,mCAAyB;CAwC9B;8BA3I6B,4BAA4B"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const AVG_COMPRESSION: 0.12;
|
|
2
2
|
export namespace RRWEB_EVENT_TYPES {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
let DomContentLoaded: number;
|
|
4
|
+
let Load: number;
|
|
5
|
+
let FullSnapshot: number;
|
|
6
|
+
let IncrementalSnapshot: number;
|
|
7
|
+
let Meta: number;
|
|
8
|
+
let Custom: number;
|
|
9
9
|
}
|
|
10
10
|
/** Vortex caps payload sizes at 1MB */
|
|
11
11
|
export const MAX_PAYLOAD_SIZE: 1000000;
|
|
@@ -47,17 +47,21 @@ export class Aggregate extends AggregateBase {
|
|
|
47
47
|
payloadBytesEstimation: number;
|
|
48
48
|
/** 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 */
|
|
49
49
|
lastMeta: any;
|
|
50
|
+
/** set by BCS response */
|
|
51
|
+
entitled: boolean;
|
|
50
52
|
/** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
|
|
51
53
|
stopRecording: () => void;
|
|
52
54
|
scheduler: HarvestScheduler | undefined;
|
|
55
|
+
switchToFull(): void;
|
|
53
56
|
/**
|
|
54
57
|
* Evaluate entitlements and sampling before starting feature mechanics, importing and configuring recording library, and setting storage state
|
|
55
58
|
* @param {boolean} entitlements - the true/false state of the "sr" flag from RUM response
|
|
56
59
|
* @param {boolean} errorSample - the true/false state of the error sampling decision
|
|
57
60
|
* @param {boolean} fullSample - the true/false state of the full sampling decision
|
|
61
|
+
* @param {boolean} ignoreSession - whether to force the method to ignore the session state and use just the sample flags
|
|
58
62
|
* @returns {void}
|
|
59
63
|
*/
|
|
60
|
-
initializeRecording(
|
|
64
|
+
initializeRecording(errorSample: boolean, fullSample: boolean, ignoreSession: boolean): void;
|
|
61
65
|
prepareHarvest(): {
|
|
62
66
|
qs: {
|
|
63
67
|
browser_monitoring_key: any;
|
|
@@ -91,6 +95,12 @@ export class Aggregate extends AggregateBase {
|
|
|
91
95
|
clearTimestamps(): void;
|
|
92
96
|
/** Estimate the payload size */
|
|
93
97
|
getPayloadSize(newBytes?: number): any;
|
|
98
|
+
/**
|
|
99
|
+
* Forces the agent into OFF mode so that changing tabs or navigating
|
|
100
|
+
* does not restart the recording. This is used when the customer calls
|
|
101
|
+
* the stopRecording API.
|
|
102
|
+
*/
|
|
103
|
+
forceStop(forceHarvest: any): void;
|
|
94
104
|
/** Abort the feature, once aborted it will not resume */
|
|
95
105
|
abort(reason?: {}): void;
|
|
96
106
|
/** Extensive research has yielded about an 88% compression factor on these payloads.
|
|
@@ -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":"AA6BA,mCAAmC;;;;;;;;;AAoCnC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDAuHC;IArHC,iHAAiH;IACjH,cAAgB;IAChB,mFAAmF;IACnF,wBAA0B;IAC1B,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,mEAAmE;IACnE,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAGpB,iEAAiE;IACjE,mBAAsB;IACtB,gDAAgD;IAChD,wBAA0B;IAE1B;;;MAGE;IACF,qBAAwB;IACxB,4IAA4I;IAC5I,iBAAoB;IACpB,+HAA+H;IAC/H,kBAAqB;IAErB;;OAEG;IACH,oBAA+B;IAE/B,qGAAqG;IACrG,+BAA+B;IAE/B,kIAAkI;IAClI,cAAyB;IAEzB,0BAA0B;IAC1B,kBAAqB;IAOrB,uIAAuI;IACvI,0BAAyE;IA0BvE,wCAKQ;IAuCZ,qBAWC;IAED;;;;;;;OAOG;IACH,iCALW,OAAO,cACP,OAAO,iBACP,OAAO,GACL,IAAI,CAuDhB;IAED;;;;;;;;;oBAkBC;IAED;;;;;;;;;MA0DC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBASC;IAED,qDAAqD;IACrD,uBA4BC;IAED,yHAAyH;IACzH,yCAsCC;IAED,0HAA0H;IAC1H,yBAGC;IAED,sBAGC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,yBASC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BApe6B,4BAA4B;iCALzB,2CAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiCA;IACE,2BAAiC;IAGjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiCA;IACE,2BAAiC;IAGjC,iEA0IC;IAxIC,kBAA+C;IAK/C,sBAAiD;IACjD,yBAAc;IACd,sBAAe;IACf,8BAAkB;IAClB,iCAAqB;IACrB,wBAA0G;IAC1G,wBAA4G;IAC5G;;4EAEwE;IACxE,kCAAyB;IAGzB,0CAAsC;IAwHxC,sEAcC;IA6CD,oDAOC;IAGD,oCAwBC;IAGD,uEAkBC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDASC;IAID,qCAkBC;IAGD,qEAUC;IAGD,mEAUC;IAGD,yBAeC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAGD;;;;;;;YAkCM;0GAC8F;;YAE9F;0FAC8E;;YAE9E,4IAA4I;;;;;;MAMjJ;IAED,mEA6BC;;CACF;8BA1gB6B,4BAA4B;6BAH7B,2BAA2B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"AA6BA;IACE,2BAAiC;IACjC,mDAgsBC;IA7rBC;;;;;;;;;;;;;;;;;MAkBC;IAED,uBAAsC;CA0qBzC;8BA7sB6B,4BAA4B;2BAJ/B,cAAc"}
|
|
@@ -2,10 +2,10 @@ export class FeatureBase {
|
|
|
2
2
|
constructor(agentIdentifier: any, aggregator: any, featureName: any);
|
|
3
3
|
/** @type {string} */
|
|
4
4
|
agentIdentifier: string;
|
|
5
|
-
/** @type {Aggregator} */
|
|
6
|
-
aggregator: Aggregator;
|
|
7
|
-
/** @type {
|
|
8
|
-
ee:
|
|
5
|
+
/** @type {import('../../common/aggregate/aggregator').Aggregator} */
|
|
6
|
+
aggregator: import('../../common/aggregate/aggregator').Aggregator;
|
|
7
|
+
/** @type {import('../../common/event-emitter/contextual-ee').ee} */
|
|
8
|
+
ee: any;
|
|
9
9
|
/** @type {string} */
|
|
10
10
|
featureName: string;
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAEA;IACE,qEAeC;IAdC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,
|
|
1
|
+
{"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAEA;IACE,qEAeC;IAdC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,qEAAqE;IACrE,YADW,OAAO,mCAAmC,EAAE,UAAU,CACrC;IAC5B,oEAAoE;IACpE,QAAiC;IACjC,qBAAqB;IACrB,aADW,MAAM,CACa;IAC9B;;;;OAIG;IACH,SAFU,OAAO,CAEG;CAEvB"}
|
|
@@ -6,21 +6,21 @@ export class InstrumentBase extends FeatureBase {
|
|
|
6
6
|
/**
|
|
7
7
|
* Instantiate InstrumentBase.
|
|
8
8
|
* @param {string} agentIdentifier - The unique ID of the instantiated agent (relative to global scope).
|
|
9
|
-
* @param {Aggregator} aggregator - The shared Aggregator that will handle batching and reporting of data.
|
|
9
|
+
* @param {import('../../common/aggregate/aggregator').Aggregator} aggregator - The shared Aggregator that will handle batching and reporting of data.
|
|
10
10
|
* @param {string} featureName - The name of the feature module (used to construct file path).
|
|
11
11
|
* @param {boolean} [auto=true] - Determines whether the feature should automatically register to have the draining
|
|
12
12
|
* of its pooled instrumentation data handled by the agent's centralized drain functionality, rather than draining
|
|
13
13
|
* immediately. Primarily useful for fine-grained control in tests.
|
|
14
14
|
*/
|
|
15
|
-
constructor(agentIdentifier: string, aggregator: Aggregator, featureName: string, auto?: boolean | undefined);
|
|
15
|
+
constructor(agentIdentifier: string, aggregator: import('../../common/aggregate/aggregator').Aggregator, featureName: string, auto?: boolean | undefined);
|
|
16
16
|
auto: boolean;
|
|
17
17
|
/** @type {Function | undefined} This should be set by any derived Instrument class if it has things to do when feature fails or is killed. */
|
|
18
18
|
abortHandler: Function | undefined;
|
|
19
19
|
/**
|
|
20
|
-
* @type {
|
|
20
|
+
* @type {import('./aggregate-base').AggregateBase} Holds the reference to the feature's aggregate module counterpart, if and after it has been initialized. This may not be assigned until after page loads!
|
|
21
21
|
* The only purpose of this for now is to expose it to the NREUM interface, as the feature's instrument instance is already exposed.
|
|
22
22
|
*/
|
|
23
|
-
featAggregate:
|
|
23
|
+
featAggregate: import('./aggregate-base').AggregateBase;
|
|
24
24
|
/**
|
|
25
25
|
* @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
|
|
26
26
|
* one another if there are inter-features dependencies.
|
|
@@ -36,10 +36,10 @@ export class InstrumentBase extends FeatureBase {
|
|
|
36
36
|
/**
|
|
37
37
|
* Make a determination if an aggregate class should even be imported
|
|
38
38
|
* @param {string} featureName
|
|
39
|
-
* @param {SessionEntity} session
|
|
39
|
+
* @param {import('../../common/session/session-entity').SessionEntity} session
|
|
40
40
|
* @returns
|
|
41
41
|
*/
|
|
42
|
-
shouldImportAgg(featureName: string, session: SessionEntity): boolean;
|
|
42
|
+
shouldImportAgg(featureName: string, session: import('../../common/session/session-entity').SessionEntity): boolean;
|
|
43
43
|
}
|
|
44
44
|
import { FeatureBase } from './feature-base';
|
|
45
45
|
//# sourceMappingURL=instrument-base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,
|
|
1
|
+
{"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,cACN,OAAO,mCAAmC,EAAE,UAAU,eACtD,MAAM,8BA4BhB;IArBC,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,kCAAoC;IAQtC;;;;;OAKG;IACH,mEA4DC;IAED;;;;;KAKC;IACD,6BAJS,MAAM,WACN,OAAO,qCAAqC,EAAE,aAAa,WAUnE;CACF;4BAhI2B,gBAAgB"}
|
|
@@ -70,5 +70,18 @@ export class AgentBase {
|
|
|
70
70
|
* @param {string|string[]} [featureNames] The name(s) of the features to start. If no name(s) are passed, all features will be started
|
|
71
71
|
*/
|
|
72
72
|
start(featureNames?: string | string[] | undefined): void;
|
|
73
|
+
/**
|
|
74
|
+
* Forces a replay to record. If a replay is already actively recording, this call will be ignored.
|
|
75
|
+
* If a recording has not been started, a new one will be created. If a recording has been started, but is currently not recording, it will resume recording.
|
|
76
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordReplay/}
|
|
77
|
+
*/
|
|
78
|
+
recordReplay(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Forces an active replay to pause recording. If a replay is already actively recording, this call will cause the recording to pause.
|
|
81
|
+
* If a recording is not currently recording, this call will be ignored. This API will pause both manual and automatic replays that are in progress.
|
|
82
|
+
* The only way to resume recording after manually pausing a replay is to manually record again using the recordReplay() API.
|
|
83
|
+
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordReplay/}
|
|
84
|
+
*/
|
|
85
|
+
pauseReplay(): void;
|
|
73
86
|
}
|
|
74
87
|
//# sourceMappingURL=agent-base.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-base.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent-base.js"],"names":[],"mappings":"AAIA;IACE;;;;;OAKG;IACH,oBAHW,MAAM,yCAKhB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,mCAKhB;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,IAAI,uCAK5B;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,+CAKtB;IAED;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,QAIrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,QAMrB;IAED;;;;OAIG;IACH,kCAFmB,KAAK,GAAC,MAAM,KAAK,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,QAI9D;IAED;;;;OAIG;IACH,+CAEC;IAED;;;;;OAKG;IACH,iBAHW,MAAM,MACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,0DAEC;CACF"}
|
|
1
|
+
{"version":3,"file":"agent-base.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent-base.js"],"names":[],"mappings":"AAIA;IACE;;;;;OAKG;IACH,oBAHW,MAAM,yCAKhB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,mCAKhB;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,IAAI,uCAK5B;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,+CAKtB;IAED;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,QAIrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,QAMrB;IAED;;;;OAIG;IACH,kCAFmB,KAAK,GAAC,MAAM,KAAK,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,QAI9D;IAED;;;;OAIG;IACH,+CAEC;IAED;;;;;OAKG;IACH,iBAHW,MAAM,MACN,MAAM,QAIhB;IAED;;;;OAIG;IACH,0DAEC;IAED;;;;OAIG;IACH,qBAEC;IAED;;;;;OAKG;IACH,oBAEC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AAoBA;;GAEG;AAEH;;;GAGG;AACH;IACE,oDAwBC;IAdC,oCAAsC;IACtC,yCAAiF;IACjF,yBAAkB;IAGlB,sCAAsD;IAWxD;;;;;MAOC;IAED,yBA8BC;IAID;;;;;;;;;OASG;IACH,6BAPW;QAAC,MAAM,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,QASrF;IAED;;;;OAIG;IACH,0BAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,eAFa,mBAAmB,CAI/B;CACF;kCA5GY,OAAO,yBAAyB,EAAE,mBAAmB;0BAjBxC,cAAc;2BAQb,gCAAgC"}
|
|
@@ -17,6 +17,8 @@ export function setAPI(agentIdentifier: any, forceDrain: any): {
|
|
|
17
17
|
*/
|
|
18
18
|
setApplicationVersion(value: string | null): any;
|
|
19
19
|
start(features: any): void;
|
|
20
|
+
recordReplay(): void;
|
|
21
|
+
pauseReplay(): void;
|
|
20
22
|
interaction(): any;
|
|
21
23
|
noticeError(err: any, customAttributes: any): void;
|
|
22
24
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/api.js"],"names":[],"mappings":"AAkBA,2CAoBC;AAED;;;;;IAyDE;;;;OAIG;qBAFQ,MAAM;IAWjB;;;;OAIG;iCAFQ,MAAM,GAAC,IAAI
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/api.js"],"names":[],"mappings":"AAkBA,2CAoBC;AAED;;;;;IAyDE;;;;OAIG;qBAFQ,MAAM;IAWjB;;;;OAIG;iCAFQ,MAAM,GAAC,IAAI;;;;;;EAqGvB;AArMD,0CAA0C"}
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
setCustomAttribute(name: any, value: any, persistAttribute?: boolean): any;
|
|
6
|
-
setUserId(value: string): any;
|
|
7
|
-
setApplicationVersion(value: string | null): any;
|
|
8
|
-
start(features: any): void;
|
|
9
|
-
interaction(): any;
|
|
10
|
-
noticeError(err: any, customAttributes: any): void;
|
|
11
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* Sets or re-sets the agent's configuration values from global settings. This also attach those as properties to the agent instance.
|
|
3
|
+
*/
|
|
4
|
+
export function configure(agent: any, opts: {} | undefined, loaderType: any, forceDrain: any): void;
|
|
12
5
|
//# sourceMappingURL=configure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AASA
|
|
1
|
+
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AASA;;GAEG;AACH,oGA4CC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=nonce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/nonce.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=nonce.npm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nonce.npm.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/nonce.npm.js"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export namespace FEATURE_NAMES {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
let ajax: string;
|
|
3
|
+
let jserrors: string;
|
|
4
|
+
let metrics: string;
|
|
5
|
+
let pageAction: string;
|
|
6
|
+
let pageViewEvent: string;
|
|
7
|
+
let pageViewTiming: string;
|
|
8
|
+
let sessionReplay: string;
|
|
9
|
+
let sessionTrace: string;
|
|
10
|
+
let spa: string;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* The order in which features will be instrumented. This is the traditional order. It's unclear if the order of
|
|
@@ -17,14 +17,14 @@ export class MicroAgent extends AgentBase {
|
|
|
17
17
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/start/}
|
|
18
18
|
* @param {string|string[]|undefined} name The feature name(s) to start. If no name(s) are passed, all features will be started
|
|
19
19
|
*/
|
|
20
|
-
start: (features: any) =>
|
|
20
|
+
start: (features: any) => boolean | void;
|
|
21
21
|
get config(): {
|
|
22
22
|
info: any;
|
|
23
23
|
init: any;
|
|
24
24
|
loader_config: any;
|
|
25
25
|
runtime: any;
|
|
26
26
|
};
|
|
27
|
-
run(features: any):
|
|
27
|
+
run(features: any): boolean | void;
|
|
28
28
|
}
|
|
29
29
|
import { AgentBase } from './agent-base';
|
|
30
30
|
import { Aggregator } from '../common/aggregate/aggregator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"micro-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/micro-agent.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH;IACE;;;OAGG;IACH,qBAHW,MAAM,oBACN,MAAM,
|
|
1
|
+
{"version":3,"file":"micro-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/micro-agent.js"],"names":[],"mappings":"AAoBA;;;;GAIG;AACH;IACE;;;OAGG;IACH,qBAHW,MAAM,oBACN,MAAM,cAoBhB;IAfC,wBAAsC;IACtC,6BAAiF;IACjF,aAAkB;IAMlB;;;;OAIG;IACH,yCAA2C;IAI7C;;;;;MAOC;IAED,mCAyCC;CACF;0BAzFyB,cAAc;2BAPb,gCAAgC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newrelic/browser-agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.247.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
|
|
6
6
|
"description": "New Relic Browser Agent",
|
|
@@ -251,6 +251,7 @@
|
|
|
251
251
|
"webpack-bundle-analyzer": "^4.7.0",
|
|
252
252
|
"webpack-cli": "^4.10.0",
|
|
253
253
|
"webpack-stream": "^7.0.0",
|
|
254
|
+
"webpack-subresource-integrity": "^5.1.0",
|
|
254
255
|
"yargs": "^17.6.2"
|
|
255
256
|
},
|
|
256
257
|
"files": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaults as nrDefaults,
|
|
1
|
+
import { defaults as nrDefaults, getNREUMInitializedAgent } from '../../window/nreum'
|
|
2
2
|
import { getModeledObject } from './configurable'
|
|
3
3
|
|
|
4
4
|
const model = {
|
|
@@ -45,5 +45,6 @@ export function getInfo (id) {
|
|
|
45
45
|
export function setInfo (id, obj) {
|
|
46
46
|
if (!id) throw new Error('All info objects require an agent identifier!')
|
|
47
47
|
_cache[id] = getModeledObject(obj, model)
|
|
48
|
-
|
|
48
|
+
const agentInst = getNREUMInitializedAgent(id)
|
|
49
|
+
if (agentInst) agentInst.info = _cache[id]
|
|
49
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isValidSelector } from '../../dom/query-selector'
|
|
2
2
|
import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../../session/constants'
|
|
3
3
|
import { warn } from '../../util/console'
|
|
4
|
-
import {
|
|
4
|
+
import { getNREUMInitializedAgent } from '../../window/nreum'
|
|
5
5
|
import { getModeledObject } from './configurable'
|
|
6
6
|
|
|
7
7
|
const model = () => {
|
|
@@ -114,7 +114,8 @@ export function getConfiguration (id) {
|
|
|
114
114
|
export function setConfiguration (id, obj) {
|
|
115
115
|
if (!id) throw new Error(missingAgentIdError)
|
|
116
116
|
_cache[id] = getModeledObject(obj, model())
|
|
117
|
-
|
|
117
|
+
const agentInst = getNREUMInitializedAgent(id)
|
|
118
|
+
if (agentInst) agentInst.init = _cache[id]
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
export function getConfigurationValue (id, path) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getNREUMInitializedAgent } from '../../window/nreum'
|
|
2
2
|
import { getModeledObject } from './configurable'
|
|
3
3
|
|
|
4
4
|
const model = {
|
|
@@ -21,5 +21,6 @@ export function getLoaderConfig (id) {
|
|
|
21
21
|
export function setLoaderConfig (id, obj) {
|
|
22
22
|
if (!id) throw new Error('All loader-config objects require an agent identifier!')
|
|
23
23
|
_cache[id] = getModeledObject(obj, model)
|
|
24
|
-
|
|
24
|
+
const agentInst = getNREUMInitializedAgent(id)
|
|
25
|
+
if (agentInst) agentInst.loader_config = _cache[id]
|
|
25
26
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getModeledObject } from './configurable'
|
|
2
|
-
import {
|
|
2
|
+
import { getNREUMInitializedAgent } from '../../window/nreum'
|
|
3
3
|
import { globalScope } from '../../constants/runtime'
|
|
4
4
|
import { BUILD_ENV, DIST_METHOD, VERSION } from '../../constants/env'
|
|
5
5
|
|
|
@@ -35,5 +35,6 @@ export function getRuntime (id) {
|
|
|
35
35
|
export function setRuntime (id, obj) {
|
|
36
36
|
if (!id) throw new Error('All runtime objects require an agent identifier!')
|
|
37
37
|
_cache[id] = getModeledObject(obj, model)
|
|
38
|
-
|
|
38
|
+
const agentInst = getNREUMInitializedAgent(id)
|
|
39
|
+
if (agentInst) agentInst.runtime = _cache[id]
|
|
39
40
|
}
|
|
@@ -44,6 +44,8 @@ export const globalScope = isBrowserScope
|
|
|
44
44
|
globalThis
|
|
45
45
|
))
|
|
46
46
|
|
|
47
|
+
export const loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete'
|
|
48
|
+
|
|
47
49
|
export const initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden')
|
|
48
50
|
|
|
49
51
|
export const initialLocation = '' + globalScope?.location
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { globalScope } from '../constants/runtime'
|
|
2
|
+
|
|
3
|
+
const GLOBAL_EVENT_NAMESPACE = 'newrelic'
|
|
4
|
+
|
|
5
|
+
export function dispatchGlobalEvent (detail = {}) {
|
|
6
|
+
try {
|
|
7
|
+
globalScope.dispatchEvent(new CustomEvent(GLOBAL_EVENT_NAMESPACE, { detail }))
|
|
8
|
+
} catch (err) {
|
|
9
|
+
// something happened... dispatchEvent or CustomEvent might not be supported
|
|
10
|
+
// decide what to do about it here
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -103,8 +103,8 @@ export class SessionEntity {
|
|
|
103
103
|
this.expiresTimer = new Timer({
|
|
104
104
|
// When the inactive timer ends, collect a SM and reset the session
|
|
105
105
|
onEnd: () => {
|
|
106
|
-
this.collectSM('expired'
|
|
107
|
-
this.collectSM('duration'
|
|
106
|
+
this.collectSM('expired')
|
|
107
|
+
this.collectSM('duration')
|
|
108
108
|
this.reset()
|
|
109
109
|
}
|
|
110
110
|
}, this.state.expiresAt - Date.now())
|
|
@@ -120,8 +120,8 @@ export class SessionEntity {
|
|
|
120
120
|
this.inactiveTimer = new InteractionTimer({
|
|
121
121
|
// When the inactive timer ends, collect a SM and reset the session
|
|
122
122
|
onEnd: () => {
|
|
123
|
-
this.collectSM('inactive'
|
|
124
|
-
this.collectSM('duration'
|
|
123
|
+
this.collectSM('inactive')
|
|
124
|
+
this.collectSM('duration')
|
|
125
125
|
this.reset()
|
|
126
126
|
},
|
|
127
127
|
// When the inactive timer refreshes, it will update the storage values with an update timestamp
|
|
@@ -172,14 +172,14 @@ export class SessionEntity {
|
|
|
172
172
|
if (this.isInvalid(obj)) return {}
|
|
173
173
|
// if the session expires, collect a SM count before resetting
|
|
174
174
|
if (this.isExpired(obj.expiresAt)) {
|
|
175
|
-
this.collectSM('expired'
|
|
175
|
+
this.collectSM('expired')
|
|
176
176
|
this.collectSM('duration', obj, true)
|
|
177
177
|
return this.reset()
|
|
178
178
|
}
|
|
179
179
|
// if "inactive" timer is expired at "read" time -- esp. initial read -- reset
|
|
180
180
|
// collect a SM count before resetting
|
|
181
181
|
if (this.isExpired(obj.inactiveAt)) {
|
|
182
|
-
this.collectSM('inactive'
|
|
182
|
+
this.collectSM('inactive')
|
|
183
183
|
this.collectSM('duration', obj, true)
|
|
184
184
|
return this.reset()
|
|
185
185
|
}
|
|
@@ -271,9 +271,7 @@ export class SessionEntity {
|
|
|
271
271
|
collectSM (type, data, useUpdatedAt) {
|
|
272
272
|
let value, tag
|
|
273
273
|
if (type === 'duration') {
|
|
274
|
-
|
|
275
|
-
const endingTimestamp = useUpdatedAt ? data.updatedAt : Date.now()
|
|
276
|
-
value = endingTimestamp - startingTimestamp
|
|
274
|
+
value = this.getDuration(data, useUpdatedAt)
|
|
277
275
|
tag = 'Session/Duration/Ms'
|
|
278
276
|
}
|
|
279
277
|
if (type === 'expired') tag = 'Session/Expired/Seen'
|
|
@@ -282,6 +280,12 @@ export class SessionEntity {
|
|
|
282
280
|
if (tag) handle(SUPPORTABILITY_METRIC_CHANNEL, [tag, value], undefined, FEATURE_NAMES.metrics, this.ee)
|
|
283
281
|
}
|
|
284
282
|
|
|
283
|
+
getDuration (data = this.state, useUpdatedAt) {
|
|
284
|
+
const startingTimestamp = data.expiresAt - this.expiresMs
|
|
285
|
+
const endingTimestamp = !useUpdatedAt ? data.updatedAt : Date.now()
|
|
286
|
+
return endingTimestamp - startingTimestamp
|
|
287
|
+
}
|
|
288
|
+
|
|
285
289
|
/**
|
|
286
290
|
* @param {number} futureMs - The number of ms to use to generate a future timestamp
|
|
287
291
|
* @returns {number}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { ee } from '../event-emitter/contextual-ee'
|
|
6
6
|
import { handle } from '../event-emitter/handle'
|
|
7
7
|
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
8
|
+
import { dispatchGlobalEvent } from '../dispatch/global-event'
|
|
8
9
|
|
|
9
10
|
const bucketMap = {
|
|
10
11
|
stn: [FEATURE_NAMES.sessionTrace],
|
|
@@ -20,19 +21,18 @@ const sentIds = new Set()
|
|
|
20
21
|
export function activateFeatures (flags, agentIdentifier) {
|
|
21
22
|
const sharedEE = ee.get(agentIdentifier)
|
|
22
23
|
if (!(flags && typeof flags === 'object')) return
|
|
24
|
+
if (sentIds.has(agentIdentifier)) return
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
})
|
|
35
|
-
}
|
|
26
|
+
Object.entries(flags).forEach(([flag, num]) => {
|
|
27
|
+
if (bucketMap[flag]) {
|
|
28
|
+
bucketMap[flag].forEach(feat => {
|
|
29
|
+
if (!num) handle('block-' + flag, [], undefined, feat, sharedEE)
|
|
30
|
+
else handle('feat-' + flag, [], undefined, feat, sharedEE)
|
|
31
|
+
handle('rumresp-' + flag, [Boolean(num)], undefined, feat, sharedEE) // this is a duplicate of feat-/block- but makes awaiting for 1 event easier than 2
|
|
32
|
+
})
|
|
33
|
+
} else if (num) handle('feat-' + flag, [], undefined, undefined, sharedEE) // not sure what other flags are overlooked, but there's a test for ones not in the map --
|
|
34
|
+
activatedFeatures[flag] = Boolean(num)
|
|
35
|
+
})
|
|
36
36
|
|
|
37
37
|
// Let the features waiting on their respective flags know that RUM response was received and that any missing flags are interpreted as bad entitlement / "off".
|
|
38
38
|
// Hence, those features will not be hanging forever if their flags aren't included in the response.
|
|
@@ -43,6 +43,9 @@ export function activateFeatures (flags, agentIdentifier) {
|
|
|
43
43
|
}
|
|
44
44
|
})
|
|
45
45
|
sentIds.add(agentIdentifier)
|
|
46
|
+
|
|
47
|
+
// let any window level subscribers know that the agent is running
|
|
48
|
+
dispatchGlobalEvent({ loaded: true })
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
export const activatedFeatures = {}
|
|
@@ -4,7 +4,8 @@ export const gosNREUMInfo = jest.fn(() => ({}))
|
|
|
4
4
|
export const gosNREUMLoaderConfig = jest.fn(() => ({}))
|
|
5
5
|
export const gosNREUMInit = jest.fn(() => ({}))
|
|
6
6
|
export const gosNREUMOriginals = jest.fn(() => ({}))
|
|
7
|
-
export const
|
|
7
|
+
export const setNREUMInitializedAgent = jest.fn()
|
|
8
|
+
export const getNREUMInitializedAgent = jest.fn(() => ({}))
|
|
8
9
|
export const addToNREUM = jest.fn(() => ({}))
|
|
9
10
|
export const NREUMinitialized = jest.fn(() => ({}))
|
|
10
11
|
export const gosCDN = jest.fn(() => (newrelicGlob))
|