@newrelic/browser-agent 1.265.0 → 1.266.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/dist/cjs/common/config/init.js +0 -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/vitals/constants.js +0 -1
- package/dist/cjs/features/metrics/aggregate/index.js +10 -10
- package/dist/cjs/features/metrics/constants.js +5 -3
- package/dist/cjs/features/metrics/instrument/index.js +11 -8
- package/dist/cjs/features/page_view_timing/aggregate/index.js +0 -2
- package/dist/cjs/features/utils/event-buffer.js +1 -1
- package/dist/esm/common/config/init.js +0 -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/vitals/constants.js +0 -1
- package/dist/esm/features/metrics/aggregate/index.js +11 -11
- package/dist/esm/features/metrics/constants.js +3 -2
- package/dist/esm/features/metrics/instrument/index.js +11 -9
- package/dist/esm/features/page_view_timing/aggregate/index.js +0 -2
- package/dist/esm/features/utils/event-buffer.js +1 -1
- package/dist/types/common/vitals/constants.d.ts +0 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/metrics/constants.d.ts +0 -1
- package/dist/types/features/metrics/constants.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/config/init.js +1 -1
- package/src/common/vitals/constants.js +0 -1
- package/src/features/metrics/aggregate/index.js +9 -10
- package/src/features/metrics/constants.js +2 -2
- package/src/features/metrics/instrument/index.js +9 -9
- package/src/features/page_view_timing/aggregate/index.js +0 -3
- package/src/features/utils/event-buffer.js +1 -1
- package/dist/cjs/common/vitals/long-task.js +0 -61
- package/dist/esm/common/vitals/long-task.js +0 -55
- package/dist/types/common/vitals/long-task.d.ts +0 -3
- package/dist/types/common/vitals/long-task.d.ts.map +0 -1
- package/src/common/vitals/long-task.js +0 -51
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.266.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.265.1...v1.266.0) (2024-09-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Removing long task ([#1153](https://github.com/newrelic/newrelic-browser-agent/issues/1153)) ([304e395](https://github.com/newrelic/newrelic-browser-agent/commit/304e3954df9639d6d61e545fcaa0c761346a5016))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* Remove nullish coalescing inside getter ([#1180](https://github.com/newrelic/newrelic-browser-agent/issues/1180)) ([e537359](https://github.com/newrelic/newrelic-browser-agent/commit/e537359f354270fcbd607445b6853c236f0fdbfc))
|
|
17
|
+
|
|
18
|
+
## [1.265.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.265.0...v1.265.1) (2024-09-06)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* Disable websocket wrapping ([#1176](https://github.com/newrelic/newrelic-browser-agent/issues/1176)) ([5f8a0c4](https://github.com/newrelic/newrelic-browser-agent/commit/5f8a0c42fbade8f6f81471439ecc8999b1556290))
|
|
24
|
+
|
|
6
25
|
## [1.265.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.264.0...v1.265.0) (2024-08-30)
|
|
7
26
|
|
|
8
27
|
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.266.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -12,7 +12,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
|
|
|
12
12
|
/**
|
|
13
13
|
* Exposes the version of the agent
|
|
14
14
|
*/
|
|
15
|
-
const VERSION = exports.VERSION = "1.
|
|
15
|
+
const VERSION = exports.VERSION = "1.266.0";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the build type of the agent
|
|
@@ -16,8 +16,9 @@ var _eventListenerOpts = require("../../../common/event-listener/event-listener-
|
|
|
16
16
|
var _runtime2 = require("../../../common/constants/runtime");
|
|
17
17
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
18
18
|
var _drain = require("../../../common/drain/drain");
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
// import { WEBSOCKET_TAG } from '../../../common/wrap/wrap-websocket'
|
|
20
|
+
// import { handleWebsocketEvents } from './websocket-detection'
|
|
21
|
+
|
|
21
22
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
22
23
|
static featureName = _constants.FEATURE_NAME;
|
|
23
24
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -69,8 +70,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
69
70
|
} = (0, _runtime.getRuntime)(this.agentIdentifier);
|
|
70
71
|
const {
|
|
71
72
|
proxy,
|
|
72
|
-
privacy
|
|
73
|
-
page_view_timing
|
|
73
|
+
privacy
|
|
74
74
|
} = (0, _init.getConfiguration)(this.agentIdentifier);
|
|
75
75
|
if (loaderType) this.storeSupportabilityMetrics("Generic/LoaderType/".concat(loaderType, "/Detected"));
|
|
76
76
|
if (distMethod) this.storeSupportabilityMetrics("Generic/DistMethod/".concat(distMethod, "/Detected"));
|
|
@@ -88,7 +88,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
88
88
|
});
|
|
89
89
|
});
|
|
90
90
|
if (!privacy.cookies_enabled) this.storeSupportabilityMetrics('Config/SessionTracking/Disabled');
|
|
91
|
-
if (page_view_timing.long_task) this.storeSupportabilityMetrics('Config/LongTask/Enabled');
|
|
92
91
|
} else if (_runtime2.isWorkerScope) {
|
|
93
92
|
this.storeSupportabilityMetrics('Generic/Runtime/Worker/Detected');
|
|
94
93
|
} else {
|
|
@@ -136,11 +135,12 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
136
135
|
subtree: true
|
|
137
136
|
});
|
|
138
137
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
})
|
|
138
|
+
|
|
139
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach(tag => {
|
|
140
|
+
// registerHandler('buffered-' + WEBSOCKET_TAG + tag, (...args) => {
|
|
141
|
+
// handleWebsocketEvents(this.storeSupportabilityMetrics.bind(this), tag, ...args)
|
|
142
|
+
// }, this.featureName, this.ee)
|
|
143
|
+
// })
|
|
144
144
|
}
|
|
145
145
|
eachSessionChecks() {
|
|
146
146
|
if (!_runtime2.isBrowserScope) return;
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var _wrapWebsocket = require("../../common/wrap/wrap-websocket");
|
|
6
|
+
exports.SUPPORTABILITY_METRIC_CHANNEL = exports.SUPPORTABILITY_METRIC = exports.FEATURE_NAME = exports.CUSTOM_METRIC_CHANNEL = exports.CUSTOM_METRIC = void 0;
|
|
8
7
|
var _features = require("../../loaders/features/features");
|
|
8
|
+
// import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'
|
|
9
|
+
|
|
9
10
|
const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.metrics;
|
|
10
11
|
const SUPPORTABILITY_METRIC = exports.SUPPORTABILITY_METRIC = 'sm';
|
|
11
12
|
const CUSTOM_METRIC = exports.CUSTOM_METRIC = 'cm';
|
|
12
13
|
const SUPPORTABILITY_METRIC_CHANNEL = exports.SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics';
|
|
13
14
|
const CUSTOM_METRIC_CHANNEL = exports.CUSTOM_METRIC_CHANNEL = 'storeEventMetrics';
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
// export const WATCHABLE_WEB_SOCKET_EVENTS = ['new', 'send', 'close', ADD_EVENT_LISTENER_TAG]
|
|
@@ -4,20 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Metrics = exports.Instrument = void 0;
|
|
7
|
-
var _handle = require("../../../common/event-emitter/handle");
|
|
8
|
-
var _wrapWebsocket = require("../../../common/wrap/wrap-websocket");
|
|
9
7
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
10
8
|
var _constants = require("../constants");
|
|
9
|
+
// import { handle } from '../../../common/event-emitter/handle'
|
|
10
|
+
// import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
|
|
11
|
+
|
|
11
12
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
12
13
|
static featureName = _constants.FEATURE_NAME;
|
|
13
14
|
constructor(agentIdentifier, aggregator, auto = true) {
|
|
14
15
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
})
|
|
16
|
+
// wrapWebSocket(this.ee)
|
|
17
|
+
|
|
18
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach((suffix) => {
|
|
19
|
+
// this.ee.on(WEBSOCKET_TAG + suffix, (...args) => {
|
|
20
|
+
// handle('buffered-' + WEBSOCKET_TAG + suffix, [...args], undefined, this.featureName, this.ee)
|
|
21
|
+
// })
|
|
22
|
+
// })
|
|
23
|
+
|
|
21
24
|
this.importAggregator();
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -20,7 +20,6 @@ var _firstPaint = require("../../../common/vitals/first-paint");
|
|
|
20
20
|
var _interactionToNextPaint = require("../../../common/vitals/interaction-to-next-paint");
|
|
21
21
|
var _largestContentfulPaint = require("../../../common/vitals/largest-contentful-paint");
|
|
22
22
|
var _timeToFirstByte = require("../../../common/vitals/time-to-first-byte");
|
|
23
|
-
var _longTask = require("../../../common/vitals/long-task");
|
|
24
23
|
var _pageVisibility = require("../../../common/window/page-visibility");
|
|
25
24
|
var _constants2 = require("../../../common/vitals/constants");
|
|
26
25
|
var _eventBuffer = require("../../utils/event-buffer");
|
|
@@ -42,7 +41,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
42
41
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
43
42
|
this.timings = new _eventBuffer.EventBuffer();
|
|
44
43
|
this.curSessEndRecorded = false;
|
|
45
|
-
if ((0, _init.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.long_task') === true) _longTask.longTask.subscribe(this.#handleVitalMetric);
|
|
46
44
|
(0, _registerHandler.registerHandler)('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
|
|
47
45
|
(0, _registerHandler.registerHandler)('winPagehide', msTimestamp => this.recordPageUnload(msTimestamp), this.featureName, this.ee);
|
|
48
46
|
const harvestTimeSeconds = (0, _init.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.harvestTimeSeconds') || 30;
|
|
@@ -2,7 +2,7 @@ import { getConfiguration } from '../../../common/config/init';
|
|
|
2
2
|
import { getRuntime } from '../../../common/config/runtime';
|
|
3
3
|
import { registerHandler } from '../../../common/event-emitter/register-handler';
|
|
4
4
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
|
|
5
|
-
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL
|
|
5
|
+
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL /*, WATCHABLE_WEB_SOCKET_EVENTS */ } from '../constants';
|
|
6
6
|
import { getFrameworks } from './framework-detection';
|
|
7
7
|
import { isFileProtocol } from '../../../common/url/protocol';
|
|
8
8
|
import { onDOMContentLoaded } from '../../../common/window/load';
|
|
@@ -10,8 +10,9 @@ import { windowAddEventListener } from '../../../common/event-listener/event-lis
|
|
|
10
10
|
import { isBrowserScope, isWorkerScope } from '../../../common/constants/runtime';
|
|
11
11
|
import { AggregateBase } from '../../utils/aggregate-base';
|
|
12
12
|
import { deregisterDrain } from '../../../common/drain/drain';
|
|
13
|
-
import { WEBSOCKET_TAG } from '../../../common/wrap/wrap-websocket'
|
|
14
|
-
import { handleWebsocketEvents } from './websocket-detection'
|
|
13
|
+
// import { WEBSOCKET_TAG } from '../../../common/wrap/wrap-websocket'
|
|
14
|
+
// import { handleWebsocketEvents } from './websocket-detection'
|
|
15
|
+
|
|
15
16
|
export class Aggregate extends AggregateBase {
|
|
16
17
|
static featureName = FEATURE_NAME;
|
|
17
18
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -63,8 +64,7 @@ export class Aggregate extends AggregateBase {
|
|
|
63
64
|
} = getRuntime(this.agentIdentifier);
|
|
64
65
|
const {
|
|
65
66
|
proxy,
|
|
66
|
-
privacy
|
|
67
|
-
page_view_timing
|
|
67
|
+
privacy
|
|
68
68
|
} = getConfiguration(this.agentIdentifier);
|
|
69
69
|
if (loaderType) this.storeSupportabilityMetrics("Generic/LoaderType/".concat(loaderType, "/Detected"));
|
|
70
70
|
if (distMethod) this.storeSupportabilityMetrics("Generic/DistMethod/".concat(distMethod, "/Detected"));
|
|
@@ -82,7 +82,6 @@ export class Aggregate extends AggregateBase {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
if (!privacy.cookies_enabled) this.storeSupportabilityMetrics('Config/SessionTracking/Disabled');
|
|
85
|
-
if (page_view_timing.long_task) this.storeSupportabilityMetrics('Config/LongTask/Enabled');
|
|
86
85
|
} else if (isWorkerScope) {
|
|
87
86
|
this.storeSupportabilityMetrics('Generic/Runtime/Worker/Detected');
|
|
88
87
|
} else {
|
|
@@ -130,11 +129,12 @@ export class Aggregate extends AggregateBase {
|
|
|
130
129
|
subtree: true
|
|
131
130
|
});
|
|
132
131
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
})
|
|
132
|
+
|
|
133
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach(tag => {
|
|
134
|
+
// registerHandler('buffered-' + WEBSOCKET_TAG + tag, (...args) => {
|
|
135
|
+
// handleWebsocketEvents(this.storeSupportabilityMetrics.bind(this), tag, ...args)
|
|
136
|
+
// }, this.featureName, this.ee)
|
|
137
|
+
// })
|
|
138
138
|
}
|
|
139
139
|
eachSessionChecks() {
|
|
140
140
|
if (!isBrowserScope) return;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'
|
|
1
|
+
// import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'
|
|
2
2
|
import { FEATURE_NAMES } from '../../loaders/features/features';
|
|
3
3
|
export const FEATURE_NAME = FEATURE_NAMES.metrics;
|
|
4
4
|
export const SUPPORTABILITY_METRIC = 'sm';
|
|
5
5
|
export const CUSTOM_METRIC = 'cm';
|
|
6
6
|
export const SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics';
|
|
7
7
|
export const CUSTOM_METRIC_CHANNEL = 'storeEventMetrics';
|
|
8
|
-
|
|
8
|
+
|
|
9
|
+
// export const WATCHABLE_WEB_SOCKET_EVENTS = ['new', 'send', 'close', ADD_EVENT_LISTENER_TAG]
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { handle } from '../../../common/event-emitter/handle'
|
|
2
|
-
import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
|
|
1
|
+
// import { handle } from '../../../common/event-emitter/handle'
|
|
2
|
+
// import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
|
|
3
3
|
import { InstrumentBase } from '../../utils/instrument-base';
|
|
4
|
-
import { FEATURE_NAME
|
|
4
|
+
import { FEATURE_NAME /*, WATCHABLE_WEB_SOCKET_EVENTS */ } from '../constants';
|
|
5
5
|
export class Instrument extends InstrumentBase {
|
|
6
6
|
static featureName = FEATURE_NAME;
|
|
7
7
|
constructor(agentIdentifier, aggregator, auto = true) {
|
|
8
8
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
9
|
-
wrapWebSocket(this.ee)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
})
|
|
9
|
+
// wrapWebSocket(this.ee)
|
|
10
|
+
|
|
11
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach((suffix) => {
|
|
12
|
+
// this.ee.on(WEBSOCKET_TAG + suffix, (...args) => {
|
|
13
|
+
// handle('buffered-' + WEBSOCKET_TAG + suffix, [...args], undefined, this.featureName, this.ee)
|
|
14
|
+
// })
|
|
15
|
+
// })
|
|
16
|
+
|
|
15
17
|
this.importAggregator();
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -19,7 +19,6 @@ import { firstPaint } from '../../../common/vitals/first-paint';
|
|
|
19
19
|
import { interactionToNextPaint } from '../../../common/vitals/interaction-to-next-paint';
|
|
20
20
|
import { largestContentfulPaint } from '../../../common/vitals/largest-contentful-paint';
|
|
21
21
|
import { timeToFirstByte } from '../../../common/vitals/time-to-first-byte';
|
|
22
|
-
import { longTask } from '../../../common/vitals/long-task';
|
|
23
22
|
import { subscribeToVisibilityChange } from '../../../common/window/page-visibility';
|
|
24
23
|
import { VITAL_NAMES } from '../../../common/vitals/constants';
|
|
25
24
|
import { EventBuffer } from '../../utils/event-buffer';
|
|
@@ -36,7 +35,6 @@ export class Aggregate extends AggregateBase {
|
|
|
36
35
|
super(agentIdentifier, aggregator, FEATURE_NAME);
|
|
37
36
|
this.timings = new EventBuffer();
|
|
38
37
|
this.curSessEndRecorded = false;
|
|
39
|
-
if (getConfigurationValue(this.agentIdentifier, 'page_view_timing.long_task') === true) longTask.subscribe(this.#handleVitalMetric);
|
|
40
38
|
registerHandler('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
|
|
41
39
|
registerHandler('winPagehide', msTimestamp => this.recordPageUnload(msTimestamp), this.featureName, this.ee);
|
|
42
40
|
const harvestTimeSeconds = getConfigurationValue(this.agentIdentifier, 'page_view_timing.harvestTimeSeconds') || 30;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,qBAqEC;IAED,0BAOC;IAED,eAkCC;IA/BG,mCAAyB;CAgC9B;8BAhK6B,4BAA4B"}
|
|
@@ -3,5 +3,4 @@ export const SUPPORTABILITY_METRIC: "sm";
|
|
|
3
3
|
export const CUSTOM_METRIC: "cm";
|
|
4
4
|
export const SUPPORTABILITY_METRIC_CHANNEL: "storeSupportabilityMetrics";
|
|
5
5
|
export const CUSTOM_METRIC_CHANNEL: "storeEventMetrics";
|
|
6
|
-
export const WATCHABLE_WEB_SOCKET_EVENTS: string[];
|
|
7
6
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/metrics/constants.js"],"names":[],"mappings":"AAGA,kCAAiD;AACjD,yCAAyC;AACzC,iCAAiC;AACjC,yEAAyE;AACzE,wDAAwD
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/metrics/constants.js"],"names":[],"mappings":"AAGA,kCAAiD;AACjD,yCAAyC;AACzC,iCAAiC;AACjC,yEAAyE;AACzE,wDAAwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAyBA;IACE,2BAAiC;IAMjC,mDAuCC;IApCC,qBAAgC;IAChC,4BAA+B;IAqCjC;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;OAEG;IACH,uCAUC;IAED,mDAuBC;IAED,qCAGC;IAED,gDAWC;IAGD;;;;kBAUC;IAGD,8BAuBC;;CACF;8BAvK6B,4BAA4B;4BAU9B,0BAA0B"}
|
package/package.json
CHANGED
|
@@ -49,7 +49,7 @@ const model = () => {
|
|
|
49
49
|
obfuscate: undefined,
|
|
50
50
|
page_action: { enabled: true },
|
|
51
51
|
page_view_event: { enabled: true, autoStart: true },
|
|
52
|
-
page_view_timing: { enabled: true, harvestTimeSeconds: 30,
|
|
52
|
+
page_view_timing: { enabled: true, harvestTimeSeconds: 30, autoStart: true },
|
|
53
53
|
privacy: { cookies_enabled: true }, // *cli - per discussion, default should be true
|
|
54
54
|
proxy: {
|
|
55
55
|
assets: undefined, // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
|
|
@@ -2,7 +2,7 @@ import { getConfiguration } from '../../../common/config/init'
|
|
|
2
2
|
import { getRuntime } from '../../../common/config/runtime'
|
|
3
3
|
import { registerHandler } from '../../../common/event-emitter/register-handler'
|
|
4
4
|
import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler'
|
|
5
|
-
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL
|
|
5
|
+
import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL/*, WATCHABLE_WEB_SOCKET_EVENTS */ } from '../constants'
|
|
6
6
|
import { getFrameworks } from './framework-detection'
|
|
7
7
|
import { isFileProtocol } from '../../../common/url/protocol'
|
|
8
8
|
import { onDOMContentLoaded } from '../../../common/window/load'
|
|
@@ -10,8 +10,8 @@ import { windowAddEventListener } from '../../../common/event-listener/event-lis
|
|
|
10
10
|
import { isBrowserScope, isWorkerScope } from '../../../common/constants/runtime'
|
|
11
11
|
import { AggregateBase } from '../../utils/aggregate-base'
|
|
12
12
|
import { deregisterDrain } from '../../../common/drain/drain'
|
|
13
|
-
import { WEBSOCKET_TAG } from '../../../common/wrap/wrap-websocket'
|
|
14
|
-
import { handleWebsocketEvents } from './websocket-detection'
|
|
13
|
+
// import { WEBSOCKET_TAG } from '../../../common/wrap/wrap-websocket'
|
|
14
|
+
// import { handleWebsocketEvents } from './websocket-detection'
|
|
15
15
|
|
|
16
16
|
export class Aggregate extends AggregateBase {
|
|
17
17
|
static featureName = FEATURE_NAME
|
|
@@ -56,7 +56,7 @@ export class Aggregate extends AggregateBase {
|
|
|
56
56
|
singleChecks () {
|
|
57
57
|
// report loaderType
|
|
58
58
|
const { distMethod, loaderType } = getRuntime(this.agentIdentifier)
|
|
59
|
-
const { proxy, privacy
|
|
59
|
+
const { proxy, privacy } = getConfiguration(this.agentIdentifier)
|
|
60
60
|
|
|
61
61
|
if (loaderType) this.storeSupportabilityMetrics(`Generic/LoaderType/${loaderType}/Detected`)
|
|
62
62
|
if (distMethod) this.storeSupportabilityMetrics(`Generic/DistMethod/${distMethod}/Detected`)
|
|
@@ -77,7 +77,6 @@ export class Aggregate extends AggregateBase {
|
|
|
77
77
|
})
|
|
78
78
|
|
|
79
79
|
if (!privacy.cookies_enabled) this.storeSupportabilityMetrics('Config/SessionTracking/Disabled')
|
|
80
|
-
if (page_view_timing.long_task) this.storeSupportabilityMetrics('Config/LongTask/Enabled')
|
|
81
80
|
} else if (isWorkerScope) {
|
|
82
81
|
this.storeSupportabilityMetrics('Generic/Runtime/Worker/Detected')
|
|
83
82
|
} else {
|
|
@@ -118,11 +117,11 @@ export class Aggregate extends AggregateBase {
|
|
|
118
117
|
mo.observe(window.document.body, { childList: true, subtree: true })
|
|
119
118
|
}
|
|
120
119
|
|
|
121
|
-
WATCHABLE_WEB_SOCKET_EVENTS.forEach(tag => {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
})
|
|
120
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach(tag => {
|
|
121
|
+
// registerHandler('buffered-' + WEBSOCKET_TAG + tag, (...args) => {
|
|
122
|
+
// handleWebsocketEvents(this.storeSupportabilityMetrics.bind(this), tag, ...args)
|
|
123
|
+
// }, this.featureName, this.ee)
|
|
124
|
+
// })
|
|
126
125
|
}
|
|
127
126
|
|
|
128
127
|
eachSessionChecks () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'
|
|
1
|
+
// import { ADD_EVENT_LISTENER_TAG } from '../../common/wrap/wrap-websocket'
|
|
2
2
|
import { FEATURE_NAMES } from '../../loaders/features/features'
|
|
3
3
|
|
|
4
4
|
export const FEATURE_NAME = FEATURE_NAMES.metrics
|
|
@@ -7,4 +7,4 @@ export const CUSTOM_METRIC = 'cm'
|
|
|
7
7
|
export const SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics'
|
|
8
8
|
export const CUSTOM_METRIC_CHANNEL = 'storeEventMetrics'
|
|
9
9
|
|
|
10
|
-
export const WATCHABLE_WEB_SOCKET_EVENTS = ['new', 'send', 'close', ADD_EVENT_LISTENER_TAG]
|
|
10
|
+
// export const WATCHABLE_WEB_SOCKET_EVENTS = ['new', 'send', 'close', ADD_EVENT_LISTENER_TAG]
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { handle } from '../../../common/event-emitter/handle'
|
|
2
|
-
import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
|
|
1
|
+
// import { handle } from '../../../common/event-emitter/handle'
|
|
2
|
+
// import { WEBSOCKET_TAG, wrapWebSocket } from '../../../common/wrap/wrap-websocket'
|
|
3
3
|
import { InstrumentBase } from '../../utils/instrument-base'
|
|
4
|
-
import { FEATURE_NAME
|
|
4
|
+
import { FEATURE_NAME/*, WATCHABLE_WEB_SOCKET_EVENTS */ } from '../constants'
|
|
5
5
|
|
|
6
6
|
export class Instrument extends InstrumentBase {
|
|
7
7
|
static featureName = FEATURE_NAME
|
|
8
8
|
constructor (agentIdentifier, aggregator, auto = true) {
|
|
9
9
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto)
|
|
10
|
-
wrapWebSocket(this.ee)
|
|
10
|
+
// wrapWebSocket(this.ee)
|
|
11
11
|
|
|
12
|
-
WATCHABLE_WEB_SOCKET_EVENTS.forEach((suffix) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
})
|
|
12
|
+
// WATCHABLE_WEB_SOCKET_EVENTS.forEach((suffix) => {
|
|
13
|
+
// this.ee.on(WEBSOCKET_TAG + suffix, (...args) => {
|
|
14
|
+
// handle('buffered-' + WEBSOCKET_TAG + suffix, [...args], undefined, this.featureName, this.ee)
|
|
15
|
+
// })
|
|
16
|
+
// })
|
|
17
17
|
|
|
18
18
|
this.importAggregator()
|
|
19
19
|
}
|
|
@@ -19,7 +19,6 @@ import { firstPaint } from '../../../common/vitals/first-paint'
|
|
|
19
19
|
import { interactionToNextPaint } from '../../../common/vitals/interaction-to-next-paint'
|
|
20
20
|
import { largestContentfulPaint } from '../../../common/vitals/largest-contentful-paint'
|
|
21
21
|
import { timeToFirstByte } from '../../../common/vitals/time-to-first-byte'
|
|
22
|
-
import { longTask } from '../../../common/vitals/long-task'
|
|
23
22
|
import { subscribeToVisibilityChange } from '../../../common/window/page-visibility'
|
|
24
23
|
import { VITAL_NAMES } from '../../../common/vitals/constants'
|
|
25
24
|
import { EventBuffer } from '../../utils/event-buffer'
|
|
@@ -37,8 +36,6 @@ export class Aggregate extends AggregateBase {
|
|
|
37
36
|
this.timings = new EventBuffer()
|
|
38
37
|
this.curSessEndRecorded = false
|
|
39
38
|
|
|
40
|
-
if (getConfigurationValue(this.agentIdentifier, 'page_view_timing.long_task') === true) longTask.subscribe(this.#handleVitalMetric)
|
|
41
|
-
|
|
42
39
|
registerHandler('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee)
|
|
43
40
|
registerHandler('winPagehide', msTimestamp => this.recordPageUnload(msTimestamp), this.featureName, this.ee)
|
|
44
41
|
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.longTask = void 0;
|
|
7
|
-
var _runtime = require("../constants/runtime");
|
|
8
|
-
var _eol = require("../unload/eol");
|
|
9
|
-
var _constants = require("./constants");
|
|
10
|
-
var _vitalMetric = require("./vital-metric");
|
|
11
|
-
const longTask = exports.longTask = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LONG_TASK);
|
|
12
|
-
if (_runtime.isBrowserScope) {
|
|
13
|
-
const handleEntries = entries => {
|
|
14
|
-
entries.forEach(entry => {
|
|
15
|
-
longTask.update({
|
|
16
|
-
value: entry.duration,
|
|
17
|
-
attrs: {
|
|
18
|
-
ltFrame: entry.name,
|
|
19
|
-
// MDN: the browsing context or frame that can be attributed to the long task
|
|
20
|
-
ltStart: entry.startTime,
|
|
21
|
-
// MDN: a double representing the time (millisec) when the task started
|
|
22
|
-
ltCtr: entry.attribution[0].containerType,
|
|
23
|
-
// MDN: type of frame container: 'iframe', 'embed', or 'object' ... but this can also be 'window',
|
|
24
|
-
...(entry.attribution[0].containerType !== 'window' && {
|
|
25
|
-
ltCtrSrc: entry.attribution[0].containerSrc,
|
|
26
|
-
// MDN: container's 'src' attribute
|
|
27
|
-
ltCtrId: entry.attribution[0].containerId,
|
|
28
|
-
// MDN: container's 'id' attribute
|
|
29
|
-
ltCtrName: entry.attribution[0].containerName // MDN: container's 'name' attribute
|
|
30
|
-
})
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
let observer;
|
|
36
|
-
try {
|
|
37
|
-
if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
|
|
38
|
-
observer = new PerformanceObserver(list => {
|
|
39
|
-
// Delay by a microtask to workaround a bug in Safari where the
|
|
40
|
-
// callback is invoked immediately, rather than in a separate task.
|
|
41
|
-
// See: https://github.com/GoogleChrome/web-vitals/issues/277
|
|
42
|
-
Promise.resolve().then(() => {
|
|
43
|
-
handleEntries(list.getEntries());
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
observer.observe({
|
|
47
|
-
type: 'longtask',
|
|
48
|
-
buffered: true
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
// Do nothing.
|
|
53
|
-
}
|
|
54
|
-
if (observer) {
|
|
55
|
-
(0, _eol.subscribeToEOL)(() => {
|
|
56
|
-
handleEntries(observer.takeRecords());
|
|
57
|
-
}, true); // this bool is a temp arg under staged BFCache work that runs the func under the new page session logic -- tb removed w/ the feature flag later
|
|
58
|
-
|
|
59
|
-
/* No work needed on BFCache restore for long task. */
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { isBrowserScope } from '../constants/runtime';
|
|
2
|
-
import { subscribeToEOL } from '../unload/eol';
|
|
3
|
-
import { VITAL_NAMES } from './constants';
|
|
4
|
-
import { VitalMetric } from './vital-metric';
|
|
5
|
-
export const longTask = new VitalMetric(VITAL_NAMES.LONG_TASK);
|
|
6
|
-
if (isBrowserScope) {
|
|
7
|
-
const handleEntries = entries => {
|
|
8
|
-
entries.forEach(entry => {
|
|
9
|
-
longTask.update({
|
|
10
|
-
value: entry.duration,
|
|
11
|
-
attrs: {
|
|
12
|
-
ltFrame: entry.name,
|
|
13
|
-
// MDN: the browsing context or frame that can be attributed to the long task
|
|
14
|
-
ltStart: entry.startTime,
|
|
15
|
-
// MDN: a double representing the time (millisec) when the task started
|
|
16
|
-
ltCtr: entry.attribution[0].containerType,
|
|
17
|
-
// MDN: type of frame container: 'iframe', 'embed', or 'object' ... but this can also be 'window',
|
|
18
|
-
...(entry.attribution[0].containerType !== 'window' && {
|
|
19
|
-
ltCtrSrc: entry.attribution[0].containerSrc,
|
|
20
|
-
// MDN: container's 'src' attribute
|
|
21
|
-
ltCtrId: entry.attribution[0].containerId,
|
|
22
|
-
// MDN: container's 'id' attribute
|
|
23
|
-
ltCtrName: entry.attribution[0].containerName // MDN: container's 'name' attribute
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
let observer;
|
|
30
|
-
try {
|
|
31
|
-
if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
|
|
32
|
-
observer = new PerformanceObserver(list => {
|
|
33
|
-
// Delay by a microtask to workaround a bug in Safari where the
|
|
34
|
-
// callback is invoked immediately, rather than in a separate task.
|
|
35
|
-
// See: https://github.com/GoogleChrome/web-vitals/issues/277
|
|
36
|
-
Promise.resolve().then(() => {
|
|
37
|
-
handleEntries(list.getEntries());
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
observer.observe({
|
|
41
|
-
type: 'longtask',
|
|
42
|
-
buffered: true
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
} catch (e) {
|
|
46
|
-
// Do nothing.
|
|
47
|
-
}
|
|
48
|
-
if (observer) {
|
|
49
|
-
subscribeToEOL(() => {
|
|
50
|
-
handleEntries(observer.takeRecords());
|
|
51
|
-
}, true); // this bool is a temp arg under staged BFCache work that runs the func under the new page session logic -- tb removed w/ the feature flag later
|
|
52
|
-
|
|
53
|
-
/* No work needed on BFCache restore for long task. */
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"long-task.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/long-task.js"],"names":[],"mappings":"AAKA,mCAA8D;4BAFlC,gBAAgB"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { isBrowserScope } from '../constants/runtime'
|
|
2
|
-
import { subscribeToEOL } from '../unload/eol'
|
|
3
|
-
import { VITAL_NAMES } from './constants'
|
|
4
|
-
import { VitalMetric } from './vital-metric'
|
|
5
|
-
|
|
6
|
-
export const longTask = new VitalMetric(VITAL_NAMES.LONG_TASK)
|
|
7
|
-
|
|
8
|
-
if (isBrowserScope) {
|
|
9
|
-
const handleEntries = (entries) => {
|
|
10
|
-
entries.forEach(entry => {
|
|
11
|
-
longTask.update({
|
|
12
|
-
value: entry.duration,
|
|
13
|
-
attrs: {
|
|
14
|
-
ltFrame: entry.name, // MDN: the browsing context or frame that can be attributed to the long task
|
|
15
|
-
ltStart: entry.startTime, // MDN: a double representing the time (millisec) when the task started
|
|
16
|
-
ltCtr: entry.attribution[0].containerType, // MDN: type of frame container: 'iframe', 'embed', or 'object' ... but this can also be 'window',
|
|
17
|
-
...(entry.attribution[0].containerType !== 'window' && {
|
|
18
|
-
ltCtrSrc: entry.attribution[0].containerSrc, // MDN: container's 'src' attribute
|
|
19
|
-
ltCtrId: entry.attribution[0].containerId, // MDN: container's 'id' attribute
|
|
20
|
-
ltCtrName: entry.attribution[0].containerName // MDN: container's 'name' attribute
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
})
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
let observer
|
|
28
|
-
try {
|
|
29
|
-
if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
|
|
30
|
-
observer = new PerformanceObserver((list) => {
|
|
31
|
-
// Delay by a microtask to workaround a bug in Safari where the
|
|
32
|
-
// callback is invoked immediately, rather than in a separate task.
|
|
33
|
-
// See: https://github.com/GoogleChrome/web-vitals/issues/277
|
|
34
|
-
Promise.resolve().then(() => {
|
|
35
|
-
handleEntries(list.getEntries())
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
observer.observe({ type: 'longtask', buffered: true })
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {
|
|
41
|
-
// Do nothing.
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (observer) {
|
|
45
|
-
subscribeToEOL(() => {
|
|
46
|
-
handleEntries(observer.takeRecords())
|
|
47
|
-
}, true) // this bool is a temp arg under staged BFCache work that runs the func under the new page session logic -- tb removed w/ the feature flag later
|
|
48
|
-
|
|
49
|
-
/* No work needed on BFCache restore for long task. */
|
|
50
|
-
}
|
|
51
|
-
}
|