@webex/internal-plugin-metrics 3.5.0 → 3.6.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/dist/business-metrics.js +119 -9
- package/dist/business-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +18 -7
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js +7 -2
- package/dist/call-diagnostic/call-diagnostic-metrics.util.js.map +1 -1
- package/dist/call-diagnostic/config.js +13 -3
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/call-diagnostic-events-batcher.js +59 -0
- package/dist/call-diagnostic-events-batcher.js.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +1 -1
- package/dist/metrics.types.js.map +1 -1
- package/dist/new-metrics.js +5 -2
- package/dist/new-metrics.js.map +1 -1
- package/dist/rtcMetrics/constants.js +11 -0
- package/dist/rtcMetrics/constants.js.map +1 -0
- package/dist/rtcMetrics/index.js +223 -0
- package/dist/rtcMetrics/index.js.map +1 -0
- package/dist/types/business-metrics.d.ts +36 -4
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +6 -1
- package/dist/types/call-diagnostic/config.d.ts +3 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/metrics.types.d.ts +17 -2
- package/dist/types/new-metrics.d.ts +5 -3
- package/dist/types/rtcMetrics/constants.d.ts +4 -0
- package/dist/types/rtcMetrics/index.d.ts +80 -0
- package/package.json +11 -11
- package/src/business-metrics.ts +97 -5
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +1 -1
- package/src/call-diagnostic/call-diagnostic-metrics.ts +17 -7
- package/src/call-diagnostic/call-diagnostic-metrics.util.ts +11 -5
- package/src/call-diagnostic/config.ts +12 -0
- package/src/index.ts +2 -0
- package/src/metrics.types.ts +95 -23
- package/src/new-metrics.ts +12 -2
- package/src/rtcMetrics/constants.ts +3 -0
- package/src/rtcMetrics/index.ts +205 -0
- package/test/unit/spec/business/business-metrics.ts +69 -2
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-batcher.ts +2 -1
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +4 -6
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +406 -11
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.util.ts +7 -3
- package/test/unit/spec/new-metrics.ts +18 -3
- package/test/unit/spec/prelogin-metrics-batcher.ts +3 -1
- package/test/unit/spec/rtcMetrics/index.ts +196 -0
- package/dist/behavioral/behavioral-metrics.js +0 -199
- package/dist/behavioral/behavioral-metrics.js.map +0 -1
- package/dist/behavioral/config.js +0 -11
- package/dist/behavioral/config.js.map +0 -1
- package/dist/types/behavioral/behavioral-metrics.d.ts +0 -63
- package/dist/types/behavioral/config.d.ts +0 -1
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import 'jsdom-global/register';
|
|
2
|
+
import RtcMetrics from '../../../../src/rtcMetrics';
|
|
3
|
+
import MockWebex from '@webex/test-helper-mock-webex';
|
|
4
|
+
import {assert} from '@webex/test-helper-chai';
|
|
5
|
+
import sinon from 'sinon';
|
|
6
|
+
import RTC_METRICS from '../../../../src/rtcMetrics/constants';
|
|
7
|
+
|
|
8
|
+
const FAKE_METRICS_ITEM = {payload: ['{"type":"string","value":"fake-metrics","id":""}']};
|
|
9
|
+
const FAILURE_METRICS_ITEM = {
|
|
10
|
+
name: "onconnectionstatechange",
|
|
11
|
+
payload: ['{"type":"string","value":"failed","id":""}'],
|
|
12
|
+
timestamp: 1707929986667
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const STATS_WITH_IP = '{"id":"RTCIceCandidate_/kQs0ZNU","type":"remote-candidate","transportId":"RTCTransport_0_1","isRemote":true,"ip":"11.22.111.255","address":"11.22.111.255","port":5004,"protocol":"udp","candidateType":"host","priority":2130706431}';
|
|
16
|
+
const STATS_WITH_IP_RESULT = '{"id":"RTCIceCandidate_/kQs0ZNU","type":"remote-candidate","transportId":"RTCTransport_0_1","isRemote":true,"ip":"11.22.111.240","address":"11.22.111.240","port":5004,"protocol":"udp","candidateType":"host","priority":2130706431}';
|
|
17
|
+
|
|
18
|
+
describe('RtcMetrics', () => {
|
|
19
|
+
let metrics: RtcMetrics;
|
|
20
|
+
let webex: MockWebex;
|
|
21
|
+
let clock;
|
|
22
|
+
let anonymizeIpSpy;
|
|
23
|
+
|
|
24
|
+
const sandbox = sinon.createSandbox();
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
clock = sinon.useFakeTimers();
|
|
28
|
+
window.setInterval = setInterval;
|
|
29
|
+
webex = new MockWebex();
|
|
30
|
+
metrics = new RtcMetrics(webex, {meetingId: 'mock-meeting-id'}, 'mock-correlation-id');
|
|
31
|
+
anonymizeIpSpy = sandbox.spy(metrics, 'anonymizeIp');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
sandbox.restore();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('sendMetrics should send a webex request', () => {
|
|
39
|
+
assert.notCalled(webex.request);
|
|
40
|
+
|
|
41
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
42
|
+
(metrics as any).sendMetrics();
|
|
43
|
+
|
|
44
|
+
assert.callCount(webex.request, 1);
|
|
45
|
+
assert.calledWithMatch(webex.request, sinon.match.has('headers', {
|
|
46
|
+
type: 'webrtcMedia',
|
|
47
|
+
appId: RTC_METRICS.APP_ID,
|
|
48
|
+
}));
|
|
49
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].data[0].payload', FAKE_METRICS_ITEM.payload));
|
|
50
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].meetingId', 'mock-meeting-id'));
|
|
51
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].correlationId', 'mock-correlation-id'));
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should have a defined sendMetricsInQueue function which is public', () => {
|
|
55
|
+
assert.isDefined(metrics.sendMetricsInQueue);
|
|
56
|
+
assert.isFunction(metrics.sendMetricsInQueue);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it('should send metrics requests over time', () => {
|
|
60
|
+
assert.notCalled(webex.request);
|
|
61
|
+
|
|
62
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
63
|
+
assert.deepEqual(metrics.metricsQueue, [FAKE_METRICS_ITEM]);
|
|
64
|
+
clock.tick(60 * 1000);
|
|
65
|
+
|
|
66
|
+
assert.callCount(webex.request, 1);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('should not send requests with no items in the queue', () => {
|
|
70
|
+
clock.tick(60 * 1000);
|
|
71
|
+
assert.notCalled(webex.request);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('sendMetricsInQueue should send metrics if any exist in the queue', () => {
|
|
75
|
+
assert.notCalled(webex.request);
|
|
76
|
+
|
|
77
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
78
|
+
(metrics as any).sendMetricsInQueue();
|
|
79
|
+
|
|
80
|
+
assert.callCount(webex.request, 1);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('should clear out metrics on close', () => {
|
|
84
|
+
assert.notCalled(webex.request);
|
|
85
|
+
|
|
86
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
87
|
+
metrics.closeMetrics();
|
|
88
|
+
|
|
89
|
+
assert.callCount(webex.request, 1);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('should clear out metrics on failure', () => {
|
|
93
|
+
assert.notCalled(webex.request);
|
|
94
|
+
|
|
95
|
+
metrics.addMetrics(FAILURE_METRICS_ITEM);
|
|
96
|
+
|
|
97
|
+
assert.callCount(webex.request, 1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should have the same connectionId on success', () => {
|
|
101
|
+
const originalId = metrics.connectionId;
|
|
102
|
+
|
|
103
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
104
|
+
|
|
105
|
+
assert.strictEqual(originalId, metrics.connectionId);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should have a new connectionId on failure', () => {
|
|
109
|
+
const originalId = metrics.connectionId;
|
|
110
|
+
|
|
111
|
+
metrics.addMetrics(FAILURE_METRICS_ITEM);
|
|
112
|
+
|
|
113
|
+
assert.notEqual(originalId, metrics.connectionId);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('should anonymize IP addresses', () => {
|
|
117
|
+
assert.strictEqual(metrics.anonymizeIp(STATS_WITH_IP), STATS_WITH_IP_RESULT);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should call anonymizeIp', () => {
|
|
121
|
+
metrics.addMetrics({ name: 'stats-report', payload: [STATS_WITH_IP] });
|
|
122
|
+
assert.calledOnce(anonymizeIpSpy);
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
it('should send metrics on first stats-report', () => {
|
|
126
|
+
assert.callCount(webex.request, 0);
|
|
127
|
+
|
|
128
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
129
|
+
assert.callCount(webex.request, 0);
|
|
130
|
+
|
|
131
|
+
// first stats-report should trigger a call to webex.request
|
|
132
|
+
metrics.addMetrics({ name: 'stats-report', payload: [STATS_WITH_IP] });
|
|
133
|
+
assert.callCount(webex.request, 1);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should send metrics on first stats-report after a new connection', () => {
|
|
137
|
+
assert.callCount(webex.request, 0);
|
|
138
|
+
|
|
139
|
+
// first stats-report should trigger a call to webex.request
|
|
140
|
+
metrics.addMetrics({ name: 'stats-report', payload: [STATS_WITH_IP] });
|
|
141
|
+
assert.callCount(webex.request, 1);
|
|
142
|
+
|
|
143
|
+
// subsequent stats-report doesn't trigger it
|
|
144
|
+
metrics.addMetrics({ name: 'stats-report', payload: [STATS_WITH_IP] });
|
|
145
|
+
assert.callCount(webex.request, 1);
|
|
146
|
+
|
|
147
|
+
// now, simulate a failure - that triggers a new connection and upload of the metrics
|
|
148
|
+
metrics.addMetrics(FAILURE_METRICS_ITEM);
|
|
149
|
+
assert.callCount(webex.request, 2);
|
|
150
|
+
|
|
151
|
+
// and another stats-report should trigger another upload of the metrics
|
|
152
|
+
metrics.addMetrics({ name: 'stats-report', payload: [STATS_WITH_IP] });
|
|
153
|
+
assert.callCount(webex.request, 3);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
describe('RtcMetrics - callId', () => {
|
|
157
|
+
let metrics: RtcMetrics;
|
|
158
|
+
let webex: MockWebex;
|
|
159
|
+
let clock;
|
|
160
|
+
let sandbox;
|
|
161
|
+
|
|
162
|
+
beforeEach(() => {
|
|
163
|
+
clock = sinon.useFakeTimers();
|
|
164
|
+
window.setInterval = setInterval;
|
|
165
|
+
webex = new MockWebex();
|
|
166
|
+
metrics = new RtcMetrics(webex, {callId: 'mock-call-id'}, 'mock-correlation-id');
|
|
167
|
+
sandbox = sinon.createSandbox();
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
afterEach(() => {
|
|
171
|
+
sandbox.restore();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
it('sendMetrics should send a webex request with callId', () => {
|
|
175
|
+
assert.notCalled(webex.request);
|
|
176
|
+
|
|
177
|
+
metrics.addMetrics(FAKE_METRICS_ITEM);
|
|
178
|
+
(metrics as any).sendMetrics();
|
|
179
|
+
|
|
180
|
+
assert.callCount(webex.request, 1);
|
|
181
|
+
assert.calledWithMatch(webex.request, sinon.match.has('headers', {
|
|
182
|
+
type: 'webrtcMedia',
|
|
183
|
+
appId: RTC_METRICS.APP_ID,
|
|
184
|
+
}));
|
|
185
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].data[0].payload', FAKE_METRICS_ITEM.payload));
|
|
186
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].callId', 'mock-call-id'));
|
|
187
|
+
assert.calledWithMatch(webex.request, sinon.match.hasNested('body.metrics[0].correlationId', 'mock-correlation-id'));
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
it('should update the callId correctly', () => {
|
|
191
|
+
const newCallId = 'new-call-id';
|
|
192
|
+
metrics.updateCallId(newCallId);
|
|
193
|
+
assert.strictEqual(metrics.callId, newCallId);
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
});
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Reflect$construct = require("@babel/runtime-corejs2/core-js/reflect/construct");
|
|
4
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
6
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
exports.default = void 0;
|
|
10
|
-
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
13
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/assertThisInitialized"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/getPrototypeOf"));
|
|
17
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
18
|
-
var _lodash = require("lodash");
|
|
19
|
-
var _common = require("@webex/common");
|
|
20
|
-
var _webexCore = require("@webex/webex-core");
|
|
21
|
-
var _metrics = require("../metrics");
|
|
22
|
-
var _config = require("./config");
|
|
23
|
-
var _clientMetricsBatcher = _interopRequireDefault(require("../client-metrics-batcher"));
|
|
24
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
25
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
26
|
-
var _BrowserDetection = (0, _common.BrowserDetection)(),
|
|
27
|
-
getOSVersion = _BrowserDetection.getOSVersion,
|
|
28
|
-
getBrowserName = _BrowserDetection.getBrowserName,
|
|
29
|
-
getBrowserVersion = _BrowserDetection.getBrowserVersion;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @description Util class to handle Behavioral Metrics
|
|
33
|
-
* @export
|
|
34
|
-
* @class BehavioralMetrics
|
|
35
|
-
*/
|
|
36
|
-
var BehavioralMetrics = exports.default = /*#__PURE__*/function (_StatelessWebexPlugin) {
|
|
37
|
-
(0, _inherits2.default)(BehavioralMetrics, _StatelessWebexPlugin);
|
|
38
|
-
var _super = _createSuper(BehavioralMetrics);
|
|
39
|
-
/**
|
|
40
|
-
* Constructor
|
|
41
|
-
* @param {any[]} args
|
|
42
|
-
*/
|
|
43
|
-
function BehavioralMetrics() {
|
|
44
|
-
var _this;
|
|
45
|
-
(0, _classCallCheck2.default)(this, BehavioralMetrics);
|
|
46
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
-
args[_key] = arguments[_key];
|
|
48
|
-
}
|
|
49
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clientMetricsBatcher", void 0);
|
|
53
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "logger", void 0);
|
|
54
|
-
// to avoid adding @ts-ignore everywhere
|
|
55
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "device", void 0);
|
|
56
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "version", void 0);
|
|
57
|
-
_this.logger = _this.webex.logger;
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
_this.device = _this.webex.internal.device;
|
|
60
|
-
// @ts-ignore
|
|
61
|
-
_this.version = _this.webex.version;
|
|
62
|
-
// @ts-ignore
|
|
63
|
-
_this.clientMetricsBatcher = new _clientMetricsBatcher.default({}, {
|
|
64
|
-
parent: _this.webex
|
|
65
|
-
});
|
|
66
|
-
return _this;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Returns the deviceId from our registration with WDM.
|
|
71
|
-
* @returns {string} deviceId or empty string
|
|
72
|
-
*/
|
|
73
|
-
(0, _createClass2.default)(BehavioralMetrics, [{
|
|
74
|
-
key: "getDeviceId",
|
|
75
|
-
value: function getDeviceId() {
|
|
76
|
-
var url = this.device.url;
|
|
77
|
-
if (url && url.length !== 0) {
|
|
78
|
-
var n = url.lastIndexOf('/');
|
|
79
|
-
if (n !== -1) {
|
|
80
|
-
return url.substring(n + 1);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return '';
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Returns the context object to be submitted with all behavioral metrics.
|
|
88
|
-
* @returns {BehavioralEventContext}
|
|
89
|
-
*/
|
|
90
|
-
}, {
|
|
91
|
-
key: "getContext",
|
|
92
|
-
value: function getContext() {
|
|
93
|
-
var context = {
|
|
94
|
-
app: {
|
|
95
|
-
version: this.version
|
|
96
|
-
},
|
|
97
|
-
device: {
|
|
98
|
-
id: this.getDeviceId()
|
|
99
|
-
},
|
|
100
|
-
locale: window.navigator.language,
|
|
101
|
-
os: {
|
|
102
|
-
name: (0, _metrics.getOSNameInternal)(),
|
|
103
|
-
version: getOSVersion()
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
return context;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Returns the default tags to be included with all behavioral metrics.
|
|
111
|
-
* @returns {BehavioralEventPayload}
|
|
112
|
-
*/
|
|
113
|
-
}, {
|
|
114
|
-
key: "getDefaultTags",
|
|
115
|
-
value: function getDefaultTags() {
|
|
116
|
-
var tags = {
|
|
117
|
-
browser: getBrowserName(),
|
|
118
|
-
browserHeight: window.innerHeight,
|
|
119
|
-
browserVersion: getBrowserVersion(),
|
|
120
|
-
browserWidth: window.innerWidth,
|
|
121
|
-
domain: window.location.hostname,
|
|
122
|
-
inIframe: window.self !== window.top,
|
|
123
|
-
locale: window.navigator.language,
|
|
124
|
-
os: (0, _metrics.getOSNameInternal)()
|
|
125
|
-
};
|
|
126
|
-
return tags;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Creates the object to send to our metrics endpoint for a behavioral event
|
|
131
|
-
* @param {MetricEventProduct} product
|
|
132
|
-
* @param {MetricEventAgent} agent
|
|
133
|
-
* @param {string} target
|
|
134
|
-
* @param {MetricEventVerb} verb
|
|
135
|
-
* @returns {BehavioralEventPayload}
|
|
136
|
-
*/
|
|
137
|
-
}, {
|
|
138
|
-
key: "createEventObject",
|
|
139
|
-
value: function createEventObject(_ref) {
|
|
140
|
-
var product = _ref.product,
|
|
141
|
-
agent = _ref.agent,
|
|
142
|
-
target = _ref.target,
|
|
143
|
-
verb = _ref.verb,
|
|
144
|
-
payload = _ref.payload;
|
|
145
|
-
var metricName = "".concat(product, ".").concat(agent, ".").concat(target, ".").concat(verb);
|
|
146
|
-
var allTags = payload;
|
|
147
|
-
allTags = (0, _lodash.merge)(allTags, this.getDefaultTags());
|
|
148
|
-
var event = {
|
|
149
|
-
context: this.getContext(),
|
|
150
|
-
metricName: metricName,
|
|
151
|
-
tags: allTags,
|
|
152
|
-
timestamp: (0, _now.default)(),
|
|
153
|
-
type: ['behavioral']
|
|
154
|
-
};
|
|
155
|
-
return event;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* Returns true once we're ready to submit behavioral metrics, after startup.
|
|
160
|
-
* @returns {boolean} true when deviceId is defined and non-empty
|
|
161
|
-
*/
|
|
162
|
-
}, {
|
|
163
|
-
key: "isReadyToSubmitBehavioralEvents",
|
|
164
|
-
value: function isReadyToSubmitBehavioralEvents() {
|
|
165
|
-
var deviceId = this.getDeviceId();
|
|
166
|
-
return deviceId && deviceId.length !== 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Submit a behavioral metric to our metrics endpoint.
|
|
171
|
-
* @param {MetricEventProduct} product the product from which the metric is being submitted, e.g. 'webex' web client, 'wxcc_desktop'
|
|
172
|
-
* @param {MetricEventAgent} agent the source of the action for this metric
|
|
173
|
-
* @param {string} target the 'thing' that this metric includes information about
|
|
174
|
-
* @param {MetricEventVerb} verb the action that this metric includes information about
|
|
175
|
-
* @param {BehavioralEventPayload} payload information specific to this event. This should be flat, i.e. it should not include nested objects.
|
|
176
|
-
* @returns {Promise<any>}
|
|
177
|
-
*/
|
|
178
|
-
}, {
|
|
179
|
-
key: "submitBehavioralEvent",
|
|
180
|
-
value: function submitBehavioralEvent(_ref2) {
|
|
181
|
-
var product = _ref2.product,
|
|
182
|
-
agent = _ref2.agent,
|
|
183
|
-
target = _ref2.target,
|
|
184
|
-
verb = _ref2.verb,
|
|
185
|
-
payload = _ref2.payload;
|
|
186
|
-
this.logger.log(_config.BEHAVIORAL_LOG_IDENTIFIER, "BehavioralMetrics: @submitBehavioralEvent. Submit Behavioral event: ".concat(product, ".").concat(agent, ".").concat(target, ".").concat(verb));
|
|
187
|
-
var behavioralEvent = this.createEventObject({
|
|
188
|
-
product: product,
|
|
189
|
-
agent: agent,
|
|
190
|
-
target: target,
|
|
191
|
-
verb: verb,
|
|
192
|
-
payload: payload
|
|
193
|
-
});
|
|
194
|
-
return this.clientMetricsBatcher.request(behavioralEvent);
|
|
195
|
-
}
|
|
196
|
-
}]);
|
|
197
|
-
return BehavioralMetrics;
|
|
198
|
-
}(_webexCore.StatelessWebexPlugin);
|
|
199
|
-
//# sourceMappingURL=behavioral-metrics.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_lodash","require","_common","_webexCore","_metrics","_config","_clientMetricsBatcher","_interopRequireDefault","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","default","result","NewTarget","constructor","_Reflect$construct","arguments","apply","_possibleConstructorReturn2","Reflect","sham","Proxy","Boolean","prototype","valueOf","call","e","_BrowserDetection","BrowserDetection","getOSVersion","getBrowserName","getBrowserVersion","BehavioralMetrics","exports","_StatelessWebexPlugin","_inherits2","_super","_this","_classCallCheck2","_len","length","args","Array","_key","concat","_defineProperty2","_assertThisInitialized2","logger","webex","device","internal","version","clientMetricsBatcher","ClientMetricsBatcher","parent","_createClass2","key","value","getDeviceId","url","n","lastIndexOf","substring","getContext","context","app","id","locale","window","navigator","language","os","name","getOSNameInternal","getDefaultTags","tags","browser","browserHeight","innerHeight","browserVersion","browserWidth","innerWidth","domain","location","hostname","inIframe","self","top","createEventObject","_ref","product","agent","target","verb","payload","metricName","allTags","merge","event","timestamp","_now","type","isReadyToSubmitBehavioralEvents","deviceId","submitBehavioralEvent","_ref2","log","BEHAVIORAL_LOG_IDENTIFIER","behavioralEvent","request","StatelessWebexPlugin"],"sources":["behavioral-metrics.ts"],"sourcesContent":["import {merge} from 'lodash';\nimport {BrowserDetection} from '@webex/common';\nimport {StatelessWebexPlugin} from '@webex/webex-core';\nimport {getOSNameInternal} from '../metrics';\nimport {BEHAVIORAL_LOG_IDENTIFIER} from './config';\nimport {\n MetricEventProduct,\n MetricEventAgent,\n MetricEventVerb,\n BehavioralEventContext,\n BehavioralEvent,\n BehavioralEventPayload,\n} from '../metrics.types';\nimport ClientMetricsBatcher from '../client-metrics-batcher';\n\nconst {getOSVersion, getBrowserName, getBrowserVersion} = BrowserDetection();\n\n/**\n * @description Util class to handle Behavioral Metrics\n * @export\n * @class BehavioralMetrics\n */\nexport default class BehavioralMetrics extends StatelessWebexPlugin {\n // @ts-ignore\n private clientMetricsBatcher: ClientMetricsBatcher;\n private logger: any; // to avoid adding @ts-ignore everywhere\n private device: any;\n private version: string;\n\n /**\n * Constructor\n * @param {any[]} args\n */\n constructor(...args) {\n super(...args);\n // @ts-ignore\n this.logger = this.webex.logger;\n // @ts-ignore\n this.device = this.webex.internal.device;\n // @ts-ignore\n this.version = this.webex.version;\n // @ts-ignore\n this.clientMetricsBatcher = new ClientMetricsBatcher({}, {parent: this.webex});\n }\n\n /**\n * Returns the deviceId from our registration with WDM.\n * @returns {string} deviceId or empty string\n */\n private getDeviceId(): string {\n const {url} = this.device;\n if (url && url.length !== 0) {\n const n = url.lastIndexOf('/');\n if (n !== -1) {\n return url.substring(n + 1);\n }\n }\n\n return '';\n }\n\n /**\n * Returns the context object to be submitted with all behavioral metrics.\n * @returns {BehavioralEventContext}\n */\n private getContext(): BehavioralEventContext {\n const context: BehavioralEventContext = {\n app: {\n version: this.version,\n },\n device: {\n id: this.getDeviceId(),\n },\n locale: window.navigator.language,\n os: {\n name: getOSNameInternal(),\n version: getOSVersion(),\n },\n };\n\n return context;\n }\n\n /**\n * Returns the default tags to be included with all behavioral metrics.\n * @returns {BehavioralEventPayload}\n */\n private getDefaultTags(): BehavioralEventPayload {\n const tags = {\n browser: getBrowserName(),\n browserHeight: window.innerHeight,\n browserVersion: getBrowserVersion(),\n browserWidth: window.innerWidth,\n domain: window.location.hostname,\n inIframe: window.self !== window.top,\n locale: window.navigator.language,\n os: getOSNameInternal(),\n };\n\n return tags;\n }\n\n /**\n * Creates the object to send to our metrics endpoint for a behavioral event\n * @param {MetricEventProduct} product\n * @param {MetricEventAgent} agent\n * @param {string} target\n * @param {MetricEventVerb} verb\n * @returns {BehavioralEventPayload}\n */\n private createEventObject({\n product,\n agent,\n target,\n verb,\n payload,\n }: {\n product: MetricEventProduct;\n agent: MetricEventAgent;\n target: string;\n verb: MetricEventVerb;\n payload?: BehavioralEventPayload;\n }): BehavioralEvent {\n const metricName = `${product}.${agent}.${target}.${verb}`;\n let allTags: BehavioralEventPayload = payload;\n allTags = merge(allTags, this.getDefaultTags());\n\n const event: BehavioralEvent = {\n context: this.getContext(),\n metricName,\n tags: allTags,\n timestamp: Date.now(),\n type: ['behavioral'],\n };\n\n return event;\n }\n\n /**\n * Returns true once we're ready to submit behavioral metrics, after startup.\n * @returns {boolean} true when deviceId is defined and non-empty\n */\n public isReadyToSubmitBehavioralEvents(): boolean {\n const deviceId = this.getDeviceId();\n\n return deviceId && deviceId.length !== 0;\n }\n\n /**\n * Submit a behavioral metric to our metrics endpoint.\n * @param {MetricEventProduct} product the product from which the metric is being submitted, e.g. 'webex' web client, 'wxcc_desktop'\n * @param {MetricEventAgent} agent the source of the action for this metric\n * @param {string} target the 'thing' that this metric includes information about\n * @param {MetricEventVerb} verb the action that this metric includes information about\n * @param {BehavioralEventPayload} payload information specific to this event. This should be flat, i.e. it should not include nested objects.\n * @returns {Promise<any>}\n */\n public submitBehavioralEvent({\n product,\n agent,\n target,\n verb,\n payload,\n }: {\n product: MetricEventProduct;\n agent: MetricEventAgent;\n target: string;\n verb: MetricEventVerb;\n payload?: BehavioralEventPayload;\n }) {\n this.logger.log(\n BEHAVIORAL_LOG_IDENTIFIER,\n `BehavioralMetrics: @submitBehavioralEvent. Submit Behavioral event: ${product}.${agent}.${target}.${verb}`\n );\n const behavioralEvent = this.createEventObject({product, agent, target, verb, payload});\n\n return this.clientMetricsBatcher.request(behavioralEvent);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AASA,IAAAK,qBAAA,GAAAC,sBAAA,CAAAN,OAAA;AAA6D,SAAAO,aAAAC,OAAA,QAAAC,yBAAA,GAAAC,yBAAA,oBAAAC,qBAAA,QAAAC,KAAA,OAAAC,gBAAA,CAAAC,OAAA,EAAAN,OAAA,GAAAO,MAAA,MAAAN,yBAAA,QAAAO,SAAA,OAAAH,gBAAA,CAAAC,OAAA,QAAAG,WAAA,EAAAF,MAAA,GAAAG,kBAAA,CAAAN,KAAA,EAAAO,SAAA,EAAAH,SAAA,YAAAD,MAAA,GAAAH,KAAA,CAAAQ,KAAA,OAAAD,SAAA,gBAAAE,2BAAA,CAAAP,OAAA,QAAAC,MAAA;AAAA,SAAAL,0BAAA,eAAAY,OAAA,qBAAAJ,kBAAA,oBAAAA,kBAAA,CAAAK,IAAA,2BAAAC,KAAA,oCAAAC,OAAA,CAAAC,SAAA,CAAAC,OAAA,CAAAC,IAAA,CAAAV,kBAAA,CAAAO,OAAA,8CAAAI,CAAA;AAE7D,IAAAC,iBAAA,GAA0D,IAAAC,wBAAgB,EAAC,CAAC;EAArEC,YAAY,GAAAF,iBAAA,CAAZE,YAAY;EAAEC,cAAc,GAAAH,iBAAA,CAAdG,cAAc;EAAEC,iBAAiB,GAAAJ,iBAAA,CAAjBI,iBAAiB;;AAE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AI,CAAC7C,WAAW,CAAC,CAAC;MAEnC,OAAO6C,QAAQ,IAAIA,QAAQ,CAAC/D,MAAM,KAAK,CAAC;IAC1C;;IAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EARE;IAAAgB,GAAA;IAAAC,KAAA,EASA,SAAA+C,sBAAAC,KAAA,EAYG;MAAA,IAXDf,OAAO,GAAAe,KAAA,CAAPf,OAAO;QACPC,KAAK,GAAAc,KAAA,CAALd,KAAK;QACLC,MAAM,GAAAa,KAAA,CAANb,MAAM;QACNC,IAAI,GAAAY,KAAA,CAAJZ,IAAI;QACJC,OAAO,GAAAW,KAAA,CAAPX,OAAO;MAQP,IAAI,CAAC/C,MAAM,CAAC2D,GAAG,CACbC,iCAAyB,yEAAA/D,MAAA,CAC8C8C,OAAO,OAAA9C,MAAA,CAAI+C,KAAK,OAAA/C,MAAA,CAAIgD,MAAM,OAAAhD,MAAA,CAAIiD,IAAI,CAC3G,CAAC;MACD,IAAMe,eAAe,GAAG,IAAI,CAACpB,iBAAiB,CAAC;QAACE,OAAO,EAAPA,OAAO;QAAEC,KAAK,EAALA,KAAK;QAAEC,MAAM,EAANA,MAAM;QAAEC,IAAI,EAAJA,IAAI;QAAEC,OAAO,EAAPA;MAAO,CAAC,CAAC;MAEvF,OAAO,IAAI,CAAC1C,oBAAoB,CAACyD,OAAO,CAACD,eAAe,CAAC;IAC3D;EAAC;EAAA,OAAA5E,iBAAA;AAAA,EA3J4C8E,+BAAoB"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
4
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.BEHAVIORAL_LOG_IDENTIFIER = void 0;
|
|
8
|
-
/* eslint-disable import/prefer-default-export */
|
|
9
|
-
|
|
10
|
-
var BEHAVIORAL_LOG_IDENTIFIER = exports.BEHAVIORAL_LOG_IDENTIFIER = 'behavioral-events -> ';
|
|
11
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["BEHAVIORAL_LOG_IDENTIFIER","exports"],"sources":["config.ts"],"sourcesContent":["/* eslint-disable import/prefer-default-export */\n\nexport const BEHAVIORAL_LOG_IDENTIFIER = 'behavioral-events -> ';\n"],"mappings":";;;;;;;AAAA;;AAEO,IAAMA,yBAAyB,GAAAC,OAAA,CAAAD,yBAAA,GAAG,uBAAuB"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { StatelessWebexPlugin } from '@webex/webex-core';
|
|
2
|
-
import { MetricEventProduct, MetricEventAgent, MetricEventVerb, BehavioralEventPayload } from '../metrics.types';
|
|
3
|
-
/**
|
|
4
|
-
* @description Util class to handle Behavioral Metrics
|
|
5
|
-
* @export
|
|
6
|
-
* @class BehavioralMetrics
|
|
7
|
-
*/
|
|
8
|
-
export default class BehavioralMetrics extends StatelessWebexPlugin {
|
|
9
|
-
private clientMetricsBatcher;
|
|
10
|
-
private logger;
|
|
11
|
-
private device;
|
|
12
|
-
private version;
|
|
13
|
-
/**
|
|
14
|
-
* Constructor
|
|
15
|
-
* @param {any[]} args
|
|
16
|
-
*/
|
|
17
|
-
constructor(...args: any[]);
|
|
18
|
-
/**
|
|
19
|
-
* Returns the deviceId from our registration with WDM.
|
|
20
|
-
* @returns {string} deviceId or empty string
|
|
21
|
-
*/
|
|
22
|
-
private getDeviceId;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the context object to be submitted with all behavioral metrics.
|
|
25
|
-
* @returns {BehavioralEventContext}
|
|
26
|
-
*/
|
|
27
|
-
private getContext;
|
|
28
|
-
/**
|
|
29
|
-
* Returns the default tags to be included with all behavioral metrics.
|
|
30
|
-
* @returns {BehavioralEventPayload}
|
|
31
|
-
*/
|
|
32
|
-
private getDefaultTags;
|
|
33
|
-
/**
|
|
34
|
-
* Creates the object to send to our metrics endpoint for a behavioral event
|
|
35
|
-
* @param {MetricEventProduct} product
|
|
36
|
-
* @param {MetricEventAgent} agent
|
|
37
|
-
* @param {string} target
|
|
38
|
-
* @param {MetricEventVerb} verb
|
|
39
|
-
* @returns {BehavioralEventPayload}
|
|
40
|
-
*/
|
|
41
|
-
private createEventObject;
|
|
42
|
-
/**
|
|
43
|
-
* Returns true once we're ready to submit behavioral metrics, after startup.
|
|
44
|
-
* @returns {boolean} true when deviceId is defined and non-empty
|
|
45
|
-
*/
|
|
46
|
-
isReadyToSubmitBehavioralEvents(): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Submit a behavioral metric to our metrics endpoint.
|
|
49
|
-
* @param {MetricEventProduct} product the product from which the metric is being submitted, e.g. 'webex' web client, 'wxcc_desktop'
|
|
50
|
-
* @param {MetricEventAgent} agent the source of the action for this metric
|
|
51
|
-
* @param {string} target the 'thing' that this metric includes information about
|
|
52
|
-
* @param {MetricEventVerb} verb the action that this metric includes information about
|
|
53
|
-
* @param {BehavioralEventPayload} payload information specific to this event. This should be flat, i.e. it should not include nested objects.
|
|
54
|
-
* @returns {Promise<any>}
|
|
55
|
-
*/
|
|
56
|
-
submitBehavioralEvent({ product, agent, target, verb, payload, }: {
|
|
57
|
-
product: MetricEventProduct;
|
|
58
|
-
agent: MetricEventAgent;
|
|
59
|
-
target: string;
|
|
60
|
-
verb: MetricEventVerb;
|
|
61
|
-
payload?: BehavioralEventPayload;
|
|
62
|
-
}): any;
|
|
63
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const BEHAVIORAL_LOG_IDENTIFIER = "behavioral-events -> ";
|