@webex/internal-plugin-metrics 3.7.0 → 3.8.0-next.10
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 +74 -100
- package/dist/business-metrics.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js +24 -15
- package/dist/call-diagnostic/call-diagnostic-metrics-latencies.js.map +1 -1
- package/dist/call-diagnostic/call-diagnostic-metrics.js +76 -10
- package/dist/call-diagnostic/call-diagnostic-metrics.js.map +1 -1
- package/dist/call-diagnostic/config.js +19 -12
- package/dist/call-diagnostic/config.js.map +1 -1
- package/dist/generic-metrics.js +2 -2
- package/dist/generic-metrics.js.map +1 -1
- 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 +28 -5
- package/dist/new-metrics.js.map +1 -1
- package/dist/types/business-metrics.d.ts +10 -28
- package/dist/types/call-diagnostic/call-diagnostic-metrics.d.ts +14 -1
- package/dist/types/call-diagnostic/config.d.ts +2 -0
- package/dist/types/generic-metrics.d.ts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/metrics.types.d.ts +17 -1
- package/dist/types/new-metrics.d.ts +15 -3
- package/package.json +12 -12
- package/src/business-metrics.ts +66 -76
- package/src/call-diagnostic/call-diagnostic-metrics-latencies.ts +36 -14
- package/src/call-diagnostic/call-diagnostic-metrics.ts +80 -3
- package/src/call-diagnostic/config.ts +8 -0
- package/src/generic-metrics.ts +2 -2
- package/src/index.ts +2 -0
- package/src/metrics.types.ts +21 -1
- package/src/new-metrics.ts +32 -4
- package/test/unit/spec/business/business-metrics.ts +2 -2
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics-latencies.ts +85 -0
- package/test/unit/spec/call-diagnostic/call-diagnostic-metrics.ts +674 -32
- package/test/unit/spec/new-metrics.ts +23 -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
|
@@ -59,6 +59,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
59
59
|
webex.internal.newMetrics.callDiagnosticLatencies.saveTimestamp = sinon.stub();
|
|
60
60
|
webex.internal.newMetrics.callDiagnosticLatencies.clearTimestamps = sinon.stub();
|
|
61
61
|
webex.internal.newMetrics.callDiagnosticMetrics.submitClientEvent = sinon.stub();
|
|
62
|
+
webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents = sinon.stub();
|
|
62
63
|
webex.internal.newMetrics.callDiagnosticMetrics.submitMQE = sinon.stub();
|
|
63
64
|
webex.internal.newMetrics.callDiagnosticMetrics.clientMetricsAliasUser = sinon.stub();
|
|
64
65
|
webex.internal.newMetrics.callDiagnosticMetrics.buildClientEventFetchRequestOptions =
|
|
@@ -93,12 +94,14 @@ describe('internal-plugin-metrics', () => {
|
|
|
93
94
|
name: 'foobar',
|
|
94
95
|
payload: {},
|
|
95
96
|
table: 'test',
|
|
97
|
+
metadata: { foo: 'bar' },
|
|
96
98
|
});
|
|
97
99
|
|
|
98
100
|
assert.calledWith(webex.internal.newMetrics.businessMetrics.submitBusinessEvent, {
|
|
99
101
|
name: 'foobar',
|
|
100
102
|
payload: {},
|
|
101
103
|
table: 'test',
|
|
104
|
+
metadata: { foo: 'bar' },
|
|
102
105
|
});
|
|
103
106
|
});
|
|
104
107
|
|
|
@@ -118,6 +121,7 @@ describe('internal-plugin-metrics', () => {
|
|
|
118
121
|
name: 'client.alert.displayed',
|
|
119
122
|
payload: undefined,
|
|
120
123
|
options: {meetingId: '123'},
|
|
124
|
+
delaySubmitEvent: false,
|
|
121
125
|
});
|
|
122
126
|
});
|
|
123
127
|
|
|
@@ -256,5 +260,24 @@ describe('internal-plugin-metrics', () => {
|
|
|
256
260
|
sinon.restore();
|
|
257
261
|
});
|
|
258
262
|
});
|
|
263
|
+
|
|
264
|
+
describe('#setDelaySubmitClientEvents', () => {
|
|
265
|
+
it('sets delaySubmitClientEvents correctly and calls submitDelayedClientEvents when set to false', () => {
|
|
266
|
+
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, false);
|
|
267
|
+
|
|
268
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents(true);
|
|
269
|
+
|
|
270
|
+
assert.notCalled(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
271
|
+
|
|
272
|
+
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, true);
|
|
273
|
+
|
|
274
|
+
webex.internal.newMetrics.setDelaySubmitClientEvents(false);
|
|
275
|
+
|
|
276
|
+
assert.calledOnce(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
277
|
+
assert.calledWith(webex.internal.newMetrics.callDiagnosticMetrics.submitDelayedClientEvents);
|
|
278
|
+
|
|
279
|
+
sinon.assert.match(webex.internal.newMetrics.delaySubmitClientEvents, false);
|
|
280
|
+
});
|
|
281
|
+
});
|
|
259
282
|
});
|
|
260
283
|
});
|
|
@@ -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,kBAA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oB"}
|
|
@@ -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 -> ";
|