Skip to content

Commit 37d1614

Browse files
Merge branch 'next' into SER-1548
2 parents 3a122a0 + 02bcaae commit 37d1614

File tree

7 files changed

+72
-20
lines changed

7 files changed

+72
-20
lines changed

frontend/express/public/javascripts/countly/countly.helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,7 @@
12501250
}
12511251
else {
12521252
//include export date
1253-
name += +"_on_" + moment().format("DD-MMM-YYYY");
1253+
name += "_on_" + moment().format("DD-MMM-YYYY");
12541254
}
12551255
return (name.charAt(0).toUpperCase() + name.slice(1).toLowerCase());
12561256
}

plugins/server-stats/api/parts/stats.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function updateDataPoints(writeBatcher, appId, sessionCount, eventCount, consoli
5151
incObject[key] = eventCount[key];
5252
incObject[`d.${utcMoment.format("D")}.${utcMoment.format("H")}.${key}`] = eventCount[key];
5353
// sum += eventCount[key] || 0;
54-
if (key === "e" || key === "s" || key === "p") { //because other are breakdowns from events.
54+
if (key === "e" || key === "s") { //because other are breakdowns from events.
5555
sum += eventCount[key] || 0;
5656
}
5757
}
@@ -124,11 +124,13 @@ function increaseDataPoints(object, data) {
124124
object.ratings += (data.str || 0);
125125
object.apm += (data.apm || 0);
126126
object.custom += (data.ce || 0);
127+
object.cs = (data.cs || 0);
128+
object.ps = (data.ps || 0);
127129
if (data.dp) {
128130
object.dp += data.dp;
129131
}
130132
else {
131-
object.dp += ((data.e || 0) + (data.s || 0) + (data.p || 0));
133+
object.dp += ((data.e || 0) + (data.s || 0));
132134
}
133135

134136
return object;
@@ -166,7 +168,7 @@ function punchCard(db, filter, options) {
166168
var data = [];
167169
for (let p = 0; p < ROW; p++) {
168170
for (let m = 0; m < TIME_RANGE; m++) {
169-
data.push({"value": {}, "min": null, "max": 0, "sum": 0, "avg": 0, "cn": {}, "p": 0, "s": 0, "e": 0});
171+
data.push({"value": {}, "min": null, "max": 0, "sum": 0, "avg": 0, "cn": {}, "s": 0, "e": 0});
170172
}
171173
}
172174

plugins/server-stats/frontend/public/javascripts/countly.models.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@
118118
"surveys": periodData.surveys,
119119
"ratings": periodData.ratings,
120120
"apm": periodData.apm,
121+
"push": periodData.push,
122+
"ps": periodData.ps,
123+
"cs": periodData.cs,
121124
"custom": periodData.custom,
122125
};
123126
let sortable = [];
@@ -133,7 +136,6 @@
133136
"appName": getAppName(app),
134137
"appId": appId,
135138
"sessions": periodData.sessions,
136-
"push": periodData.push,
137139
"data-points": periodData.dp,
138140
"change": periodData.change,
139141
"approximated": approx,
@@ -146,6 +148,9 @@
146148
"surveys": periodData.surveys,
147149
"ratings": periodData.ratings,
148150
"apm": periodData.apm,
151+
"push": periodData.push,
152+
"ps": periodData.ps,
153+
"cs": periodData.cs,
149154
"custom": periodData.custom,
150155
},
151156
"sorted_breakdown": sortable,

plugins/server-stats/frontend/public/javascripts/countly.views.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ var DataPointsView = countlyVue.views.create({
5353
"ratings": CV.i18n('server-stats.ratings'),
5454
"apm": CV.i18n('server-stats.apm'),
5555
"custom": CV.i18n('server-stats.custom'),
56+
"cs": CV.i18n('server-stats.cs'),
57+
"ps": CV.i18n('server-stats.ps'),
58+
"push": CV.i18n('server-stats.push')
5659
};
5760
return eventsBreakdownEnum[key];
5861
},
@@ -307,7 +310,9 @@ var DataPointsView = countlyVue.views.create({
307310
item[CV.i18n('server-stats.events') + ": " + CV.i18n('server-stats.ratings')] = dataPoints[k].events_breakdown.ratings;
308311
item[CV.i18n('server-stats.events') + ": " + CV.i18n('server-stats.apm')] = dataPoints[k].events_breakdown.apm;
309312
item[CV.i18n('server-stats.events') + ": " + CV.i18n('server-stats.custom')] = dataPoints[k].events_breakdown.custom;
310-
item[CV.i18n('server-stats.push')] = dataPoints[k].push;
313+
item[CV.i18n('server-stats.push')] = dataPoints[k].events_breakdown.push;
314+
item[CV.i18n('server-stats.ps')] = dataPoints[k].events_breakdown.ps;
315+
item[CV.i18n('server-stats.cs')] = dataPoints[k].events_breakdown.cs;
311316
item[CV.i18n('server-stats.data-points')] = dataPoints[k]['data-points'];
312317
item[CV.i18n('server-stats.datapoint-change')] = dataPoints[k].change;
313318
table.push(item);

plugins/server-stats/frontend/public/localization/server-stats.properties

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,23 @@ server-stats.data-points.punch-card-tooltip = Max: {0}, Min: {1}, Avg: {2}
88
server-stats.data-points.punch-card-title = DATA POINTS (HOURS) →
99
server-stats.data-points-last_hours = Top applications by data points in the last 2 hours
1010
server-stats.all-datapoints = All Datapoints
11-
server-stats.total-datapoints = Total Datapoints
11+
server-stats.total-datapoints = Total Data Points
1212
server-stats.consolidated-datapoints = Consolidated Datapoints
1313
server-stats.natural-datapoints = Natural Datapoints
14-
server-stats.datapoint-change = Change
14+
server-stats.datapoint-change = Change in Data Points
1515
server-stats.event-breakdown = Event Breakdown
1616
# Text required for data table, independant from other plugins
1717
server-stats.app-name = App Name
1818
server-stats.sessions = Sessions
19-
server-stats.events = Events
19+
server-stats.events = Non-Session Data Points
2020
server-stats.crashes = Crashes
2121
server-stats.views = Views
22-
server-stats.actions = Actions
22+
server-stats.actions = Heatmaps Actions
2323
server-stats.nps = NPS
2424
server-stats.surveys = Surveys
2525
server-stats.ratings = Ratings
2626
server-stats.apm = APM Traces
2727
server-stats.custom = Custom Events
28-
server-stats.push = Push Notifications
28+
server-stats.cs = Consent event
29+
server-stats.ps = Push Sent event
30+
server-stats.push = Push Action event

plugins/server-stats/frontend/public/templates/data-points.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ <h4 data-test-id="top-applications-by-data-points-in-the-last-two-hours-label">{
3939
<span class="cly-vue-tooltip-icon ion ion-help-circled bu-pl-1" v-tooltip.top-center="i18n('server-stats.sessions-description')"></span>
4040
</template>
4141
</el-table-column>
42-
<el-table-column min-width="150" :formatter="numberFormatter" sortable="custom" prop="events" :label="i18n('sidebar.events')">
42+
<el-table-column min-width="150" :formatter="numberFormatter" sortable="custom" prop="events" :label="i18n('server-stats.events')">
4343
<template v-slot:header>
44-
{{i18n('sidebar.events')}}
44+
{{i18n('server-stats.events')}}
4545
<span class="cly-vue-tooltip-icon ion ion-help-circled bu-pl-1" v-tooltip.top-center="i18n('server-stats.events-description')"></span>
4646
</template>
4747
<div slot-scope="scopeRow">
@@ -69,8 +69,7 @@ <h4 data-test-id="top-applications-by-data-points-in-the-last-two-hours-label">{
6969
</el-popover>
7070
</div>
7171
</el-table-column>
72-
<el-table-column min-width="150" v-if="showPushColumn" :formatter="numberFormatter" sortable="custom" prop="push" :label="i18n('push-notification.title')"></el-table-column>
73-
<el-table-column min-width="150" :formatter="numberFormatter" sortable="custom" prop="data-points" :label="i18n('server-stats.data-points')"></el-table-column>
72+
<el-table-column min-width="150" :formatter="numberFormatter" sortable="custom" prop="data-points" :label="i18n('server-stats.total-datapoints')"></el-table-column>
7473
<el-table-column min-width="150" :formatter="numberFormatter" sortable="custom" prop="change" :label="i18n('server-stats.datapoint-change')"></el-table-column>
7574
</cly-datatable-n>
7675
</cly-section>

plugins/server-stats/tests.js

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var testUtils = require("../../test/testUtils");
44
const pluginManager = require('../pluginManager.js');
55
var statInternalEvents = require('../server-stats/api/parts/stats.js').internalEventsEnum;
66
request = request.agent(testUtils.url);
7-
const dataPointTimeout = 1000;
7+
const dataPointTimeout = 1100;
88

99
var APP_KEY = '';
1010
var API_KEY_ADMIN = '';
@@ -27,7 +27,6 @@ const verifyDataPointsProperty = (obj) => {
2727
Object.values(obj).forEach(item => {
2828
item.should.have.property('events');
2929
item.should.have.property('sessions');
30-
item.should.have.property('push');
3130
item.should.have.property('dp');
3231
item.should.have.property('change');
3332
});
@@ -81,9 +80,8 @@ function verifyAddedEvents(addedEvents, initialRequest) {
8180

8281
lastEventCounts[internalEventKey] = lastEventCounts[internalEventKey] || 0;
8382
lastEventCounts[internalEventKey] += Math.min(event.count, 1);
84-
if (key !== '[CLY]_push_sent' && key !== '[CLY]_push_action') {
85-
lastEventCounts.e += Math.min(event.count, 1);
86-
}
83+
lastEventCounts.e += Math.min(event.count, 1);
84+
8785
});
8886
if (!addedEvents.filter(item => item.key === '[CLY]_session').length) { // then session included with begin_session=1 and count it also.
8987
lastEventCounts.s++;
@@ -271,6 +269,12 @@ describe('Testing data points plugin', function() {
271269
delete statInternalEvents["[CLY]_apm_device"];
272270
delete statInternalEvents["[CLY]_apm_network"];
273271
}
272+
if (plugins.indexOf("push") === -1) {
273+
delete statInternalEvents["[CLY]_push_sent"];
274+
delete statInternalEvents["[CLY]_push_action"];
275+
}
276+
277+
274278
console.log(JSON.stringify(statInternalEvents));
275279
for (const internalKey in statInternalEvents) {
276280
if (internalKey === "[CLY]_view") {
@@ -311,6 +315,13 @@ describe('Testing data points plugin', function() {
311315
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
312316
}
313317
});
318+
it('should verify session request included to data points', function(done) {
319+
verifyDPCount().then(() => {
320+
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
321+
}).catch(err => {
322+
done(err);
323+
});
324+
});
314325
it('should confirm that all system events are added to data points correctly', function(done) {
315326
verifyAddedEvents(internalEvents).then(() => {
316327
done();
@@ -343,13 +354,27 @@ describe('Testing data points plugin', function() {
343354
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
344355
}
345356
});
357+
it('verify total data points', function(done) {
358+
verifyDPCount().then(() => {
359+
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
360+
}).catch(err => {
361+
done(err);
362+
});
363+
});
346364
it('should confirm that multiple custom event are added to data points correctly', function(done) {
347365
verifyAddedEvents(customEvents.multi).then(() => {
348366
done();
349367
}).catch(err => {
350368
done(err);
351369
});
352370
});
371+
it('verify total data points', function(done) {
372+
verifyDPCount().then(() => {
373+
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
374+
}).catch(err => {
375+
done(err);
376+
});
377+
});
353378
it('should add random events correctly [1.0]', function(done) {
354379
generateRandomEvents('e1');
355380
const result = sendEventRequest(randomInternalEvents.e1);
@@ -367,6 +392,13 @@ describe('Testing data points plugin', function() {
367392
done(err);
368393
});
369394
});
395+
it('verify total data points', function(done) {
396+
verifyDPCount().then(() => {
397+
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
398+
}).catch(err => {
399+
done(err);
400+
});
401+
});
370402
it('should add random events correctly [2.0]', function(done) {
371403
generateRandomEvents('e2');
372404
const result = sendEventRequest(randomInternalEvents.e2);
@@ -384,6 +416,13 @@ describe('Testing data points plugin', function() {
384416
done(err);
385417
});
386418
});
419+
it('verify total data points', function(done) {
420+
verifyDPCount().then(() => {
421+
setTimeout(done, dataPointTimeout * testUtils.testScalingFactor);
422+
}).catch(err => {
423+
done(err);
424+
});
425+
});
387426
it('should add random events correctly [3.0]', function(done) {
388427
generateRandomEvents('e3');
389428
const result = sendEventRequest(randomInternalEvents.e3);

0 commit comments

Comments
 (0)