@webex/internal-plugin-metrics 3.0.0-beta.3 → 3.0.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/batcher.js +3 -22
- package/dist/batcher.js.map +1 -1
- package/dist/call-diagnostic-events-batcher.js +2 -12
- package/dist/call-diagnostic-events-batcher.js.map +1 -1
- package/dist/client-metrics-batcher.js +1 -7
- package/dist/client-metrics-batcher.js.map +1 -1
- package/dist/config.js +1 -4
- package/dist/config.js.map +1 -1
- package/dist/index.js +1 -9
- package/dist/index.js.map +1 -1
- package/dist/metrics.js +15 -52
- package/dist/metrics.js.map +1 -1
- package/package.json +8 -8
- package/src/batcher.js +33 -26
- package/src/call-diagnostic-events-batcher.js +5 -5
- package/src/client-metrics-batcher.js +3 -4
- package/src/config.js +6 -5
- package/src/index.js +1 -1
- package/src/metrics.js +24 -36
- package/test/unit/spec/batcher.js +26 -15
- package/test/unit/spec/call-diagnostic-events-batcher.js +39 -24
- package/test/unit/spec/client-metrics-batcher.js +26 -15
- package/test/unit/spec/metrics.js +22 -21
|
@@ -29,35 +29,35 @@ describe('plugin-metrics', () => {
|
|
|
29
29
|
const eventName = 'test_event';
|
|
30
30
|
const mockPayload = {
|
|
31
31
|
fields: {
|
|
32
|
-
testField: 123
|
|
32
|
+
testField: 123,
|
|
33
33
|
},
|
|
34
34
|
tags: {
|
|
35
|
-
testTag: 'tag value'
|
|
35
|
+
testTag: 'tag value',
|
|
36
36
|
},
|
|
37
37
|
metricName: eventName,
|
|
38
38
|
test: 'this field should not be included in final payload',
|
|
39
39
|
type: 'behavioral',
|
|
40
|
-
eventPayload: {value: 'splunk business metric payload'}
|
|
40
|
+
eventPayload: {value: 'splunk business metric payload'},
|
|
41
41
|
};
|
|
42
42
|
const transformedProps = {
|
|
43
43
|
fields: {
|
|
44
|
-
testField: 123
|
|
44
|
+
testField: 123,
|
|
45
45
|
},
|
|
46
46
|
tags: {
|
|
47
|
-
testTag: 'tag value'
|
|
47
|
+
testTag: 'tag value',
|
|
48
48
|
},
|
|
49
49
|
metricName: eventName,
|
|
50
50
|
type: 'behavioral',
|
|
51
|
-
timestamp: Date.now()
|
|
51
|
+
timestamp: Date.now(),
|
|
52
52
|
};
|
|
53
53
|
const preLoginId = '1b90cf5e-27a6-41aa-a208-1f6eb6b9e6b6';
|
|
54
54
|
const preLoginProps = {
|
|
55
|
-
metrics: [transformedProps]
|
|
55
|
+
metrics: [transformedProps],
|
|
56
56
|
};
|
|
57
57
|
const mockCallDiagnosticEvent = {
|
|
58
58
|
originTime: {
|
|
59
|
-
triggered: 'mock triggered timestamp'
|
|
60
|
-
}
|
|
59
|
+
triggered: 'mock triggered timestamp',
|
|
60
|
+
},
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
beforeEach(() => {
|
|
@@ -71,8 +71,8 @@ describe('plugin-metrics', () => {
|
|
|
71
71
|
beforeEach(() => {
|
|
72
72
|
webex = new MockWebex({
|
|
73
73
|
children: {
|
|
74
|
-
metrics: Metrics
|
|
75
|
-
}
|
|
74
|
+
metrics: Metrics,
|
|
75
|
+
},
|
|
76
76
|
});
|
|
77
77
|
|
|
78
78
|
webex.config.metrics = config.metrics;
|
|
@@ -82,7 +82,7 @@ describe('plugin-metrics', () => {
|
|
|
82
82
|
return Promise.resolve({
|
|
83
83
|
statusCode: 204,
|
|
84
84
|
body: undefined,
|
|
85
|
-
options
|
|
85
|
+
options,
|
|
86
86
|
});
|
|
87
87
|
};
|
|
88
88
|
|
|
@@ -94,8 +94,7 @@ describe('plugin-metrics', () => {
|
|
|
94
94
|
...webex.config,
|
|
95
95
|
appName: 'appName',
|
|
96
96
|
appPlatform: 'appPlatform',
|
|
97
|
-
appVersion: 'appVersion'
|
|
98
|
-
|
|
97
|
+
appVersion: 'appVersion',
|
|
99
98
|
};
|
|
100
99
|
webex.config.metrics.type = ['operational'];
|
|
101
100
|
webex.config.metrics.appType = 'sdk';
|
|
@@ -167,15 +166,18 @@ describe('plugin-metrics', () => {
|
|
|
167
166
|
});
|
|
168
167
|
describe('after login', () => {
|
|
169
168
|
it('submits a metric to clientmetrics', () => {
|
|
170
|
-
webex.credentials.supertoken = new Token(
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
webex.credentials.supertoken = new Token(
|
|
170
|
+
{
|
|
171
|
+
access_token: 'a_b_orgid',
|
|
172
|
+
},
|
|
173
|
+
{parent: webex}
|
|
174
|
+
);
|
|
173
175
|
|
|
174
176
|
const testPayload = {
|
|
175
177
|
tags: {success: true},
|
|
176
178
|
fields: {perceivedDurationInMillis: 314},
|
|
177
179
|
context: {},
|
|
178
|
-
eventPayload: {value: 'splunk business metric payload'}
|
|
180
|
+
eventPayload: {value: 'splunk business metric payload'},
|
|
179
181
|
};
|
|
180
182
|
const date = clock.now;
|
|
181
183
|
|
|
@@ -213,7 +215,6 @@ describe('plugin-metrics', () => {
|
|
|
213
215
|
assert.property(metric.context, 'locale');
|
|
214
216
|
assert.property(metric.context, 'os');
|
|
215
217
|
|
|
216
|
-
|
|
217
218
|
assert.equal(metric.timestamp, date);
|
|
218
219
|
assert.equal(metric.metricName, 'test');
|
|
219
220
|
assert.equal(metric.tags.success, true);
|
|
@@ -294,8 +295,8 @@ describe('plugin-metrics', () => {
|
|
|
294
295
|
const promise = metrics.submitCallDiagnosticEvents({
|
|
295
296
|
...mockCallDiagnosticEvent,
|
|
296
297
|
origin: {
|
|
297
|
-
buildType: 'prod'
|
|
298
|
-
}
|
|
298
|
+
buildType: 'prod',
|
|
299
|
+
},
|
|
299
300
|
});
|
|
300
301
|
|
|
301
302
|
return promiseTick(50)
|