@newrelic/browser-agent 1.262.0 → 1.264.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 +21 -0
- package/README.md +2 -2
- package/dist/cjs/cdn/experimental.js +3 -7
- package/dist/cjs/cdn/pro.js +2 -2
- package/dist/cjs/cdn/spa.js +2 -2
- package/dist/cjs/common/aggregate/aggregator.js +3 -3
- package/dist/cjs/common/config/state/configurable.js +4 -4
- package/dist/cjs/common/config/state/init.js +11 -6
- 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 +1 -3
- package/dist/cjs/common/context/shared-context.js +2 -2
- package/dist/cjs/common/drain/drain.js +5 -5
- package/dist/cjs/common/harvest/harvest.js +3 -3
- package/dist/cjs/common/serialize/bel-serializer.js +2 -2
- package/dist/cjs/common/session/session-entity.js +3 -3
- package/dist/cjs/common/timing/time-keeper.js +13 -2
- package/dist/cjs/common/url/encode.js +3 -5
- package/dist/cjs/common/util/console.js +3 -4
- package/dist/cjs/common/util/obfuscate.js +3 -3
- package/dist/cjs/common/util/submit-data.js +0 -1
- package/dist/cjs/common/vitals/vital-metric.js +1 -1
- package/dist/cjs/common/wrap/wrap-logger.js +1 -2
- package/dist/cjs/common/wrap/wrap-xhr.js +1 -1
- package/dist/cjs/features/ajax/aggregate/index.js +1 -1
- package/dist/cjs/features/ajax/instrument/index.js +1 -1
- package/dist/cjs/features/generic_events/aggregate/index.js +137 -0
- package/dist/cjs/features/generic_events/constants.js +8 -0
- package/dist/cjs/features/generic_events/index.js +12 -0
- package/dist/cjs/features/generic_events/instrument/index.js +27 -0
- package/dist/cjs/features/jserrors/aggregate/index.js +13 -12
- package/dist/cjs/features/jserrors/instrument/index.js +1 -1
- package/dist/cjs/features/logging/aggregate/index.js +6 -6
- package/dist/cjs/features/logging/constants.js +2 -5
- package/dist/cjs/features/logging/instrument/index.js +1 -1
- package/dist/cjs/features/metrics/aggregate/index.js +17 -1
- package/dist/cjs/features/metrics/instrument/index.js +1 -1
- package/dist/cjs/features/page_action/instrument/index.js +6 -6
- package/dist/cjs/features/page_view_event/aggregate/index.js +21 -5
- package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/cjs/features/page_view_event/instrument/index.js +1 -1
- package/dist/cjs/features/page_view_timing/aggregate/index.js +3 -3
- package/dist/cjs/features/page_view_timing/instrument/index.js +1 -1
- package/dist/cjs/features/session_replay/aggregate/index.js +3 -3
- package/dist/cjs/features/session_replay/instrument/index.js +1 -1
- package/dist/cjs/features/session_replay/shared/recorder.js +1 -1
- package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +1 -1
- package/dist/cjs/features/session_trace/aggregate/index.js +1 -1
- package/dist/cjs/features/session_trace/aggregate/trace/storage.js +2 -2
- package/dist/cjs/features/session_trace/instrument/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/interaction.js +5 -5
- package/dist/cjs/features/soft_navigations/instrument/index.js +1 -1
- package/dist/cjs/features/spa/aggregate/index.js +3 -4
- package/dist/cjs/features/spa/aggregate/interaction.js +2 -2
- package/dist/cjs/features/spa/aggregate/serializer.js +1 -2
- package/dist/cjs/features/spa/instrument/index.js +1 -1
- package/dist/cjs/features/utils/aggregate-base.js +6 -3
- package/dist/cjs/features/utils/instrument-base.js +2 -2
- package/dist/cjs/features/utils/lazy-feature-loader.js +2 -2
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/loaders/agent-base.js +1 -5
- package/dist/cjs/loaders/agent.js +3 -4
- package/dist/cjs/loaders/api/api.js +10 -8
- package/dist/cjs/loaders/api/apiAsync.js +1 -1
- package/dist/cjs/loaders/browser-agent.js +4 -3
- package/dist/cjs/loaders/configure/configure.js +4 -3
- package/dist/cjs/loaders/features/features.js +8 -4
- package/dist/cjs/loaders/micro-agent.js +6 -6
- package/dist/esm/cdn/experimental.js +2 -5
- package/dist/esm/cdn/pro.js +2 -2
- package/dist/esm/cdn/spa.js +2 -2
- package/dist/esm/common/aggregate/aggregator.js +3 -3
- package/dist/esm/common/config/state/configurable.js +4 -4
- package/dist/esm/common/config/state/init.js +11 -6
- 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 +0 -2
- package/dist/esm/common/context/shared-context.js +2 -2
- package/dist/esm/common/drain/drain.js +5 -5
- package/dist/esm/common/harvest/harvest.js +4 -4
- package/dist/esm/common/serialize/bel-serializer.js +2 -2
- package/dist/esm/common/session/session-entity.js +4 -4
- package/dist/esm/common/timing/time-keeper.js +12 -2
- package/dist/esm/common/url/encode.js +3 -5
- package/dist/esm/common/util/console.js +3 -4
- package/dist/esm/common/util/obfuscate.js +3 -3
- package/dist/esm/common/util/submit-data.js +0 -1
- package/dist/esm/common/vitals/vital-metric.js +1 -1
- package/dist/esm/common/wrap/wrap-logger.js +1 -2
- package/dist/esm/common/wrap/wrap-xhr.js +1 -1
- package/dist/esm/features/ajax/aggregate/index.js +1 -1
- package/dist/esm/features/ajax/instrument/index.js +1 -1
- package/dist/esm/features/generic_events/aggregate/index.js +129 -0
- package/dist/esm/features/generic_events/constants.js +2 -0
- package/dist/esm/features/generic_events/index.js +1 -0
- package/dist/esm/features/generic_events/instrument/index.js +20 -0
- package/dist/esm/features/jserrors/aggregate/index.js +13 -12
- package/dist/esm/features/jserrors/instrument/index.js +1 -1
- package/dist/esm/features/logging/aggregate/index.js +7 -7
- package/dist/esm/features/logging/constants.js +1 -4
- package/dist/esm/features/logging/instrument/index.js +1 -1
- package/dist/esm/features/metrics/aggregate/index.js +17 -1
- package/dist/esm/features/metrics/instrument/index.js +1 -1
- package/dist/esm/features/page_action/instrument/index.js +7 -6
- package/dist/esm/features/page_view_event/aggregate/index.js +22 -6
- package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/dist/esm/features/page_view_event/instrument/index.js +1 -1
- package/dist/esm/features/page_view_timing/aggregate/index.js +3 -3
- package/dist/esm/features/page_view_timing/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/aggregate/index.js +3 -3
- package/dist/esm/features/session_replay/instrument/index.js +1 -1
- package/dist/esm/features/session_replay/shared/recorder.js +1 -1
- package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +1 -1
- package/dist/esm/features/session_trace/aggregate/index.js +1 -1
- package/dist/esm/features/session_trace/aggregate/trace/storage.js +2 -2
- package/dist/esm/features/session_trace/instrument/index.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/interaction.js +5 -5
- package/dist/esm/features/soft_navigations/instrument/index.js +1 -1
- package/dist/esm/features/spa/aggregate/index.js +3 -4
- package/dist/esm/features/spa/aggregate/interaction.js +2 -2
- package/dist/esm/features/spa/aggregate/serializer.js +1 -2
- package/dist/esm/features/spa/instrument/index.js +1 -1
- package/dist/esm/features/utils/aggregate-base.js +7 -4
- package/dist/esm/features/utils/instrument-base.js +2 -2
- package/dist/esm/features/utils/lazy-feature-loader.js +2 -2
- package/dist/esm/index.js +3 -0
- package/dist/esm/loaders/agent-base.js +1 -5
- package/dist/esm/loaders/agent.js +3 -4
- package/dist/esm/loaders/api/api.js +10 -8
- package/dist/esm/loaders/api/apiAsync.js +1 -1
- package/dist/esm/loaders/browser-agent.js +3 -2
- package/dist/esm/loaders/configure/configure.js +4 -3
- package/dist/esm/loaders/features/features.js +8 -4
- package/dist/esm/loaders/micro-agent.js +6 -6
- package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
- package/dist/types/common/config/state/init.d.ts.map +1 -1
- package/dist/types/common/constants/runtime.d.ts +0 -1
- package/dist/types/common/constants/runtime.d.ts.map +1 -1
- package/dist/types/common/drain/drain.d.ts.map +1 -1
- package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
- package/dist/types/common/timing/time-keeper.d.ts +2 -1
- package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
- package/dist/types/common/url/encode.d.ts.map +1 -1
- package/dist/types/common/util/console.d.ts +1 -1
- package/dist/types/common/util/console.d.ts.map +1 -1
- package/dist/types/common/util/submit-data.d.ts.map +1 -1
- package/dist/types/common/wrap/wrap-logger.d.ts.map +1 -1
- package/dist/types/features/{page_action → generic_events}/aggregate/index.d.ts +7 -5
- package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/constants.d.ts +2 -0
- package/dist/types/features/generic_events/constants.d.ts.map +1 -0
- package/dist/types/features/generic_events/index.d.ts +2 -0
- package/dist/types/features/generic_events/index.d.ts.map +1 -0
- package/dist/types/features/generic_events/instrument/index.d.ts +6 -0
- package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -0
- package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/logging/constants.d.ts +0 -3
- package/dist/types/features/logging/constants.d.ts.map +1 -1
- package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_action/instrument/index.d.ts +5 -4
- package/dist/types/features/page_action/instrument/index.d.ts.map +1 -1
- package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
- package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -1
- package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -0
- package/dist/types/loaders/agent-base.d.ts +0 -1
- 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.map +1 -1
- package/dist/types/loaders/browser-agent.d.ts.map +1 -1
- package/dist/types/loaders/configure/configure.d.ts.map +1 -1
- package/dist/types/loaders/features/features.d.ts +1 -0
- package/dist/types/loaders/features/features.d.ts.map +1 -1
- package/package.json +25 -6
- package/src/cdn/experimental.js +2 -4
- package/src/cdn/pro.js +2 -2
- package/src/cdn/spa.js +2 -2
- package/src/common/aggregate/aggregator.js +2 -3
- package/src/common/config/state/configurable.js +4 -4
- package/src/common/config/state/init.js +6 -4
- package/src/common/constants/runtime.js +0 -2
- package/src/common/context/shared-context.js +2 -2
- package/src/common/drain/drain.js +4 -5
- package/src/common/harvest/harvest.js +4 -4
- package/src/common/serialize/bel-serializer.js +1 -2
- package/src/common/session/session-entity.js +4 -4
- package/src/common/timing/time-keeper.js +14 -2
- package/src/common/url/encode.js +2 -3
- package/src/common/util/console.js +3 -4
- package/src/common/util/obfuscate.js +3 -3
- package/src/common/util/submit-data.js +0 -1
- package/src/common/wrap/wrap-logger.js +1 -2
- package/src/common/wrap/wrap-xhr.js +1 -1
- package/src/features/generic_events/aggregate/index.js +133 -0
- package/src/features/generic_events/constants.js +3 -0
- package/src/features/generic_events/index.js +1 -0
- package/src/features/generic_events/instrument/index.js +22 -0
- package/src/features/jserrors/aggregate/index.js +4 -5
- package/src/features/logging/aggregate/index.js +6 -6
- package/src/features/logging/constants.js +0 -4
- package/src/features/metrics/aggregate/index.js +12 -0
- package/src/features/page_action/instrument/index.js +6 -6
- package/src/features/page_view_event/aggregate/index.js +22 -5
- package/src/features/page_view_event/aggregate/initialized-features.js +1 -1
- package/src/features/page_view_timing/aggregate/index.js +1 -2
- package/src/features/session_replay/aggregate/index.js +1 -1
- package/src/features/session_replay/shared/recorder.js +1 -1
- package/src/features/spa/aggregate/index.js +2 -3
- package/src/features/spa/aggregate/interaction.js +1 -2
- package/src/features/spa/aggregate/serializer.js +1 -2
- package/src/features/utils/aggregate-base.js +7 -4
- package/src/features/utils/instrument-base.js +2 -2
- package/src/features/utils/lazy-feature-loader.js +2 -2
- package/src/index.js +3 -0
- package/src/loaders/agent-base.js +1 -5
- package/src/loaders/agent.js +3 -4
- package/src/loaders/api/api.js +10 -8
- package/src/loaders/api/apiAsync.js +1 -1
- package/src/loaders/browser-agent.js +5 -3
- package/src/loaders/configure/configure.js +5 -1
- package/src/loaders/features/features.js +8 -4
- package/src/loaders/micro-agent.js +6 -6
- package/dist/cjs/cdn/polyfills/lite.js +0 -16
- package/dist/cjs/cdn/polyfills/pro.js +0 -21
- package/dist/cjs/cdn/polyfills/spa.js +0 -22
- package/dist/cjs/cdn/polyfills.js +0 -24
- package/dist/cjs/common/util/map-own.js +0 -31
- package/dist/cjs/features/page_action/aggregate/index.js +0 -121
- package/dist/esm/cdn/polyfills/lite.js +0 -14
- package/dist/esm/cdn/polyfills/pro.js +0 -19
- package/dist/esm/cdn/polyfills/spa.js +0 -20
- package/dist/esm/cdn/polyfills.js +0 -27
- package/dist/esm/common/util/map-own.js +0 -24
- package/dist/esm/features/page_action/aggregate/index.js +0 -114
- package/dist/types/cdn/polyfills/lite.d.ts +0 -2
- package/dist/types/cdn/polyfills/lite.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/pro.d.ts +0 -2
- package/dist/types/cdn/polyfills/pro.d.ts.map +0 -1
- package/dist/types/cdn/polyfills/spa.d.ts +0 -2
- package/dist/types/cdn/polyfills/spa.d.ts.map +0 -1
- package/dist/types/cdn/polyfills.d.ts +0 -2
- package/dist/types/cdn/polyfills.d.ts.map +0 -1
- package/dist/types/common/util/map-own.d.ts +0 -3
- package/dist/types/common/util/map-own.d.ts.map +0 -1
- package/dist/types/features/page_action/aggregate/index.d.ts.map +0 -1
- package/src/cdn/polyfills/lite.js +0 -20
- package/src/cdn/polyfills/pro.js +0 -30
- package/src/cdn/polyfills/spa.js +0 -32
- package/src/cdn/polyfills.js +0 -27
- package/src/common/util/map-own.js +0 -22
- package/src/features/page_action/aggregate/index.js +0 -114
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Aggregate = void 0;
|
|
7
|
+
var _stringify = require("../../../common/util/stringify");
|
|
8
|
+
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
9
|
+
var _cleanUrl = require("../../../common/url/clean-url");
|
|
10
|
+
var _config = require("../../../common/config/config");
|
|
11
|
+
var _constants = require("../constants");
|
|
12
|
+
var _runtime = require("../../../common/constants/runtime");
|
|
13
|
+
var _aggregateBase = require("../../utils/aggregate-base");
|
|
14
|
+
var _console = require("../../../common/util/console");
|
|
15
|
+
var _now = require("../../../common/timing/now");
|
|
16
|
+
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
17
|
+
var _drain = require("../../../common/drain/drain");
|
|
18
|
+
var _constants2 = require("../../metrics/constants");
|
|
19
|
+
/*
|
|
20
|
+
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
21
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
class Aggregate extends _aggregateBase.AggregateBase {
|
|
25
|
+
#agentRuntime;
|
|
26
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
27
|
+
constructor(agentIdentifier, aggregator) {
|
|
28
|
+
var _this;
|
|
29
|
+
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
30
|
+
_this = this;
|
|
31
|
+
this.eventsPerHarvest = 1000;
|
|
32
|
+
this.harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'generic_events.harvestTimeSeconds');
|
|
33
|
+
this.referrerUrl = _runtime.isBrowserScope && document.referrer ? (0, _cleanUrl.cleanURL)(document.referrer) : undefined;
|
|
34
|
+
this.currentEvents = [];
|
|
35
|
+
this.events = [];
|
|
36
|
+
this.overflow = [];
|
|
37
|
+
this.#agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
38
|
+
this.waitForFlags(['ins']).then(_ref => {
|
|
39
|
+
let [ins] = _ref;
|
|
40
|
+
if (!ins) {
|
|
41
|
+
this.blocked = true;
|
|
42
|
+
(0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if ((0, _config.getConfigurationValue)(this.agentIdentifier, 'page_action.enabled')) {
|
|
46
|
+
(0, _registerHandler.registerHandler)('api-addPageAction', (timestamp, name, attributes) => {
|
|
47
|
+
this.addEvent({
|
|
48
|
+
...attributes,
|
|
49
|
+
eventType: 'PageAction',
|
|
50
|
+
timestamp: this.#agentRuntime.timeKeeper.convertRelativeTimestamp(timestamp),
|
|
51
|
+
timeSinceLoad: timestamp / 1000,
|
|
52
|
+
actionName: name,
|
|
53
|
+
referrerUrl: this.referrerUrl,
|
|
54
|
+
currentUrl: (0, _cleanUrl.cleanURL)('' + location),
|
|
55
|
+
...(_runtime.isBrowserScope && {
|
|
56
|
+
browserWidth: window.document.documentElement?.clientWidth,
|
|
57
|
+
browserHeight: window.document.documentElement?.clientHeight
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}, this.featureName, this.ee);
|
|
61
|
+
}
|
|
62
|
+
this.harvestScheduler = new _harvestScheduler.HarvestScheduler('ins', {
|
|
63
|
+
onFinished: function () {
|
|
64
|
+
return _this.onHarvestFinished(...arguments);
|
|
65
|
+
}
|
|
66
|
+
}, this);
|
|
67
|
+
this.harvestScheduler.harvest.on('ins', function () {
|
|
68
|
+
return _this.onHarvestStarted(...arguments);
|
|
69
|
+
});
|
|
70
|
+
this.harvestScheduler.startTimer(this.harvestTimeSeconds, 0);
|
|
71
|
+
this.drain();
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
onHarvestStarted(options) {
|
|
75
|
+
const {
|
|
76
|
+
userAttributes,
|
|
77
|
+
atts
|
|
78
|
+
} = (0, _config.getInfo)(this.agentIdentifier);
|
|
79
|
+
const harvestEvents = this.overflow.length ? this.overflow.splice(0, Infinity) : this.events.splice(0, Infinity);
|
|
80
|
+
var payload = {
|
|
81
|
+
qs: {
|
|
82
|
+
ua: userAttributes,
|
|
83
|
+
at: atts
|
|
84
|
+
},
|
|
85
|
+
body: {
|
|
86
|
+
ins: harvestEvents
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
if (options.retry) {
|
|
90
|
+
this.currentEvents = harvestEvents;
|
|
91
|
+
}
|
|
92
|
+
return payload;
|
|
93
|
+
}
|
|
94
|
+
onHarvestFinished(result) {
|
|
95
|
+
if (result && result.sent && result.retry && this.currentEvents.length) {
|
|
96
|
+
this.events = this.currentEvents.concat(this.events);
|
|
97
|
+
this.currentEvents = [];
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// WARNING: Insights times are in seconds. EXCEPT timestamp, which is in ms.
|
|
102
|
+
addEvent() {
|
|
103
|
+
let obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
104
|
+
if (!obj || !Object.keys(obj).length) return;
|
|
105
|
+
if (!obj.eventType) {
|
|
106
|
+
(0, _console.warn)(44);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
for (let key in obj) {
|
|
110
|
+
let val = obj[key];
|
|
111
|
+
obj[key] = val && typeof val === 'object' ? (0, _stringify.stringify)(val) : val;
|
|
112
|
+
}
|
|
113
|
+
const defaultEventAttributes = {
|
|
114
|
+
/** should be overridden by the event-specific attributes, but just in case -- set it to now() */
|
|
115
|
+
timestamp: this.#agentRuntime.timeKeeper.convertRelativeTimestamp((0, _now.now)()),
|
|
116
|
+
/** all generic events require a pageUrl */
|
|
117
|
+
pageUrl: (0, _cleanUrl.cleanURL)((0, _config.getRuntime)(this.agentIdentifier).origin)
|
|
118
|
+
};
|
|
119
|
+
const eventAttributes = {
|
|
120
|
+
/** Agent-level custom attributes */
|
|
121
|
+
...((0, _config.getInfo)(this.agentIdentifier).jsAttributes || {}),
|
|
122
|
+
/** Fallbacks for required properties in-case the event did not supply them, should take precedence over agent-level custom attrs */
|
|
123
|
+
...defaultEventAttributes,
|
|
124
|
+
/** Event-specific attributes take precedence over agent-level custom attributes and fallbacks */
|
|
125
|
+
...obj
|
|
126
|
+
};
|
|
127
|
+
this.events.push(eventAttributes);
|
|
128
|
+
|
|
129
|
+
// check if we've reached the harvest limit...
|
|
130
|
+
if (this.events.length >= this.eventsPerHarvest) {
|
|
131
|
+
this.ee.emit(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['GenericEvents/Harvest/Max/Seen']);
|
|
132
|
+
this.overflow = [...this.overflow, ...this.events.splice(0, Infinity)];
|
|
133
|
+
this.harvestScheduler.runHarvest();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.Aggregate = Aggregate;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "GenericEvents", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _index.Instrument;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
var _index = require("./instrument/index");
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Instrument = void 0;
|
|
7
|
+
var _config = require("../../../common/config/config");
|
|
8
|
+
var _drain = require("../../../common/drain/drain");
|
|
9
|
+
var _instrumentBase = require("../../utils/instrument-base");
|
|
10
|
+
var _constants = require("../constants");
|
|
11
|
+
/* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
12
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
class Instrument extends _instrumentBase.InstrumentBase {
|
|
16
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
17
|
+
constructor(agentIdentifier, aggregator) {
|
|
18
|
+
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
19
|
+
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
20
|
+
const genericEventSourceConfigs = [(0, _config.getConfigurationValue)(this.agentIdentifier, 'page_action.enabled')
|
|
21
|
+
// other future generic event source configs to go here, like M&Ms, PageResouce, etc.
|
|
22
|
+
];
|
|
23
|
+
/** If any of the sources are active, import the aggregator. otherwise deregister */
|
|
24
|
+
if (genericEventSourceConfigs.some(x => x)) this.importAggregator();else (0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.Instrument = Instrument;
|
|
@@ -12,7 +12,6 @@ var _registerHandler = require("../../../common/event-emitter/register-handler")
|
|
|
12
12
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
13
13
|
var _stringify = require("../../../common/util/stringify");
|
|
14
14
|
var _handle = require("../../../common/event-emitter/handle");
|
|
15
|
-
var _mapOwn = require("../../../common/util/map-own");
|
|
16
15
|
var _config = require("../../../common/config/config");
|
|
17
16
|
var _runtime = require("../../../common/constants/runtime");
|
|
18
17
|
var _constants = require("../constants");
|
|
@@ -31,7 +30,7 @@ var _now = require("../../../common/timing/now");
|
|
|
31
30
|
*/
|
|
32
31
|
|
|
33
32
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
34
|
-
static featureName = _constants.FEATURE_NAME;
|
|
33
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
35
34
|
constructor(agentIdentifier, aggregator) {
|
|
36
35
|
var _this;
|
|
37
36
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
@@ -100,7 +99,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
100
99
|
}
|
|
101
100
|
onHarvestFinished(result) {
|
|
102
101
|
if (result.retry && this.currentBody) {
|
|
103
|
-
|
|
102
|
+
Object.entries(this.currentBody || {}).forEach(_ref2 => {
|
|
103
|
+
let [key, value] = _ref2;
|
|
104
104
|
for (var i = 0; i < value.length; i++) {
|
|
105
105
|
var bucket = value[i];
|
|
106
106
|
var name = this.getBucketName(key, bucket.params, bucket.custom);
|
|
@@ -230,8 +230,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
230
230
|
let [type, bucketHash, params, newMetrics, localAttrs] = errorInfoArr;
|
|
231
231
|
const allCustomAttrs = {};
|
|
232
232
|
if (softNavOccurredFinished) {
|
|
233
|
-
Object.entries(softNavCustomAttrs).forEach(
|
|
234
|
-
let [k, v] =
|
|
233
|
+
Object.entries(softNavCustomAttrs).forEach(_ref3 => {
|
|
234
|
+
let [k, v] = _ref3;
|
|
235
235
|
return setCustom(k, v);
|
|
236
236
|
}); // when an ixn finishes, it'll include stuff in jsAttributes + attrs specific to the ixn
|
|
237
237
|
bucketHash += params.browserInteractionId;
|
|
@@ -239,14 +239,14 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
239
239
|
delete params._softNavFinished;
|
|
240
240
|
} else {
|
|
241
241
|
// interaction was cancelled -> error should not be associated OR there was no interaction
|
|
242
|
-
Object.entries((0, _config.getInfo)(this.agentIdentifier).jsAttributes).forEach(
|
|
243
|
-
let [k, v] =
|
|
242
|
+
Object.entries((0, _config.getInfo)(this.agentIdentifier).jsAttributes).forEach(_ref4 => {
|
|
243
|
+
let [k, v] = _ref4;
|
|
244
244
|
return setCustom(k, v);
|
|
245
245
|
});
|
|
246
246
|
delete params.browserInteractionId;
|
|
247
247
|
}
|
|
248
|
-
if (localAttrs) Object.entries(localAttrs).forEach(
|
|
249
|
-
let [k, v] =
|
|
248
|
+
if (localAttrs) Object.entries(localAttrs).forEach(_ref5 => {
|
|
249
|
+
let [k, v] = _ref5;
|
|
250
250
|
return setCustom(k, v);
|
|
251
251
|
}); // local custom attrs are applied in either case with the highest precedence
|
|
252
252
|
|
|
@@ -264,8 +264,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
264
264
|
this.bufferedErrorsUnderSpa[interaction.id].forEach(item => {
|
|
265
265
|
var allCustomAttrs = {};
|
|
266
266
|
const localCustomAttrs = item[4];
|
|
267
|
-
|
|
268
|
-
(
|
|
267
|
+
Object.entries(interaction.root.attrs.custom || {}).forEach(setCustom); // tack on custom attrs from the interaction
|
|
268
|
+
Object.entries(localCustomAttrs || {}).forEach(setCustom);
|
|
269
269
|
var params = item[2];
|
|
270
270
|
if (wasSaved) {
|
|
271
271
|
params.browserInteractionId = interaction.root.attrs.id;
|
|
@@ -277,7 +277,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
277
277
|
var jsAttributesHash = (0, _stringHashCode.stringHashCode)((0, _stringify.stringify)(allCustomAttrs));
|
|
278
278
|
var aggregateHash = hash + ':' + jsAttributesHash;
|
|
279
279
|
this.aggregator.store(item[0], aggregateHash, params, item[3], allCustomAttrs);
|
|
280
|
-
function setCustom(
|
|
280
|
+
function setCustom(_ref6) {
|
|
281
|
+
let [key, val] = _ref6;
|
|
281
282
|
allCustomAttrs[key] = val && typeof val === 'object' ? (0, _stringify.stringify)(val) : val;
|
|
282
283
|
}
|
|
283
284
|
});
|
|
@@ -18,7 +18,7 @@ var _castError = require("../shared/cast-error");
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
21
|
-
static featureName = _constants.FEATURE_NAME;
|
|
21
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
22
22
|
#replayRunning = false;
|
|
23
23
|
constructor(agentIdentifier, aggregator) {
|
|
24
24
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -16,7 +16,7 @@ var _constants2 = require("../constants");
|
|
|
16
16
|
var _log = require("../shared/log");
|
|
17
17
|
var _utils = require("../shared/utils");
|
|
18
18
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
19
|
-
static featureName = _constants2.FEATURE_NAME;
|
|
19
|
+
static featureName = (() => _constants2.FEATURE_NAME)();
|
|
20
20
|
#agentRuntime;
|
|
21
21
|
#agentInfo;
|
|
22
22
|
constructor(agentIdentifier, aggregator) {
|
|
@@ -51,7 +51,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
51
51
|
if (this.blocked) return;
|
|
52
52
|
if (!attributes || typeof attributes !== 'object') attributes = {};
|
|
53
53
|
if (typeof level === 'string') level = level.toUpperCase();
|
|
54
|
-
if (!(0, _utils.isValidLogLevel)(level)) return (0, _console.warn)(
|
|
54
|
+
if (!(0, _utils.isValidLogLevel)(level)) return (0, _console.warn)(30, level);
|
|
55
55
|
try {
|
|
56
56
|
if (typeof message !== 'string') {
|
|
57
57
|
const stringified = (0, _stringify.stringify)(message);
|
|
@@ -63,19 +63,19 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
63
63
|
if (!!stringified && stringified !== '{}') message = stringified;else message = String(message);
|
|
64
64
|
}
|
|
65
65
|
} catch (err) {
|
|
66
|
-
(0, _console.warn)(
|
|
66
|
+
(0, _console.warn)(16, message);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
if (typeof message !== 'string' || !message) return (0, _console.warn)(
|
|
69
|
+
if (typeof message !== 'string' || !message) return (0, _console.warn)(32);
|
|
70
70
|
if (message.length > _constants2.MAX_PAYLOAD_SIZE) {
|
|
71
71
|
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', message.length]);
|
|
72
|
-
return (0, _console.warn)(
|
|
72
|
+
return (0, _console.warn)(31, message.slice(0, 25) + '...');
|
|
73
73
|
}
|
|
74
74
|
const log = new _log.Log(this.#agentRuntime.timeKeeper.convertRelativeTimestamp(timestamp), message, attributes, level);
|
|
75
75
|
const logBytes = log.message.length + (0, _stringify.stringify)(log.attributes).length + log.level.length + 10; // timestamp == 10 chars
|
|
76
76
|
if (logBytes > _constants2.MAX_PAYLOAD_SIZE) {
|
|
77
77
|
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Failed/Seen', logBytes]);
|
|
78
|
-
return (0, _console.warn)(
|
|
78
|
+
return (0, _console.warn)(31, log.message.slice(0, 25) + '...');
|
|
79
79
|
}
|
|
80
80
|
if (this.estimatedBytes + logBytes >= _constants2.MAX_PAYLOAD_SIZE) {
|
|
81
81
|
(0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['Logging/Harvest/Early/Seen', this.estimatedBytes + logBytes]);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.MAX_PAYLOAD_SIZE = exports.LOG_LEVELS = exports.
|
|
6
|
+
exports.MAX_PAYLOAD_SIZE = exports.LOG_LEVELS = exports.LOGGING_EVENT_EMITTER_CHANNEL = exports.FEATURE_NAME = void 0;
|
|
7
7
|
var _features = require("../../loaders/features/features");
|
|
8
8
|
const LOG_LEVELS = exports.LOG_LEVELS = {
|
|
9
9
|
ERROR: 'ERROR',
|
|
@@ -14,7 +14,4 @@ const LOG_LEVELS = exports.LOG_LEVELS = {
|
|
|
14
14
|
};
|
|
15
15
|
const LOGGING_EVENT_EMITTER_CHANNEL = exports.LOGGING_EVENT_EMITTER_CHANNEL = 'log';
|
|
16
16
|
const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.logging;
|
|
17
|
-
const MAX_PAYLOAD_SIZE = exports.MAX_PAYLOAD_SIZE = 1000000;
|
|
18
|
-
const LOGGING_FAILURE_MESSAGE = exports.LOGGING_FAILURE_MESSAGE = 'failed to wrap logger: ';
|
|
19
|
-
const LOGGING_LEVEL_FAILURE_MESSAGE = exports.LOGGING_LEVEL_FAILURE_MESSAGE = 'invalid log level: ';
|
|
20
|
-
const LOGGING_IGNORED = exports.LOGGING_IGNORED = 'ignored log: ';
|
|
17
|
+
const MAX_PAYLOAD_SIZE = exports.MAX_PAYLOAD_SIZE = 1000000;
|
|
@@ -8,7 +8,7 @@ var _instrumentBase = require("../../utils/instrument-base");
|
|
|
8
8
|
var _constants = require("../constants");
|
|
9
9
|
var _utils = require("../shared/utils");
|
|
10
10
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
11
|
-
static featureName = _constants.FEATURE_NAME;
|
|
11
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
12
12
|
constructor(agentIdentifier, aggregator) {
|
|
13
13
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
14
14
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
@@ -17,7 +17,7 @@ var _runtime = require("../../../common/constants/runtime");
|
|
|
17
17
|
var _aggregateBase = require("../../utils/aggregate-base");
|
|
18
18
|
var _drain = require("../../../common/drain/drain");
|
|
19
19
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
20
|
-
static featureName = _constants.FEATURE_NAME;
|
|
20
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
21
21
|
constructor(agentIdentifier, aggregator) {
|
|
22
22
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
23
23
|
this.waitForFlags(['err']).then(_ref => {
|
|
@@ -108,6 +108,22 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
108
108
|
// Check if proxy for either chunks or beacon is being used
|
|
109
109
|
if (proxy.assets) this.storeSupportabilityMetrics('Config/AssetsUrl/Changed');
|
|
110
110
|
if (proxy.beacon) this.storeSupportabilityMetrics('Config/BeaconUrl/Changed');
|
|
111
|
+
if (_runtime.isBrowserScope && window.MutationObserver) {
|
|
112
|
+
this.storeSupportabilityMetrics('Generic/VideoElement/Added', window.document.querySelectorAll('video').length);
|
|
113
|
+
const mo = new MutationObserver(records => {
|
|
114
|
+
records.forEach(record => {
|
|
115
|
+
record.addedNodes.forEach(addedNode => {
|
|
116
|
+
if (addedNode instanceof HTMLVideoElement) {
|
|
117
|
+
this.storeSupportabilityMetrics('Generic/VideoElement/Added', 1);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
mo.observe(window.document.body, {
|
|
123
|
+
childList: true,
|
|
124
|
+
subtree: true
|
|
125
|
+
});
|
|
126
|
+
}
|
|
111
127
|
}
|
|
112
128
|
eachSessionChecks() {
|
|
113
129
|
if (!_runtime.isBrowserScope) return;
|
|
@@ -7,7 +7,7 @@ exports.Instrument = void 0;
|
|
|
7
7
|
var _instrumentBase = require("../../utils/instrument-base");
|
|
8
8
|
var _constants = require("../constants");
|
|
9
9
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
10
|
-
static featureName = _constants.FEATURE_NAME;
|
|
10
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
11
11
|
constructor(agentIdentifier, aggregator) {
|
|
12
12
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
13
13
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
@@ -4,19 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Instrument = void 0;
|
|
7
|
-
var
|
|
8
|
-
var _constants = require("../constants");
|
|
7
|
+
var _generic_events = require("../../generic_events");
|
|
9
8
|
/*
|
|
10
9
|
* Copyright 2020 New Relic Corporation. All rights reserved.
|
|
11
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
12
11
|
*/
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release
|
|
15
|
+
*/
|
|
16
|
+
class Instrument extends _generic_events.GenericEvents {
|
|
16
17
|
constructor(agentIdentifier, aggregator) {
|
|
17
18
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
18
|
-
super(agentIdentifier, aggregator,
|
|
19
|
-
this.importAggregator();
|
|
19
|
+
super(agentIdentifier, aggregator, auto);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.Instrument = Instrument;
|
|
@@ -26,13 +26,17 @@ var _timeKeeper = require("../../../common/timing/time-keeper");
|
|
|
26
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
27
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
28
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
29
|
-
static featureName = CONSTANTS.FEATURE_NAME;
|
|
29
|
+
static featureName = (() => CONSTANTS.FEATURE_NAME)();
|
|
30
30
|
constructor(agentIdentifier, aggregator) {
|
|
31
31
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
|
|
32
32
|
this.timeToFirstByte = 0;
|
|
33
33
|
this.firstByteToWindowLoad = 0; // our "frontend" duration
|
|
34
34
|
this.firstByteToDomContent = 0; // our "dom processing" duration
|
|
35
35
|
this.timeKeeper = new _timeKeeper.TimeKeeper(this.agentIdentifier);
|
|
36
|
+
if (!(0, _config.isConfigured)(agentIdentifier)) {
|
|
37
|
+
this.ee.abort();
|
|
38
|
+
return (0, _console.warn)(43);
|
|
39
|
+
}
|
|
36
40
|
if (_runtime.isBrowserScope) {
|
|
37
41
|
_timeToFirstByte.timeToFirstByte.subscribe(_ref => {
|
|
38
42
|
let {
|
|
@@ -55,7 +59,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
55
59
|
const info = (0, _config.getInfo)(this.agentIdentifier);
|
|
56
60
|
const agentRuntime = (0, _config.getRuntime)(this.agentIdentifier);
|
|
57
61
|
const harvester = new _harvest.Harvest(this);
|
|
58
|
-
if (!info.beacon) return;
|
|
59
62
|
if (info.queueTime) this.aggregator.store('measures', 'qt', {
|
|
60
63
|
value: info.queueTime
|
|
61
64
|
});
|
|
@@ -148,11 +151,24 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
148
151
|
this.timeKeeper.processRumRequest(xhr, rumStartTime, rumEndTime);
|
|
149
152
|
if (!this.timeKeeper.ready) throw new Error('TimeKeeper not ready');
|
|
150
153
|
agentRuntime.timeKeeper = this.timeKeeper;
|
|
154
|
+
|
|
155
|
+
// Check if the time diff is such that we need to capture a supportability metric
|
|
156
|
+
if (this.timeKeeper.localTimeDiff >= 12 * 60 * 60 * 1000) {
|
|
157
|
+
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed12Hrs'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
158
|
+
} else if (this.timeKeeper.localTimeDiff >= 6 * 60 * 60 * 1000) {
|
|
159
|
+
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed6Hrs'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
160
|
+
} else if (this.timeKeeper.localTimeDiff >= 60 * 60 * 1000) {
|
|
161
|
+
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/DiffExceed1Hrs'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
162
|
+
}
|
|
151
163
|
} catch (error) {
|
|
152
|
-
|
|
164
|
+
if (error?.message?.indexOf('invalid format') > 0) {
|
|
165
|
+
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/InvalidFormat'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
166
|
+
} else {
|
|
167
|
+
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ['PVE/NRTime/Calculation/Failed'], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
168
|
+
}
|
|
153
169
|
(0, _drain.drain)(this.agentIdentifier, _features.FEATURE_NAMES.metrics, true);
|
|
154
170
|
this.ee.abort();
|
|
155
|
-
(0, _console.warn)(
|
|
171
|
+
(0, _console.warn)(17, error);
|
|
156
172
|
return;
|
|
157
173
|
}
|
|
158
174
|
try {
|
|
@@ -165,7 +181,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
165
181
|
this.drain();
|
|
166
182
|
} catch (err) {
|
|
167
183
|
this.ee.abort();
|
|
168
|
-
(0, _console.warn)(
|
|
184
|
+
(0, _console.warn)(18, err);
|
|
169
185
|
}
|
|
170
186
|
}
|
|
171
187
|
});
|
|
@@ -24,7 +24,7 @@ function getActivatedFeaturesFlags(agentId) {
|
|
|
24
24
|
case _features.FEATURE_NAMES.jserrors:
|
|
25
25
|
flagArr.push('err');
|
|
26
26
|
break;
|
|
27
|
-
case _features.FEATURE_NAMES.
|
|
27
|
+
case _features.FEATURE_NAMES.genericEvents:
|
|
28
28
|
flagArr.push('ins');
|
|
29
29
|
break;
|
|
30
30
|
case _features.FEATURE_NAMES.sessionTrace:
|
|
@@ -9,7 +9,7 @@ var CONSTANTS = _interopRequireWildcard(require("../constants"));
|
|
|
9
9
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
10
10
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
11
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
12
|
-
static featureName = CONSTANTS.FEATURE_NAME;
|
|
12
|
+
static featureName = (() => CONSTANTS.FEATURE_NAME)();
|
|
13
13
|
constructor(agentIdentifier, aggregator) {
|
|
14
14
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
15
15
|
super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME, auto);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Aggregate = void 0;
|
|
7
7
|
var _belSerializer = require("../../../common/serialize/bel-serializer");
|
|
8
|
-
var _mapOwn = require("../../../common/util/map-own");
|
|
9
8
|
var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
|
|
10
9
|
var _registerHandler = require("../../../common/event-emitter/register-handler");
|
|
11
10
|
var _handle = require("../../../common/event-emitter/handle");
|
|
@@ -29,7 +28,7 @@ var _constants2 = require("../../../common/vitals/constants");
|
|
|
29
28
|
*/
|
|
30
29
|
|
|
31
30
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
32
|
-
static featureName = _constants.FEATURE_NAME;
|
|
31
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
33
32
|
#handleVitalMetric = _ref => {
|
|
34
33
|
let {
|
|
35
34
|
name,
|
|
@@ -147,7 +146,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
147
146
|
var timingAttributes = timing.attrs || {};
|
|
148
147
|
var customAttributes = (0, _config.getInfo)(this.agentIdentifier).jsAttributes || {};
|
|
149
148
|
var reservedAttributes = ['size', 'eid', 'cls', 'type', 'fid', 'elTag', 'elUrl', 'net-type', 'net-etype', 'net-rtt', 'net-dlink'];
|
|
150
|
-
|
|
149
|
+
Object.entries(customAttributes || {}).forEach(_ref3 => {
|
|
150
|
+
let [key, val] = _ref3;
|
|
151
151
|
if (reservedAttributes.indexOf(key) < 0) {
|
|
152
152
|
timingAttributes[key] = val;
|
|
153
153
|
}
|
|
@@ -17,7 +17,7 @@ var _now = require("../../../common/timing/now");
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
20
|
-
static featureName = _constants.FEATURE_NAME;
|
|
20
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
21
21
|
constructor(agentIdentifier, aggregator) {
|
|
22
22
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
23
23
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
|
|
@@ -35,8 +35,8 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
35
35
|
* functionality is validated and a full user experience is curated.
|
|
36
36
|
*/
|
|
37
37
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
38
|
-
static featureName = _constants.FEATURE_NAME;
|
|
39
|
-
mode = _constants3.MODE.OFF;
|
|
38
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
39
|
+
mode = (() => _constants3.MODE.OFF)();
|
|
40
40
|
|
|
41
41
|
// pass the recorder into the aggregator
|
|
42
42
|
constructor(agentIdentifier, aggregator, args) {
|
|
@@ -421,7 +421,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
421
421
|
abort() {
|
|
422
422
|
let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
423
423
|
let data = arguments.length > 1 ? arguments[1] : undefined;
|
|
424
|
-
(0, _console.warn)(
|
|
424
|
+
(0, _console.warn)(33, reason.message);
|
|
425
425
|
(0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm), data], undefined, _features.FEATURE_NAMES.metrics, this.ee);
|
|
426
426
|
this.blocked = true;
|
|
427
427
|
this.mode = _constants3.MODE.OFF;
|
|
@@ -21,7 +21,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
21
21
|
* functionality is validated and a full user experience is curated.
|
|
22
22
|
*/
|
|
23
23
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
24
|
-
static featureName = _constants2.FEATURE_NAME;
|
|
24
|
+
static featureName = (() => _constants2.FEATURE_NAME)();
|
|
25
25
|
#mode;
|
|
26
26
|
constructor(agentIdentifier, aggregator) {
|
|
27
27
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
@@ -39,7 +39,7 @@ class Recorder {
|
|
|
39
39
|
/** Config to inform to inline stylesheet contents (true default) */
|
|
40
40
|
this.shouldInlineStylesheets = (0, _config.getConfigurationValue)(this.parent.agentIdentifier, 'session_replay.inline_stylesheet');
|
|
41
41
|
/** A flag that can be set to false by failing conversions to stop the fetching process */
|
|
42
|
-
this.shouldFix = this.shouldInlineStylesheets;
|
|
42
|
+
this.shouldFix = this.shouldInlineStylesheets && (0, _config.getConfigurationValue)(this.parent.agentIdentifier, 'session_replay.fix_stylesheets');
|
|
43
43
|
/** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
|
|
44
44
|
this.stopRecording = () => {/* no-op until set by rrweb initializer */};
|
|
45
45
|
}
|
|
@@ -7,7 +7,7 @@ exports.stylesheetEvaluator = void 0;
|
|
|
7
7
|
var _config = require("../../../common/config/config");
|
|
8
8
|
var _runtime = require("../../../common/constants/runtime");
|
|
9
9
|
class StylesheetEvaluator {
|
|
10
|
-
#evaluated = new WeakSet();
|
|
10
|
+
#evaluated = (() => new WeakSet())();
|
|
11
11
|
#fetchProms = [];
|
|
12
12
|
/**
|
|
13
13
|
* Flipped to true if stylesheets that cannot be natively inlined are detected by the stylesheetEvaluator class
|
|
@@ -18,7 +18,7 @@ const ERROR_MODE_SECONDS_WINDOW = 30 * 1000; // sliding window of nodes to track
|
|
|
18
18
|
/** Reserved room for query param attrs */
|
|
19
19
|
const QUERY_PARAM_PADDING = 5000;
|
|
20
20
|
class Aggregate extends _aggregateBase.AggregateBase {
|
|
21
|
-
static featureName = _constants.FEATURE_NAME;
|
|
21
|
+
static featureName = (() => _constants.FEATURE_NAME)();
|
|
22
22
|
constructor(agentIdentifier, aggregator) {
|
|
23
23
|
super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
|
|
24
24
|
this.agentRuntime = (0, _config.getRuntime)(agentIdentifier);
|
|
@@ -39,10 +39,10 @@ const toAggregate = {
|
|
|
39
39
|
class TraceStorage {
|
|
40
40
|
nodeCount = 0;
|
|
41
41
|
trace = {};
|
|
42
|
-
earliestTimeStamp = Infinity;
|
|
42
|
+
earliestTimeStamp = (() => Infinity)();
|
|
43
43
|
latestTimeStamp = 0;
|
|
44
44
|
tempStorage = [];
|
|
45
|
-
prevStoredEvents = new Set();
|
|
45
|
+
prevStoredEvents = (() => new Set())();
|
|
46
46
|
constructor(parent) {
|
|
47
47
|
this.parent = parent;
|
|
48
48
|
}
|
|
@@ -30,7 +30,7 @@ const {
|
|
|
30
30
|
PUSH_STATE
|
|
31
31
|
} = CONSTANTS;
|
|
32
32
|
class Instrument extends _instrumentBase.InstrumentBase {
|
|
33
|
-
static featureName = FEATURE_NAME;
|
|
33
|
+
static featureName = (() => FEATURE_NAME)();
|
|
34
34
|
constructor(agentIdentifier, aggregator) {
|
|
35
35
|
let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
36
36
|
super(agentIdentifier, aggregator, FEATURE_NAME, auto);
|
|
@@ -13,7 +13,7 @@ class BelNode {
|
|
|
13
13
|
end;
|
|
14
14
|
callbackEnd = 0;
|
|
15
15
|
callbackDuration = 0;
|
|
16
|
-
nodeId = ++nodesSeen;
|
|
16
|
+
nodeId = (() => ++nodesSeen)();
|
|
17
17
|
constructor(agentIdentifier) {
|
|
18
18
|
if (!agentIdentifier) throw new Error('Interaction is missing core attributes');
|
|
19
19
|
this.agentIdentifier = agentIdentifier;
|