@newrelic/browser-agent 1.239.1 → 1.240.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/README.md +4 -0
- package/dist/cjs/cdn/pro.js +3 -2
- package/dist/cjs/cdn/spa.js +4 -3
- package/dist/cjs/common/config/state/init.js +6 -0
- 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 +9 -5
- package/dist/cjs/common/harvest/harvest.js +5 -3
- package/dist/cjs/common/vitals/constants.js +17 -0
- package/dist/cjs/common/vitals/cumulative-layout-shift.js +27 -0
- package/dist/cjs/common/vitals/first-contentful-paint.js +49 -0
- package/dist/cjs/common/vitals/first-input-delay.js +32 -0
- package/dist/{esm/features/page_view_timing → cjs/common/vitals}/first-paint.js +19 -17
- package/dist/cjs/common/vitals/interaction-to-next-paint.js +29 -0
- package/dist/cjs/common/vitals/largest-contentful-paint.js +41 -0
- package/dist/cjs/common/vitals/long-task.js +64 -0
- package/dist/cjs/common/vitals/time-to-first-byte.js +36 -0
- package/dist/cjs/common/vitals/vital-metric.js +71 -0
- package/dist/cjs/features/ajax/aggregate/index.js +4 -1
- package/dist/cjs/features/metrics/aggregate/index.js +7 -0
- package/dist/cjs/features/page_view_event/aggregate/index.js +18 -40
- package/dist/cjs/features/page_view_event/constants.js +2 -8
- package/dist/cjs/features/page_view_event/instrument/index.js +0 -22
- package/dist/cjs/features/page_view_timing/aggregate/index.js +27 -138
- package/dist/cjs/features/page_view_timing/instrument/index.js +0 -3
- package/dist/cjs/features/session_trace/aggregate/index.js +13 -1
- package/dist/cjs/features/spa/aggregate/index.js +4 -3
- package/dist/cjs/loaders/agent.js +3 -0
- package/dist/cjs/loaders/api/api.js +2 -0
- package/dist/cjs/loaders/api/apiAsync.js +4 -2
- package/dist/cjs/loaders/configure/configure.js +13 -1
- package/dist/cjs/loaders/configure/public-path.js +13 -0
- package/dist/cjs/loaders/configure/public-path.npm.js +10 -0
- package/dist/esm/cdn/pro.js +2 -1
- package/dist/esm/cdn/spa.js +2 -1
- package/dist/esm/common/config/state/init.js +6 -0
- 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 +5 -3
- package/dist/esm/common/harvest/harvest.js +6 -4
- package/dist/esm/common/vitals/constants.js +10 -0
- package/dist/esm/common/vitals/cumulative-layout-shift.js +20 -0
- package/dist/esm/common/vitals/first-contentful-paint.js +41 -0
- package/dist/esm/common/vitals/first-input-delay.js +25 -0
- package/dist/{cjs/features/page_view_timing → esm/common/vitals}/first-paint.js +12 -24
- package/dist/esm/common/vitals/interaction-to-next-paint.js +22 -0
- package/dist/esm/common/vitals/largest-contentful-paint.js +34 -0
- package/dist/esm/common/vitals/long-task.js +57 -0
- package/dist/esm/common/vitals/time-to-first-byte.js +29 -0
- package/dist/esm/common/vitals/vital-metric.js +64 -0
- package/dist/esm/features/ajax/aggregate/index.js +4 -1
- package/dist/esm/features/metrics/aggregate/index.js +8 -1
- package/dist/esm/features/page_view_event/aggregate/index.js +20 -42
- package/dist/esm/features/page_view_event/constants.js +1 -4
- package/dist/esm/features/page_view_event/instrument/index.js +0 -22
- package/dist/esm/features/page_view_timing/aggregate/index.js +28 -139
- package/dist/esm/features/page_view_timing/instrument/index.js +0 -3
- package/dist/esm/features/session_trace/aggregate/index.js +13 -1
- package/dist/esm/features/spa/aggregate/index.js +4 -3
- package/dist/esm/loaders/agent.js +2 -0
- package/dist/esm/loaders/api/api.js +2 -0
- package/dist/esm/loaders/api/apiAsync.js +5 -3
- package/dist/esm/loaders/configure/configure.js +13 -1
- package/dist/esm/loaders/configure/public-path.js +6 -0
- package/dist/esm/loaders/configure/public-path.npm.js +3 -0
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +3 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/harvest/harvest.d.ts +0 -1
- package/dist/types/common/harvest/harvest.d.ts.map +1 -1
- package/dist/types/common/vitals/constants.d.ts +11 -0
- package/dist/types/common/vitals/constants.d.ts.map +1 -0
- package/dist/types/common/vitals/cumulative-layout-shift.d.ts +3 -0
- package/dist/types/common/vitals/cumulative-layout-shift.d.ts.map +1 -0
- package/dist/types/common/vitals/first-contentful-paint.d.ts +3 -0
- package/dist/types/common/vitals/first-contentful-paint.d.ts.map +1 -0
- package/dist/types/common/vitals/first-input-delay.d.ts +3 -0
- package/dist/types/common/vitals/first-input-delay.d.ts.map +1 -0
- package/dist/types/common/vitals/first-paint.d.ts +3 -0
- package/dist/types/common/vitals/first-paint.d.ts.map +1 -0
- package/dist/types/common/vitals/interaction-to-next-paint.d.ts +3 -0
- package/dist/types/common/vitals/interaction-to-next-paint.d.ts.map +1 -0
- package/dist/types/common/vitals/largest-contentful-paint.d.ts +3 -0
- package/dist/types/common/vitals/largest-contentful-paint.d.ts.map +1 -0
- package/dist/types/common/vitals/long-task.d.ts +3 -0
- package/dist/types/common/vitals/long-task.d.ts.map +1 -0
- package/dist/types/common/vitals/time-to-first-byte.d.ts +3 -0
- package/dist/types/common/vitals/time-to-first-byte.d.ts.map +1 -0
- package/dist/types/common/vitals/vital-metric.d.ts +18 -0
- package/dist/types/common/vitals/vital-metric.d.ts.map +1 -0
- package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts +3 -2
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/constants.d.ts +0 -3
- package/dist/types/features/page_view_event/constants.d.ts.map +1 -1
- package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts +1 -3
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -1
- package/dist/types/features/session_trace/aggregate/index.d.ts +9 -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/loaders/agent.d.ts.map +1 -1
- package/dist/types/loaders/api/api.d.ts.map +1 -1
- package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/configure/public-path.d.ts +2 -0
- package/dist/types/loaders/configure/public-path.d.ts.map +1 -0
- package/dist/types/loaders/configure/public-path.npm.d.ts +2 -0
- package/dist/types/loaders/configure/public-path.npm.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/cdn/pro.js +2 -0
- package/src/cdn/spa.js +2 -0
- package/src/common/config/state/init.js +4 -0
- package/src/common/constants/runtime.js +7 -3
- package/src/common/constants/runtime.test.js +8 -0
- package/src/common/harvest/harvest.js +6 -4
- package/src/common/harvest/harvest.test.js +17 -0
- package/src/common/vitals/__mocks__/web-vitals.js +19 -0
- package/src/common/vitals/constants.js +10 -0
- package/src/common/vitals/cumulative-layout-shift.js +13 -0
- package/src/common/vitals/cumulative-layout-shift.test.js +71 -0
- package/src/common/vitals/first-contentful-paint.js +31 -0
- package/src/common/vitals/first-contentful-paint.test.js +124 -0
- package/src/common/vitals/first-input-delay.js +20 -0
- package/src/common/vitals/first-input-delay.test.js +88 -0
- package/src/{features/page_view_timing → common/vitals}/first-paint.js +11 -17
- package/src/common/vitals/first-paint.test.js +127 -0
- package/src/common/vitals/interaction-to-next-paint.js +13 -0
- package/src/common/vitals/interaction-to-next-paint.test.js +74 -0
- package/src/common/vitals/largest-contentful-paint.js +29 -0
- package/src/common/vitals/largest-contentful-paint.test.js +94 -0
- package/src/common/vitals/long-task.js +52 -0
- package/src/common/vitals/long-task.test.js +122 -0
- package/src/common/vitals/time-to-first-byte.js +21 -0
- package/src/common/vitals/time-to-first-byte.test.js +147 -0
- package/src/common/vitals/vital-metric.js +60 -0
- package/src/common/vitals/vital-metric.test.js +171 -0
- package/src/features/ajax/aggregate/index.js +5 -1
- package/src/features/metrics/aggregate/index.js +6 -1
- package/src/features/page_view_event/aggregate/index.js +20 -43
- package/src/features/page_view_event/constants.js +0 -3
- package/src/features/page_view_event/instrument/index.js +0 -21
- package/src/features/page_view_timing/aggregate/index.component-test.js +86 -0
- package/src/features/page_view_timing/aggregate/index.js +24 -102
- package/src/features/page_view_timing/instrument/index.js +0 -3
- package/src/features/session_trace/aggregate/index.js +15 -1
- package/src/features/spa/aggregate/index.js +4 -3
- package/src/loaders/agent.js +2 -0
- package/src/loaders/api/api.js +2 -0
- package/src/loaders/api/apiAsync.js +5 -4
- package/src/loaders/configure/configure.js +15 -7
- package/src/loaders/configure/public-path.js +6 -0
- package/src/loaders/configure/public-path.npm.js +4 -0
- package/dist/cjs/common/metrics/paint-metrics.js +0 -13
- package/dist/cjs/features/page_view_timing/long-tasks.js +0 -75
- package/dist/esm/common/metrics/paint-metrics.js +0 -6
- package/dist/esm/features/page_view_timing/long-tasks.js +0 -69
- package/dist/types/common/metrics/paint-metrics.d.ts +0 -2
- package/dist/types/common/metrics/paint-metrics.d.ts.map +0 -1
- package/dist/types/features/page_view_timing/first-paint.d.ts +0 -2
- package/dist/types/features/page_view_timing/first-paint.d.ts.map +0 -1
- package/dist/types/features/page_view_timing/long-tasks.d.ts +0 -2
- package/dist/types/features/page_view_timing/long-tasks.d.ts.map +0 -1
- package/src/common/metrics/paint-metrics.js +0 -6
- package/src/features/page_view_timing/long-tasks.js +0 -60
|
@@ -4,13 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Aggregate = void 0;
|
|
7
|
-
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var _features = require("../../../loaders/features/features");
|
|
9
7
|
var _runtime = require("../../../common/constants/runtime");
|
|
10
|
-
var _webVitals = require("web-vitals");
|
|
11
8
|
var _navTiming = require("../../../common/timing/nav-timing");
|
|
12
9
|
var _stringify = require("../../../common/util/stringify");
|
|
13
|
-
var _paintMetrics = require("../../../common/metrics/paint-metrics");
|
|
14
10
|
var _config = require("../../../common/config/config");
|
|
15
11
|
var _harvest = require("../../../common/harvest/harvest");
|
|
16
12
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
@@ -18,44 +14,37 @@ var _initializedFeatures = require("./initialized-features");
|
|
|
18
14
|
var _featureFlags = require("../../../common/util/feature-flags");
|
|
19
15
|
var _console = require("../../../common/util/console");
|
|
20
16
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
17
|
+
var _firstContentfulPaint = require("../../../common/vitals/first-contentful-paint");
|
|
18
|
+
var _firstPaint = require("../../../common/vitals/first-paint");
|
|
19
|
+
var _timeToFirstByte = require("../../../common/vitals/time-to-first-byte");
|
|
21
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
22
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
22
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
24
23
|
static featureName = CONSTANTS.FEATURE_NAME;
|
|
25
24
|
constructor(agentIdentifier, aggregator) {
|
|
26
25
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
this.timeToFirstByte = 0;
|
|
27
|
+
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
28
|
+
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(0, _webVitals.onTTFB)(_ref => {
|
|
30
|
+
if (_runtime.isBrowserScope) {
|
|
31
|
+
_timeToFirstByte.timeToFirstByte.subscribe(_ref => {
|
|
34
32
|
let {
|
|
35
33
|
value,
|
|
36
34
|
entries
|
|
37
35
|
} = _ref;
|
|
38
|
-
if (this.alreadySent) return;
|
|
39
|
-
this.alreadySent = true;
|
|
40
|
-
agentRuntime[CONSTANTS.TTFB] = Math.round(value); // this is our "backend" duration; web-vitals will ensure it's lower bounded at 0
|
|
41
|
-
|
|
42
|
-
// Similar to what vitals does for ttfb, we have to factor in activation-start when calculating relative timings:
|
|
43
36
|
const navEntry = entries[0];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
agentRuntime[CONSTANTS.FBTDC] = Math.max(Math.round(navEntry.domContentLoadedEventEnd - respOrActivStart), 0); // our "dom processing" duration
|
|
37
|
+
this.timeToFirstByte = Math.max(value, this.timeToFirstByte);
|
|
38
|
+
this.firstByteToWindowLoad = Math.max(Math.round(navEntry.loadEventEnd - this.timeToFirstByte), this.firstByteToWindowLoad); // our "frontend" duration
|
|
39
|
+
this.firstByteToDomContent = Math.max(Math.round(navEntry.domContentLoadedEventEnd - this.timeToFirstByte), this.firstByteToDomContent); // our "dom processing" duration
|
|
48
40
|
|
|
49
41
|
this.sendRum();
|
|
50
42
|
});
|
|
51
43
|
} else {
|
|
52
|
-
|
|
44
|
+
// worker agent build does not get TTFB values, use default 0 values
|
|
45
|
+
this.sendRum();
|
|
53
46
|
}
|
|
54
47
|
}
|
|
55
|
-
|
|
56
|
-
getScheme() {
|
|
57
|
-
return (0, _config.getConfigurationValue)(this.agentIdentifier, 'ssl') === false ? 'http' : 'https';
|
|
58
|
-
}
|
|
59
48
|
sendRum() {
|
|
60
49
|
const info = (0, _config.getInfo)(this.agentIdentifier);
|
|
61
50
|
const agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
@@ -72,13 +61,13 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
72
61
|
// Following PR #428, which demands that all agents send RUM call, these need to be sent even outside of the main window context where PerformanceTiming
|
|
73
62
|
// or PerformanceNavigationTiming do not exists. Hence, they'll be filled in by 0s instead in, for example, worker threads that still init the PVE module.
|
|
74
63
|
this.aggregator.store('measures', 'be', {
|
|
75
|
-
value:
|
|
64
|
+
value: this.timeToFirstByte
|
|
76
65
|
});
|
|
77
66
|
this.aggregator.store('measures', 'fe', {
|
|
78
|
-
value:
|
|
67
|
+
value: this.firstByteToWindowLoad
|
|
79
68
|
});
|
|
80
69
|
this.aggregator.store('measures', 'dc', {
|
|
81
|
-
value:
|
|
70
|
+
value: this.firstByteToDomContent
|
|
82
71
|
});
|
|
83
72
|
const queryParameters = {
|
|
84
73
|
tt: info.ttGuid,
|
|
@@ -119,19 +108,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
119
108
|
queryParameters.perf = (0, _stringify.stringify)(perf);
|
|
120
109
|
}
|
|
121
110
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var entries = _runtime.globalScope.performance.getEntriesByType('paint');
|
|
125
|
-
entries.forEach(function (entry) {
|
|
126
|
-
if (!entry.startTime || entry.startTime <= 0) return;
|
|
127
|
-
if (entry.name === 'first-paint') {
|
|
128
|
-
queryParameters.fp = String(Math.floor(entry.startTime));
|
|
129
|
-
} else if (entry.name === 'first-contentful-paint') {
|
|
130
|
-
queryParameters.fcp = String(Math.floor(entry.startTime));
|
|
131
|
-
}
|
|
132
|
-
_paintMetrics.paintMetrics[entry.name] = Math.floor(entry.startTime); // this is consumed by Spa module
|
|
133
|
-
});
|
|
134
|
-
} catch (e) {}
|
|
111
|
+
queryParameters.fp = _firstPaint.firstPaint.current.value;
|
|
112
|
+
queryParameters.fcp = _firstContentfulPaint.firstContentfulPaint.current.value;
|
|
135
113
|
harvester.send({
|
|
136
114
|
endpoint: 'rum',
|
|
137
115
|
payload: {
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.FEATURE_NAME = void 0;
|
|
7
7
|
var _features = require("../../loaders/features/features");
|
|
8
8
|
const FEATURE_NAME = _features.FEATURE_NAMES.pageViewEvent;
|
|
9
|
-
exports.FEATURE_NAME = FEATURE_NAME;
|
|
10
|
-
const TTFB = 'firstbyte';
|
|
11
|
-
exports.TTFB = TTFB;
|
|
12
|
-
const FBTDC = 'domcontent';
|
|
13
|
-
exports.FBTDC = FBTDC;
|
|
14
|
-
const FBTWL = 'windowload';
|
|
15
|
-
exports.FBTWL = FBTWL;
|
|
9
|
+
exports.FEATURE_NAME = FEATURE_NAME;
|
|
@@ -4,14 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
|
-
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var _runtime = require("../../../common/constants/runtime");
|
|
9
7
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
10
8
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
11
|
-
var _features = require("../../../loaders/features/features");
|
|
12
|
-
var _config = require("../../../common/config/config");
|
|
13
|
-
var _load = require("../../../common/window/load");
|
|
14
|
-
var _now = require("../../../common/timing/now");
|
|
15
9
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
16
10
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
11
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
@@ -19,22 +13,6 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
19
13
|
constructor(agentIdentifier, aggregator) {
|
|
20
14
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
21
15
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
22
|
-
if ((typeof PerformanceNavigationTiming === 'undefined' || _runtime.isiOS) && typeof PerformanceTiming !== 'undefined') {
|
|
23
|
-
// For majority browser versions in which PNT exists, we can get load timings later from the nav entry (in the aggregate portion). At minimum, PT should exist for main window.
|
|
24
|
-
// *cli Mar'23 - iOS 15.2 & 15.4 testing in Sauce still fails with onTTFB. Hence, all iOS will fallback to this for now. Unknown if this is similar in nature to iOSBelow16 bug.
|
|
25
|
-
const agentRuntime = (0, _config.getRuntime)(agentIdentifier);
|
|
26
|
-
agentRuntime[CONSTANTS.TTFB] = Math.max(Date.now() - agentRuntime.offset, 0);
|
|
27
|
-
(0, _load.onDOMContentLoaded)(() => {
|
|
28
|
-
agentRuntime[CONSTANTS.FBTDC] = Math.max((0, _now.now)() - agentRuntime[CONSTANTS.TTFB], 0);
|
|
29
|
-
});
|
|
30
|
-
(0, _load.onWindowLoad)(() => {
|
|
31
|
-
const timeNow = (0, _now.now)();
|
|
32
|
-
agentRuntime[CONSTANTS.FBTWL] = Math.max(timeNow - agentRuntime[CONSTANTS.TTFB], 0);
|
|
33
|
-
(0, _handle.handle)('timing', ['load', timeNow], undefined, _features.FEATURE_NAMES.pageViewTiming, this.ee);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
// Else, inference: inside worker or some other env where these events are irrelevant. They'll get filled in with 0s in RUM call.
|
|
37
|
-
|
|
38
16
|
this.importAggregator();
|
|
39
17
|
}
|
|
40
18
|
}
|
|
@@ -4,20 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Aggregate = void 0;
|
|
7
|
-
var _webVitals = require("web-vitals");
|
|
8
|
-
var _firstPaint = require("../first-paint");
|
|
9
|
-
var _longTasks = require("../long-tasks");
|
|
10
|
-
var _runtime = require("../../../common/constants/runtime");
|
|
11
7
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
12
8
|
var _mapOwn = require("../../../common/util/map-own");
|
|
13
9
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
14
10
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
15
|
-
var _cleanUrl = require("../../../common/url/clean-url");
|
|
16
11
|
var _handle = require("../../../common/event-emitter/handle");
|
|
17
12
|
var _config = require("../../../common/config/config");
|
|
18
13
|
var _constants = require("../constants");
|
|
19
14
|
var _features = require("../../../loaders/features/features");
|
|
20
15
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
16
|
+
var _cumulativeLayoutShift = require("../../../common/vitals/cumulative-layout-shift");
|
|
17
|
+
var _firstContentfulPaint = require("../../../common/vitals/first-contentful-paint");
|
|
18
|
+
var _firstInputDelay = require("../../../common/vitals/first-input-delay");
|
|
19
|
+
var _firstPaint = require("../../../common/vitals/first-paint");
|
|
20
|
+
var _interactionToNextPaint = require("../../../common/vitals/interaction-to-next-paint");
|
|
21
|
+
var _largestContentfulPaint = require("../../../common/vitals/largest-contentful-paint");
|
|
22
|
+
var _timeToFirstByte = require("../../../common/vitals/time-to-first-byte");
|
|
23
|
+
var _longTask = require("../../../common/vitals/long-task");
|
|
21
24
|
/*
|
|
22
25
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
23
26
|
* SPDX-License-Identifier: Apache-2.0
|
|
@@ -25,6 +28,14 @@ var _aggregateBase = require("../../utils/aggregate-base");
|
|
|
25
28
|
|
|
26
29
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
27
30
|
static featureName = _constants.FEATURE_NAME;
|
|
31
|
+
#handleVitalMetric = _ref => {
|
|
32
|
+
let {
|
|
33
|
+
name,
|
|
34
|
+
value,
|
|
35
|
+
attrs
|
|
36
|
+
} = _ref;
|
|
37
|
+
this.addTiming(name, value, attrs);
|
|
38
|
+
};
|
|
28
39
|
constructor(agentIdentifier, aggregator) {
|
|
29
40
|
var _this;
|
|
30
41
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
@@ -32,129 +43,18 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
32
43
|
this.timings = [];
|
|
33
44
|
this.timingsSent = [];
|
|
34
45
|
this.curSessEndRecorded = false;
|
|
35
|
-
this
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/* PerformancePaintTiming API - BFC is not yet supported. */
|
|
43
|
-
(0, _firstPaint.onFirstPaint)(_ref => {
|
|
44
|
-
let {
|
|
45
|
-
name,
|
|
46
|
-
value
|
|
47
|
-
} = _ref;
|
|
48
|
-
if (pageStartedHidden) return;
|
|
49
|
-
this.addTiming(name.toLowerCase(), Math.floor(value));
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/* First Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
53
|
-
if (_runtime.iOSBelow16) {
|
|
54
|
-
try {
|
|
55
|
-
if (!pageStartedHidden) {
|
|
56
|
-
// see ios-version.js for detail on this following bug case; tldr: buffered flag doesn't work but getEntriesByType does
|
|
57
|
-
const paintEntries = performance.getEntriesByType('paint');
|
|
58
|
-
paintEntries.forEach(entry => {
|
|
59
|
-
if (entry.name === 'first-contentful-paint') {
|
|
60
|
-
this.addTiming('fcp', Math.floor(entry.startTime));
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
} catch (e) {}
|
|
65
|
-
} else {
|
|
66
|
-
(0, _webVitals.onFCP)(_ref2 => {
|
|
67
|
-
let {
|
|
68
|
-
name,
|
|
69
|
-
value
|
|
70
|
-
} = _ref2;
|
|
71
|
-
if (pageStartedHidden || this.alreadySent.has(name)) return;
|
|
72
|
-
this.alreadySent.add(name);
|
|
73
|
-
this.addTiming(name.toLowerCase(), value);
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/* First Input Delay (+"First Interaction") - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
78
|
-
(0, _webVitals.onFID)(_ref3 => {
|
|
79
|
-
let {
|
|
80
|
-
name,
|
|
81
|
-
value,
|
|
82
|
-
entries
|
|
83
|
-
} = _ref3;
|
|
84
|
-
if (pageStartedHidden || this.alreadySent.has(name) || entries.length === 0) return;
|
|
85
|
-
this.alreadySent.add(name);
|
|
86
|
-
|
|
87
|
-
// CWV will only report one (THE) first-input entry to us; fid isn't reported if there are no user interactions occurs before the *first* page hiding.
|
|
88
|
-
const fiEntry = entries[0];
|
|
89
|
-
const attributes = {
|
|
90
|
-
type: fiEntry.name,
|
|
91
|
-
fid: Math.round(value)
|
|
92
|
-
};
|
|
93
|
-
this.addConnectionAttributes(attributes);
|
|
94
|
-
this.addTiming('fi', Math.round(fiEntry.startTime), attributes);
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
/* Largest Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
|
|
98
|
-
(0, _webVitals.onLCP)(_ref4 => {
|
|
46
|
+
_firstPaint.firstPaint.subscribe(this.#handleVitalMetric);
|
|
47
|
+
_firstContentfulPaint.firstContentfulPaint.subscribe(this.#handleVitalMetric);
|
|
48
|
+
_firstInputDelay.firstInputDelay.subscribe(this.#handleVitalMetric);
|
|
49
|
+
_largestContentfulPaint.largestContentfulPaint.subscribe(this.#handleVitalMetric);
|
|
50
|
+
_interactionToNextPaint.interactionToNextPaint.subscribe(this.#handleVitalMetric);
|
|
51
|
+
_timeToFirstByte.timeToFirstByte.subscribe(_ref2 => {
|
|
99
52
|
let {
|
|
100
|
-
name,
|
|
101
|
-
value,
|
|
102
53
|
entries
|
|
103
|
-
} =
|
|
104
|
-
|
|
105
|
-
this.alreadySent.add(name);
|
|
106
|
-
const attributes = {};
|
|
107
|
-
if (entries.length > 0) {
|
|
108
|
-
// CWV will only ever report one (THE) lcp entry to us; lcp is also only reported *once* on earlier(user interaction, page hidden).
|
|
109
|
-
const lcpEntry = entries[entries.length - 1]; // this looks weird if we only expect one, but this is how cwv-attribution gets it so to be sure...
|
|
110
|
-
attributes.size = lcpEntry.size;
|
|
111
|
-
attributes.eid = lcpEntry.id;
|
|
112
|
-
if (lcpEntry.url) {
|
|
113
|
-
attributes.elUrl = (0, _cleanUrl.cleanURL)(lcpEntry.url);
|
|
114
|
-
}
|
|
115
|
-
if (lcpEntry.element?.tagName) {
|
|
116
|
-
attributes.elTag = lcpEntry.element.tagName;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
this.addConnectionAttributes(attributes);
|
|
120
|
-
this.addTiming(name.toLowerCase(), value, attributes);
|
|
54
|
+
} = _ref2;
|
|
55
|
+
this.addTiming('load', Math.round(entries[0].loadEventEnd));
|
|
121
56
|
});
|
|
122
|
-
|
|
123
|
-
/* Cumulative Layout Shift - We don't have to limit this callback since cls is stored as a state and only sent as attribute on other timings.
|
|
124
|
-
reportAllChanges ensures our tracked cls has the most recent rolling value to attach to 'unload' and 'pagehide'. */
|
|
125
|
-
(0, _webVitals.onCLS)(_ref5 => {
|
|
126
|
-
let {
|
|
127
|
-
value
|
|
128
|
-
} = _ref5;
|
|
129
|
-
this.cls = value;
|
|
130
|
-
}, {
|
|
131
|
-
reportAllChanges: true
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
/* Interaction-to-Next-Paint */
|
|
135
|
-
(0, _webVitals.onINP)(_ref6 => {
|
|
136
|
-
let {
|
|
137
|
-
name,
|
|
138
|
-
value,
|
|
139
|
-
id
|
|
140
|
-
} = _ref6;
|
|
141
|
-
return this.addTiming(name.toLowerCase(), value, {
|
|
142
|
-
metricId: id
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
/* PerformanceLongTaskTiming API */
|
|
147
|
-
if ((0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.long_task') === true) {
|
|
148
|
-
(0, _longTasks.onLongTask)(_ref7 => {
|
|
149
|
-
let {
|
|
150
|
-
name,
|
|
151
|
-
value,
|
|
152
|
-
info
|
|
153
|
-
} = _ref7;
|
|
154
|
-
return this.addTiming(name.toLowerCase(), value, info);
|
|
155
|
-
}); // lt context is passed as 'info'=attrs in the timing node
|
|
156
|
-
}
|
|
157
|
-
/* ------------------------------------End of ex-loader section */
|
|
57
|
+
if ((0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.long_task') === true) _longTask.longTask.subscribe(this.#handleVitalMetric);
|
|
158
58
|
|
|
159
59
|
/* It's important that CWV api, like "onLCP", is called before this scheduler is initialized. The reason is because they listen to the same
|
|
160
60
|
on vis change or pagehide events, and we'd want ex. onLCP to record the timing (win the race) before we try to send "final harvest". */
|
|
@@ -178,17 +78,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
178
78
|
this.drain();
|
|
179
79
|
}
|
|
180
80
|
|
|
181
|
-
// takes an attributes object and appends connection attributes if available
|
|
182
|
-
addConnectionAttributes(attributes) {
|
|
183
|
-
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection; // to date, both window & worker shares the same support for connection
|
|
184
|
-
if (!connection) return;
|
|
185
|
-
if (connection.type) attributes['net-type'] = connection.type;
|
|
186
|
-
if (connection.effectiveType) attributes['net-etype'] = connection.effectiveType;
|
|
187
|
-
if (connection.rtt) attributes['net-rtt'] = connection.rtt;
|
|
188
|
-
if (connection.downlink) attributes['net-dlink'] = connection.downlink;
|
|
189
|
-
return attributes;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
81
|
/**
|
|
193
82
|
* Add the time of _document visibilitychange to hidden_ to the next PVT harvest == NRDB pageHide attr.
|
|
194
83
|
* @param {number} timestamp
|
|
@@ -225,8 +114,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
225
114
|
Mitigation: We've set initial CLS to null so that it's omitted from timings like 'pageHide' in that edge case. It should only be included if onCLS callback was executed at least once.
|
|
226
115
|
Future: onCLS value changes should be reported directly & CLS separated into its own timing node so it's not beholden to 'pageHide' firing. It'd also be possible to report the real final CLS.
|
|
227
116
|
*/
|
|
228
|
-
if (
|
|
229
|
-
attrs.cls =
|
|
117
|
+
if (_cumulativeLayoutShift.cumulativeLayoutShift.current.value >= 0) {
|
|
118
|
+
attrs.cls = _cumulativeLayoutShift.cumulativeLayoutShift.current.value;
|
|
230
119
|
}
|
|
231
120
|
this.timings.push({
|
|
232
121
|
name,
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
7
|
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var _config = require("../../../common/config/config");
|
|
9
8
|
var _pageVisibility = require("../../../common/window/page-visibility");
|
|
10
9
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
11
10
|
var _now = require("../../../common/timing/now");
|
|
@@ -24,9 +23,7 @@ class Instrument extends _instrumentBase.InstrumentBase {
|
|
|
24
23
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
25
24
|
if (!_runtime.isBrowserScope) return; // CWV is irrelevant outside web context
|
|
26
25
|
|
|
27
|
-
// Document visibility state becomes hidden; this should run as soon as possible in page life.
|
|
28
26
|
// While we try to replicate web-vital's visibilitywatcher logic in an effort to defer that library to post-pageload, this isn't perfect and doesn't consider prerendering.
|
|
29
|
-
(0, _config.getRuntime)(agentIdentifier).initHidden = Boolean(document.visibilityState === 'hidden');
|
|
30
27
|
(0, _pageVisibility.subscribeToVisibilityChange)(() => (0, _handle.handle)('docHidden', [(0, _now.now)()], undefined, _constants.FEATURE_NAME, this.ee), true);
|
|
31
28
|
|
|
32
29
|
// Window fires its pagehide event (typically on navigation--this occurrence is a *subset* of vis change); don't defer this unless it's guarantee it cannot happen before load(?)
|
|
@@ -492,9 +492,12 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
492
492
|
// if PO isn't supported, this checks resourcetiming buffer every harvest.
|
|
493
493
|
this.storeResources(window.performance.getEntriesByType('resource'));
|
|
494
494
|
}
|
|
495
|
+
let earliestTimeStamp = Infinity;
|
|
495
496
|
const stns = Object.entries(this.trace).flatMap(_ref3 => {
|
|
496
497
|
let [name, listOfSTNodes] = _ref3;
|
|
497
498
|
// basically take the "this.trace" map-obj and concat all the list-type values
|
|
499
|
+
const oldestNodeTS = listOfSTNodes.reduce((acc, next) => !acc || next.s < acc ? next.s : acc, undefined);
|
|
500
|
+
if (oldestNodeTS < earliestTimeStamp) earliestTimeStamp = oldestNodeTS;
|
|
498
501
|
if (!(name in toAggregate)) return listOfSTNodes;
|
|
499
502
|
// Special processing for event nodes dealing with user inputs:
|
|
500
503
|
const reindexByOriginFn = this.smearEvtsByOrigin(name);
|
|
@@ -509,8 +512,17 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
509
512
|
this.nodeCount = 0;
|
|
510
513
|
return {
|
|
511
514
|
qs: {
|
|
512
|
-
st:
|
|
515
|
+
st: this.agentRuntime.offset,
|
|
516
|
+
/** hr === "hasReplay" in NR1, standalone is always checked and processed before harvesting
|
|
517
|
+
* so a race condition between ST and SR states should not be a concern if implemented here */
|
|
518
|
+
hr: Number(!this.isStandalone),
|
|
519
|
+
/** fts === "firstTimestamp" in NR1, indicates what the earliest NODE timestamp was
|
|
520
|
+
* so that blob parsing doesn't need to happen to support UI/API functions */
|
|
521
|
+
fts: this.agentRuntime.offset + earliestTimeStamp,
|
|
522
|
+
/** n === "nodeCount" in NR1, a count of nodes in the ST payload, so that blob parsing doesn't need to happen to support UI/API functions */
|
|
523
|
+
n: stns.length // node count
|
|
513
524
|
},
|
|
525
|
+
|
|
514
526
|
body: {
|
|
515
527
|
res: stns
|
|
516
528
|
}
|
|
@@ -10,7 +10,6 @@ var _denyList = require("../../../common/deny-list/deny-list");
|
|
|
10
10
|
var _mapOwn = require("../../../common/util/map-own");
|
|
11
11
|
var _navTiming = require("../../../common/timing/nav-timing");
|
|
12
12
|
var _uniqueId = require("../../../common/ids/unique-id");
|
|
13
|
-
var _paintMetrics = require("../../../common/metrics/paint-metrics");
|
|
14
13
|
var _interaction = require("./interaction");
|
|
15
14
|
var _config = require("../../../common/config/config");
|
|
16
15
|
var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
|
|
@@ -20,6 +19,8 @@ var _contextualEe = require("../../../common/event-emitter/contextual-ee");
|
|
|
20
19
|
var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
21
20
|
var _features = require("../../../loaders/features/features");
|
|
22
21
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
22
|
+
var _firstContentfulPaint = require("../../../common/vitals/first-contentful-paint");
|
|
23
|
+
var _firstPaint = require("../../../common/vitals/first-paint");
|
|
23
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
25
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
26
|
/*
|
|
@@ -662,8 +663,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
662
663
|
// assign unique id, this is serialized and used to link interactions with errors
|
|
663
664
|
interaction.root.attrs.id = (0, _uniqueId.generateUuid)();
|
|
664
665
|
if (interaction.root.attrs.trigger === 'initialPageLoad') {
|
|
665
|
-
interaction.root.attrs.firstPaint =
|
|
666
|
-
interaction.root.attrs.firstContentfulPaint =
|
|
666
|
+
interaction.root.attrs.firstPaint = _firstPaint.firstPaint.current.value;
|
|
667
|
+
interaction.root.attrs.firstContentfulPaint = _firstContentfulPaint.firstContentfulPaint.current.value;
|
|
667
668
|
}
|
|
668
669
|
baseEE.emit('interactionSaved', [interaction]);
|
|
669
670
|
state.interactionsToHarvest.push(interaction);
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Agent = void 0;
|
|
7
|
+
require("./configure/public-path.npm");
|
|
7
8
|
var _agentBase = require("./agent-base");
|
|
8
9
|
var _enabledFeatures = require("./features/enabled-features");
|
|
9
10
|
var _configure = require("./configure/configure");
|
|
@@ -17,6 +18,8 @@ var _config = require("../common/config/config");
|
|
|
17
18
|
var _console = require("../common/util/console");
|
|
18
19
|
var _stringify = require("../common/util/stringify");
|
|
19
20
|
var _runtime = require("../common/constants/runtime");
|
|
21
|
+
// important side effects
|
|
22
|
+
|
|
20
23
|
// loader files
|
|
21
24
|
|
|
22
25
|
// required features
|
|
@@ -132,6 +132,8 @@ function setAPI(agentIdentifier, forceDrain) {
|
|
|
132
132
|
};
|
|
133
133
|
apiInterface.start = features => {
|
|
134
134
|
try {
|
|
135
|
+
const smTag = !features ? 'undefined' : 'defined';
|
|
136
|
+
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ["API/start/".concat(smTag, "/called")], undefined, _features.FEATURE_NAMES.metrics, instanceEE);
|
|
135
137
|
const featNames = Object.values(_features.FEATURE_NAMES);
|
|
136
138
|
if (features === undefined) features = featNames;else {
|
|
137
139
|
features = Array.isArray(features) && features.length ? features : [features];
|
|
@@ -18,7 +18,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
18
18
|
function setAPI(agentIdentifier) {
|
|
19
19
|
var instanceEE = _contextualEe.ee.get(agentIdentifier);
|
|
20
20
|
var cycle = 0;
|
|
21
|
-
var scheme = (0, _config.getConfigurationValue)(agentIdentifier, 'ssl') === false ? 'http' : 'https';
|
|
22
21
|
var api = {
|
|
23
22
|
finished: (0, _invoke.single)(finished),
|
|
24
23
|
setErrorHandler,
|
|
@@ -74,7 +73,10 @@ function setAPI(agentIdentifier) {
|
|
|
74
73
|
cycle += 1;
|
|
75
74
|
const agentInfo = (0, _config.getInfo)(agentIdentifier);
|
|
76
75
|
if (!agentInfo.beacon) return;
|
|
77
|
-
|
|
76
|
+
const agentInit = (0, _config.getConfiguration)(agentIdentifier);
|
|
77
|
+
const scheme = agentInit.ssl === false ? 'http' : 'https';
|
|
78
|
+
const beacon = agentInit.proxy.beacon || agentInfo.beacon;
|
|
79
|
+
let url = "".concat(scheme, "://").concat(beacon, "/1/").concat(agentInfo.licenseKey);
|
|
78
80
|
url += '?a=' + agentInfo.applicationID + '&';
|
|
79
81
|
url += 't=' + requestName + '&';
|
|
80
82
|
url += 'qt=' + ~~queueTime + '&';
|
|
@@ -9,6 +9,9 @@ var _nreum = require("../../common/window/nreum");
|
|
|
9
9
|
var _config = require("../../common/config/config");
|
|
10
10
|
var _featureFlags = require("../../common/util/feature-flags");
|
|
11
11
|
var _runtime = require("../../common/constants/runtime");
|
|
12
|
+
var _publicPath = require("./public-path");
|
|
13
|
+
let alreadySetOnce = false; // the configure() function can run multiple times in agent lifecycle
|
|
14
|
+
|
|
12
15
|
function configure(agentIdentifier) {
|
|
13
16
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
14
17
|
let loaderType = arguments.length > 2 ? arguments[2] : undefined;
|
|
@@ -40,7 +43,16 @@ function configure(agentIdentifier) {
|
|
|
40
43
|
}
|
|
41
44
|
(0, _config.setInfo)(agentIdentifier, info);
|
|
42
45
|
const updatedInit = (0, _config.getConfiguration)(agentIdentifier);
|
|
43
|
-
|
|
46
|
+
const internalTrafficList = [info.beacon, info.errorBeacon];
|
|
47
|
+
if (!alreadySetOnce) {
|
|
48
|
+
alreadySetOnce = true;
|
|
49
|
+
if (updatedInit.proxy.assets) {
|
|
50
|
+
(0, _publicPath.redefinePublicPath)(updatedInit.proxy.assets + '/'); // much like the info.beacon & init.proxy.beacon, this input should not end in a slash, but one is needed for webpack concat
|
|
51
|
+
internalTrafficList.push(updatedInit.proxy.assets);
|
|
52
|
+
}
|
|
53
|
+
if (updatedInit.proxy.beacon) internalTrafficList.push(updatedInit.proxy.beacon);
|
|
54
|
+
}
|
|
55
|
+
runtime.denyList = [...(updatedInit.ajax.deny_list || []), ...(updatedInit.ajax.block_internal ? internalTrafficList : [])];
|
|
44
56
|
(0, _config.setRuntime)(agentIdentifier, runtime);
|
|
45
57
|
(0, _api.setTopLevelCallers)();
|
|
46
58
|
const api = (0, _api.setAPI)(agentIdentifier, forceDrain);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.redefinePublicPath = void 0;
|
|
7
|
+
// Set the default CDN or remote for fetching the assets; NPM shouldn't change this var.
|
|
8
|
+
|
|
9
|
+
const redefinePublicPath = url => {
|
|
10
|
+
// There's no URL validation here, so caller should check arg if need be.
|
|
11
|
+
__webpack_public_path__ = url; // eslint-disable-line
|
|
12
|
+
};
|
|
13
|
+
exports.redefinePublicPath = redefinePublicPath;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.redefinePublicPath = void 0;
|
|
7
|
+
const redefinePublicPath = () => {
|
|
8
|
+
// We don't support setting public path in webpack via NPM build.
|
|
9
|
+
};
|
|
10
|
+
exports.redefinePublicPath = redefinePublicPath;
|
package/dist/esm/cdn/pro.js
CHANGED
|
@@ -10,8 +10,9 @@ import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
|
|
|
10
10
|
import { Instrument as InstrumentErrors } from '../features/jserrors/instrument';
|
|
11
11
|
import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
|
|
12
12
|
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
|
|
13
|
+
import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
|
|
13
14
|
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
|
|
14
15
|
new Agent({
|
|
15
|
-
features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors],
|
|
16
|
+
features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors],
|
|
16
17
|
loaderType: 'pro'
|
|
17
18
|
});
|
package/dist/esm/cdn/spa.js
CHANGED
|
@@ -9,9 +9,10 @@ import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
|
|
|
9
9
|
import { Instrument as InstrumentErrors } from '../features/jserrors/instrument';
|
|
10
10
|
import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
|
|
11
11
|
import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
|
|
12
|
+
import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
|
|
12
13
|
import { Instrument as InstrumentSpa } from '../features/spa/instrument';
|
|
13
14
|
import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
|
|
14
15
|
new Agent({
|
|
15
|
-
features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSpa],
|
|
16
|
+
features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSpa],
|
|
16
17
|
loaderType: 'spa'
|
|
17
18
|
});
|
|
@@ -9,6 +9,12 @@ const model = () => {
|
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
11
|
return {
|
|
12
|
+
proxy: {
|
|
13
|
+
assets: undefined,
|
|
14
|
+
// if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
|
|
15
|
+
beacon: undefined // likewise for the url to which we send analytics
|
|
16
|
+
},
|
|
17
|
+
|
|
12
18
|
privacy: {
|
|
13
19
|
cookies_enabled: true
|
|
14
20
|
},
|