diff --git a/api/parts/data/usage.js b/api/parts/data/usage.js index 92d4b64cfa1..da9c1adef52 100644 --- a/api/parts/data/usage.js +++ b/api/parts/data/usage.js @@ -868,19 +868,6 @@ function processMetrics(user, uniqueLevelsZero, uniqueLevelsMonth, params, done) } } - if (!isNewUser) { - /* - If metricChanges object contains a uid this means we have at least one metric that has changed - in this begin_session so we'll insert it into metric_changesAPPID collection. - Inserted document has below format; - - { "uid" : "1", "ts" : 1463778143, "d" : { "o" : "iPhone1", "n" : "iPhone2" }, "av" : { "o" : "1:0", "n" : "1:1" } } - */ - if (plugins.getConfig("api", params.app && params.app.plugins, true).metric_changes && metricChanges.uid && params.qstring.begin_session) { - common.db.collection('metric_changes' + params.app_id).insert(metricChanges, function() {}); - } - } - if (done) { done(); } diff --git a/api/parts/mgmt/app_users.js b/api/parts/mgmt/app_users.js index 2810005d181..26feea58c87 100644 --- a/api/parts/mgmt/app_users.js +++ b/api/parts/mgmt/app_users.js @@ -267,80 +267,78 @@ usersApi.delete = function(app_id, query, params, callback) { console.log("Error generating list of uids", err0, res); } if (res && res[0] && res[0].uid && res[0].uid.length) { - common.db.collection("metric_changes" + app_id).remove({uid: {$in: res[0].uid}}, function() { - plugins.dispatch("/i/app_users/delete", { - app_id: app_id, - query: query, - uids: res[0].uid, - params: params - }, function(_, otherPluginResults) { - const rejectReasons = otherPluginResults.reduce((acc, result) => { - if (result.status === "rejected") { - acc.push((result.reason && result.reason.message) || ''); - } + plugins.dispatch("/i/app_users/delete", { + app_id: app_id, + query: query, + uids: res[0].uid, + params: params + }, function(_, otherPluginResults) { + const rejectReasons = otherPluginResults.reduce((acc, result) => { + if (result.status === "rejected") { + acc.push((result.reason && result.reason.message) || ''); + } - return acc; - }, []); + return acc; + }, []); - if (rejectReasons.length > 0) { - log.e("User deletion failed\n%j", rejectReasons.join("\n")); - common.returnMessage(params, 500, { errorMessage: "User deletion failed. Failed to delete some data related to this user." }); - return; - } + if (rejectReasons.length > 0) { + log.e("User deletion failed\n%j", rejectReasons.join("\n")); + common.returnMessage(params, 500, { errorMessage: "User deletion failed. Failed to delete some data related to this user." }); + return; + } - //remove from drill_events - plugins.dispatch("/core/delete_granular_data", { - db: "countly_drill", - collection: "drill_events", - query: { a: app_id + "", uid: { $in: res[0].uid } } - }); + //remove from drill_events + plugins.dispatch("/core/delete_granular_data", { + db: "countly_drill", + collection: "drill_events", + query: { a: app_id + "", uid: { $in: res[0].uid } } + }); - common.db.collection("app_users" + app_id).remove({uid: {$in: res[0].uid}}, function(err) { - if (res[0].exported) { - //delete exports if exist - for (let i = 0;i < res[0].exported.length; i++) { - let id = res[0].exported[i].split("/"); - id = id[id.length - 1]; //last one is filename - id = id.substr(id.length - 7); - - deleteMyExport(id).then( - function() {}, - function(err5) { - console.log(err5); - } - ); - } - } - //deleting userimages(if they exist); - if (res[0].picture) { - for (let i = 0;i < res[0].picture.length; i++) { - //remove /userimages/ - let id = res[0].picture[i].substr(12, res[0].picture[i].length - 12); - var pp = path.resolve(__dirname, './../../../frontend/express/public/userimages/' + id); - countlyFs.deleteFile("userimages", pp, {id: id}, function(err6) { - if (err6) { - console.log(err6); - } - }); - } + common.db.collection("app_users" + app_id).remove({uid: {$in: res[0].uid}}, function(err) { + if (res[0].exported) { + //delete exports if exist + for (let i = 0;i < res[0].exported.length; i++) { + let id = res[0].exported[i].split("/"); + id = id[id.length - 1]; //last one is filename + id = id.substr(id.length - 7); + + deleteMyExport(id).then( + function() {}, + function(err5) { + console.log(err5); + } + ); } - try { - fs.appendFileSync(path.resolve(__dirname, './../../../log/deletedUsers' + app_id + '.txt'), res[0].uid.join("\n") + "\n", "utf-8"); + } + //deleting userimages(if they exist); + if (res[0].picture) { + for (let i = 0;i < res[0].picture.length; i++) { + //remove /userimages/ + let id = res[0].picture[i].substr(12, res[0].picture[i].length - 12); + var pp = path.resolve(__dirname, './../../../frontend/express/public/userimages/' + id); + countlyFs.deleteFile("userimages", pp, {id: id}, function(err6) { + if (err6) { + console.log(err6); + } + }); } - catch (err2) { - console.log(err2); + } + try { + fs.appendFileSync(path.resolve(__dirname, './../../../log/deletedUsers' + app_id + '.txt'), res[0].uid.join("\n") + "\n", "utf-8"); + } + catch (err2) { + console.log(err2); + } + plugins.dispatch("/systemlogs", { + params: params, + action: "app_user_deleted", + data: { + app_id: app_id, + query: JSON.stringify(query), + uids: res[0].uid, } - plugins.dispatch("/systemlogs", { - params: params, - action: "app_user_deleted", - data: { - app_id: app_id, - query: JSON.stringify(query), - uids: res[0].uid, - } - }); - callback(err, res[0].uid); }); + callback(err, res[0].uid); }); }); } @@ -758,7 +756,6 @@ usersApi.merge = async function(app_id, newAppUser, new_id, old_id, new_device_i var iid = app_id + "_" + newAppUser.uid + "_" + oldAppUser.uid; try { await common.db.collection('app_user_merges').updateOne({"_id": iid, "cc": {"$ne": true}}, {'$set': {"u": true}}, {upsert: false}); - await common.db.collection("metric_changes" + app_id).updateMany({uid: oldAppUser.uid}, {'$set': {uid: newAppUserP.uid}}); } catch (e) { log.e("Failed metric changes update in app_users merge", e); @@ -1144,21 +1141,8 @@ usersApi.export = function(app_id, query, params, callback) { // } //try deleting old export - deleteMyExport(export_id).then(function(err) { - if (err) { - log.e(err); - } + deleteMyExport(export_id).then(function() { log.d("old export deleted"); - return new Promise(function(resolve) { - log.d("collection marked"); - //export data from metric_changes - - export_safely({projection: {"appUserExport": 0}, export_id: export_id, app_id: app_id, args: [...dbargs, "--collection", "metric_changes" + app_id, "-q", '{"uid":{"$in": ["' + res[0].uid.join('","') + '"]}}', "--out", export_folder + "/metric_changes" + app_id + ".json"]}).finally(function() { - resolve(); - }); - }); - }).then(function() { - log.d("metric_changes exported"); //export data from app_users return export_safely({projection: {"appUserExport": 0}, export_id: export_id, app_id: app_id, args: [...dbargs, "--collection", "app_users" + app_id, "-q", '{"uid":{"$in": ["' + res[0].uid.join('","') + '"]}}', "--out", export_folder + "/app_users" + app_id + ".json"]}); diff --git a/api/parts/mgmt/apps.js b/api/parts/mgmt/apps.js index b0c380211a6..13157d9c76d 100644 --- a/api/parts/mgmt/apps.js +++ b/api/parts/mgmt/apps.js @@ -289,8 +289,6 @@ appsApi.createApp = async function(params) { common.db.collection('app_users' + app.ops[0]._id).ensureIndex({"lac": -1}, { background: true }, function() {}); common.db.collection('app_users' + app.ops[0]._id).ensureIndex({"tsd": 1}, { background: true }, function() {}); common.db.collection('app_users' + app.ops[0]._id).ensureIndex({"did": 1}, { background: true }, function() {}); - common.db.collection('metric_changes' + app.ops[0]._id).ensureIndex({ts: 1, "cc.o": 1}, { background: true }, function() {}); - common.db.collection('metric_changes' + app.ops[0]._id).ensureIndex({uid: 1}, { background: true }, function() {}); plugins.dispatch("/i/apps/create", { params: params, appId: app.ops[0]._id, @@ -857,10 +855,6 @@ function deleteAllAppData(appId, fromAppDelete, params, app) { } common.db.collection('app_users' + appId).drop(function() { if (!fromAppDelete) { - common.db.collection('metric_changes' + appId).drop(function() { - common.db.collection('metric_changes' + appId).ensureIndex({ts: 1, "cc.o": 1}, { background: true }, function() {}); - common.db.collection('metric_changes' + appId).ensureIndex({uid: 1}, { background: true }, function() {}); - }); //Removes old app_user_merges collection common.db.collection('app_user_merges' + appId).drop(function() {}); if (params.qstring.args.period === "reset") { @@ -879,7 +873,6 @@ function deleteAllAppData(appId, fromAppDelete, params, app) { } } else { - common.db.collection('metric_changes' + appId).drop(function() {}); common.db.collection('app_user_merges' + appId).drop(function() {}); plugins.dispatch("/i/apps/delete", { params: params, @@ -986,12 +979,6 @@ function deletePeriodAppData(appId, fromAppDelete, params, app) { */ common.db.collection('app_users' + appId).update({ls: {$lte: oldestTimestampWanted}}, {$set: {ls: 1}}, function() {}); - /* - Remove all metric changes that happened before oldestTimestampWanted since we no longer need - old metric changes - */ - common.db.collection('metric_changes' + appId).remove({ts: {$lte: oldestTimestampWanted}}, function() {}); - plugins.dispatch("/i/apps/clear", { params: params, appId: appId, diff --git a/bin/scripts/add_indexes.js b/bin/scripts/add_indexes.js index f257f0ef0ee..fda800a708b 100644 --- a/bin/scripts/add_indexes.js +++ b/bin/scripts/add_indexes.js @@ -28,9 +28,7 @@ pluginManager.dbConnection().then((countlyDb) => { () => countlyDb.collection('app_users' + app._id).ensureIndex({"lac": -1}, { background: true }, cb), () => countlyDb.collection('app_users' + app._id).ensureIndex({"tsd": 1}, { background: true }, cb), () => countlyDb.collection('app_users' + app._id).ensureIndex({"did": 1}, { background: true }, cb), - () => countlyDb.collection('app_users' + app._id).dropIndex("lac_1_ls_1", cb), - () => countlyDb.collection('metric_changes' + app._id).ensureIndex({ts: 1, "cc.o": 1}, { background: true }, cb), - () => countlyDb.collection('metric_changes' + app._id).ensureIndex({uid: 1}, { background: true }, cb) + () => countlyDb.collection('app_users' + app._id).dropIndex("lac_1_ls_1", cb) ]; totalParallelJobs = parallelJobs.length; diff --git a/bin/scripts/data-cleanup/remove_old_data.js b/bin/scripts/data-cleanup/remove_old_data.js index 032b753ca45..903941421fc 100644 --- a/bin/scripts/data-cleanup/remove_old_data.js +++ b/bin/scripts/data-cleanup/remove_old_data.js @@ -52,9 +52,6 @@ pluginManager.dbConnection().then(async(db) => { var count = await db.collection(`consent_history${app._id}`).countDocuments({ ts: { $lt: lastUnixTimestamp } }); console.log("", count, "consents to be deleted"); checkThreshold(count); - count = await db.collection(`metric_changes${app._id}`).countDocuments({ ts: { $lt: lastUnixTimestamp } }); - console.log("", count, "metric changes to be deleted"); - checkThreshold(count); count = await db.collection(`eventTimes${app._id}`).countDocuments({ ts: { $lt: lastUnixTimestamp * 1000 } }); console.log("", count, "event times to be deleted"); checkThreshold(count); @@ -64,9 +61,6 @@ pluginManager.dbConnection().then(async(db) => { var res = await db.collection(`consent_history${app._id}`).deleteMany({ ts: { $lt: lastUnixTimestamp } }); console.log("", res, "consents deleted"); await sleep(SLEEP); - res = await db.collection(`metric_changes${app._id}`).deleteMany({ ts: { $lt: lastUnixTimestamp } }); - console.log("", res, "metric changes deleted"); - await sleep(SLEEP); res = await db.collection(`eventTimes${app._id}`).deleteMany({ ts: { $lt: lastUnixTimestamp * 1000 } }); console.log("", res, "event times deleted"); await sleep(SLEEP); diff --git a/bin/scripts/expire-data/countly_single_app_expireDataBatches.js b/bin/scripts/expire-data/countly_single_app_expireDataBatches.js index 3d32be5ffbb..07731fe0970 100644 --- a/bin/scripts/expire-data/countly_single_app_expireDataBatches.js +++ b/bin/scripts/expire-data/countly_single_app_expireDataBatches.js @@ -48,7 +48,6 @@ var errorCn = 0; var process = { drill_events: true, /*app_crashes:true, - metric_changes:true, consent_history:true, feedback:true, symbolication_jobs:true, diff --git a/bin/scripts/expire-data/mongo_expireData.js b/bin/scripts/expire-data/mongo_expireData.js index b151aece0a4..7d9e3116678 100644 --- a/bin/scripts/expire-data/mongo_expireData.js +++ b/bin/scripts/expire-data/mongo_expireData.js @@ -13,7 +13,6 @@ var COUNTLY_DRILL = 'countly_drill', var PROCESS = [ /^drill_events\.*/, /^app_crashes\.*/, - /^metric_changes\.*/, /^consent_history\.*/, /^feedback[^_]*/, /^symbolication_jobs/, diff --git a/bin/scripts/expire-data/old_scripts/countly_single_app_expireDataBatches.js b/bin/scripts/expire-data/old_scripts/countly_single_app_expireDataBatches.js index 7c5305340f5..660a2820136 100644 --- a/bin/scripts/expire-data/old_scripts/countly_single_app_expireDataBatches.js +++ b/bin/scripts/expire-data/old_scripts/countly_single_app_expireDataBatches.js @@ -49,7 +49,6 @@ var errorCn = 0; var process = { drill_events: true, /*app_crashes:true, - metric_changes:true, consent_history:true, feedback:true, symbolication_jobs:true, diff --git a/bin/scripts/fix-data/process_merges.js b/bin/scripts/fix-data/process_merges.js index 0200b9e54e4..28992bd700c 100644 --- a/bin/scripts/fix-data/process_merges.js +++ b/bin/scripts/fix-data/process_merges.js @@ -115,12 +115,6 @@ function mergeUserData(db, user, resolve) { db.collection('app_users' + app_id).update({_id: newAppUser._id}, {'$set': newAppUser}, function(err6) { //Dispatch to other plugins only after callback. if (!err6) { - //update metric changes document - db.collection("metric_changes" + app_id).update({uid: oldAppUser.uid}, {'$set': {uid: newAppUser.uid}}, {multi: true}, function(err7) { - if (err7) { - console.log("Failed metric changes update in app_users merge", err7); - } - }); //delete old app users document db.collection('app_users' + app_id).remove({_id: oldAppUser._id}, function(errRemoving) { if (errRemoving) { @@ -145,14 +139,7 @@ function mergeUserData(db, user, resolve) { if (err0) { console.log(err0); } - db.collection("metric_changes" + app_id).update({uid: olduid}, {'$set': {uid: usersApi.merged_to}}, {multi: true}, function(err7) { - if (err7) { - console.log("Failed metric changes update in app_users merge", err7); - } - else { - usersApi.mergeOtherPlugins({db: db, app_id: app_id, newAppUser: {uid: user.merged_to}, oldAppUser: {uid: olduid}, updateFields: {"cc": true, "mc": true}, mergeDoc: user}, resolve); - } - }); + usersApi.mergeOtherPlugins({db: db, app_id: app_id, newAppUser: {uid: user.merged_to}, oldAppUser: {uid: olduid}, updateFields: {"cc": true, "mc": true}, mergeDoc: user}, resolve); }); } else { diff --git a/jobServer/index.js b/jobServer/index.js index 0b72570c250..5f5291016c8 100644 --- a/jobServer/index.js +++ b/jobServer/index.js @@ -208,7 +208,6 @@ if (require.main === module) { // total_users: true, // export_limit: 10000, prevent_duplicate_requests: true, - // metric_changes: true, offline_mode: false, // reports_regenerate_interval: 3600, // send_test_email: "", diff --git a/plugins/compliance-hub/api/api.js b/plugins/compliance-hub/api/api.js index 895e0f44ef1..029482de4c8 100644 --- a/plugins/compliance-hub/api/api.js +++ b/plugins/compliance-hub/api/api.js @@ -335,22 +335,6 @@ const FEATURE_NAME = 'compliance_hub'; } }); - plugins.register("/i/device_id", function(ob) { - var oldUid = ob.oldUser.uid; - var newUid = ob.newUser.uid; - if (oldUid !== newUid) { - return new Promise(function(resolve, reject) { - common.db.collection('consent_history').update({uid: oldUid}, {'$set': {uid: newUid}}, {multi: true}, function(err) { - if (err) { - reject(err); - return; - } - resolve(); - }); - }); - } - }); - plugins.register("/i/app_users/delete", function(ob) { var params = ob.params; common.recordCustomMetric(params, "consents", params.qstring.app_id, ["p"]); @@ -366,36 +350,26 @@ const FEATURE_NAME = 'compliance_hub'; plugins.register("/i/apps/delete", function(ob) { var appId = ob.appId; common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {}); - common.db.collection('consent_history').drop(function() {}); - /*if (common.drillDb) { - common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {}); - }*/ + common.drillDb.collection("drill_events").deleteMany({"a": (appId + ""), "e": "[CLY]_consent"}, function() {}); }); plugins.register("/i/apps/reset", function(ob) { var appId = ob.appId; common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {}); - common.db.collection('consent_history').drop(function() {}); - /*if (common.drillDb) { - common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {}); - }*/ + common.drillDb.collection("drill_events").deleteMany({"a": (appId + ""), "e": "[CLY]_consent"}, function() {}); }); plugins.register("/i/apps/clear_all", function(ob) { var appId = ob.appId; common.db.collection('consents').remove({'_id': {$regex: appId + ".*"}}, function() {}); - /*if (common.drillDb) { - common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).drop(function() {}); - }*/ + common.drillDb.collection("drill_events").deleteMany({"a": (appId + ""), "e": "[CLY]_consent"}, function() {}); }); plugins.register("/i/apps/clear", function(ob) { var appId = ob.appId; var ids = ob.ids; common.db.collection('consents').remove({$and: [{'_id': {$regex: appId + ".*"}}, {'_id': {$nin: ids}}]}, function() {}); - /*if (common.drillDb) { - common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_consent" + appId).digest('hex')).remove({ts: {$lt: ob.moment.valueOf()}}, function() {}); - }*/ + common.drillDb.collection("drill_events").deleteMany({"a": (appId + ""), "e": "[CLY]_consent", ts: {$lt: ob.moment.valueOf()}}, function() {}); }); }(plugin)); diff --git a/plugins/compliance-hub/tests.js b/plugins/compliance-hub/tests.js index dc448bdcbad..29a507bc058 100644 --- a/plugins/compliance-hub/tests.js +++ b/plugins/compliance-hub/tests.js @@ -523,7 +523,7 @@ describe('Testing Compliance Hub', function() { if (ob.aaData && ob.aaData.length > 0) { ob.aaData.forEach(function(item) { item.should.have.property('device_id'); - item.should.have.property('app_id'); + item.should.have.property('a'); item.should.have.property('ts'); item.should.have.property('type'); item.should.have.property('change'); diff --git a/plugins/crashes/api/api.js b/plugins/crashes/api/api.js index 4b7e1201b6a..a9d354bb661 100644 --- a/plugins/crashes/api/api.js +++ b/plugins/crashes/api/api.js @@ -47,8 +47,6 @@ const FEATURE_NAME = 'crashes'; } }); }); - var ranges = ["ram", "bat", "disk", "run", "session"]; - var segments = ["os_version", "os_name", "manufacture", "device", "resolution", "app_version", "cpu", "opengl", "orientation", "view", "browser"]; var bools = {"root": true, "online": true, "muted": true, "signal": true, "background": true}; plugins.internalDrillEvents.push("[CLY]_crash"); @@ -58,64 +56,57 @@ const FEATURE_NAME = 'crashes'; var newUid = ob.newUser.uid; if (oldUid !== newUid) { return new Promise(function(resolve, reject) { - common.db.collection("app_crashes" + appId).update({uid: oldUid}, {'$set': {uid: newUid}}, {multi: true}, function(errUpdate) { - if (errUpdate) { - log.e(errUpdate); + common.db.collection("app_crashusers" + appId).find({uid: oldUid}).toArray(function(err, res) { + if (err) { + log.e(err); reject(); return; } - common.db.collection("app_crashusers" + appId).find({uid: oldUid}).toArray(function(err, res) { - if (err) { - log.e(err); - reject(); - return; - } - if (res && res.length) { - try { - const bulk = common.db.collection("app_crashusers" + appId).initializeUnorderedBulkOp(); - for (let i = 0; i < res.length; i++) { - const updates = {}; - for (const key of ['last', 'sessions']) { - if (res[i][key]) { - if (!updates.$max) { - updates.$max = {}; - } - updates.$max[key] = res[i][key]; + if (res && res.length) { + try { + const bulk = common.db.collection("app_crashusers" + appId).initializeUnorderedBulkOp(); + for (let i = 0; i < res.length; i++) { + const updates = {}; + for (const key of ['last', 'sessions']) { + if (res[i][key]) { + if (!updates.$max) { + updates.$max = {}; } + updates.$max[key] = res[i][key]; } - for (const key of ['reports', 'crashes', 'fatal']) { - if (res[i][key]) { - if (!updates.$inc) { - updates.$inc = {}; - } - updates.$inc[key] = res[i][key]; + } + for (const key of ['reports', 'crashes', 'fatal']) { + if (res[i][key]) { + if (!updates.$inc) { + updates.$inc = {}; } + updates.$inc[key] = res[i][key]; } - const group = res[i].group; - if (Object.keys(updates).length) { - bulk.find({uid: newUid, group: group}).upsert().updateOne(updates); - } - bulk.find({uid: oldUid, group: group}).delete(); } - bulk.execute(function(bulkerr) { - if (bulkerr) { - console.log(bulkerr); - reject(); - } - else { - resolve(); - } - }); - } - catch (exc) { - log.e(exc); - reject("Failed to merge crashes"); + const group = res[i].group; + if (Object.keys(updates).length) { + bulk.find({uid: newUid, group: group}).upsert().updateOne(updates); + } + bulk.find({uid: oldUid, group: group}).delete(); } + bulk.execute(function(bulkerr) { + if (bulkerr) { + console.log(bulkerr); + reject(); + } + else { + resolve(); + } + }); } - else { - resolve(); + catch (exc) { + log.e(exc); + reject("Failed to merge crashes"); } - }); + } + else { + resolve(); + } }); }); } @@ -127,7 +118,6 @@ const FEATURE_NAME = 'crashes'; if (uids && uids.length) { // By using await and no callback, error in db operation will be thrown // This error will then be caught by app users api dispatch so that it can cancel app user deletion - await common.db.collection("app_crashes" + appId).remove({uid: {$in: uids}}); await common.db.collection("app_crashusers" + appId).remove({uid: {$in: uids}}); } }); @@ -139,696 +129,11 @@ const FEATURE_NAME = 'crashes'; if (!ob.export_commands.crashes) { ob.export_commands.crashes = []; } - ob.export_commands.crashes.push({cmd: 'mongoexport', args: [...ob.dbargs, '--collection', 'app_crashes' + ob.app_id, '-q', '{"uid":{"$in": ["' + uids.join('","') + '"]}}', '--out', ob.export_folder + '/crashes' + ob.app_id + '.json']}); ob.export_commands.crashes.push({cmd: 'mongoexport', args: [...ob.dbargs, '--collection', 'app_crashusers' + ob.app_id, '-q', '{"uid":{"$in": ["' + uids.join('","') + '"]}}', '--out', ob.export_folder + '/crashusers' + ob.app_id + '.json']}); resolve(); } }); }); - //check app metric - plugins.register("/sdk/user_properties", function(ob) { - var params = ob.params; - if (!params.qstring.crash && params.qstring.metrics && params.qstring.metrics._app_version) { - const checkCrash = function(latest_version, hash, uid, done) { - common.db.collection('app_crashgroups' + params.app_id).findOne({'groups': hash }, function(err, crash) { - if (crash && crash.is_resolved && crash.resolved_version) { - if (common.versionCompare(latest_version, crash.resolved_version.replace(/\./g, ":")) > 0) { - //record resolved user timeline - //common.recordCustomMetric(params, "crashdata", params.app_id, ["crru"]); - - //update crash stats - common.db.collection('app_crashusers' + params.app_id).remove({"group": hash, uid: uid}, function() {}); - common.db.collection('app_crashgroups' + params.app_id).update({'_id': crash._id, users: {$gt: 0} }, {$inc: {users: -1}}, function() {}); - - //update global app stats - var mod = {crashes: -1}; - if (!crash.nonfatal) { - mod.fatal = -1; - } - common.db.collection('app_crashusers' + params.app_id).findAndModify({"group": 0, uid: uid}, {}, {$inc: mod}, {upsert: true, new: true}, function(crashUserErr, res) { - res = res && res.ok ? res.value : null; - if (res && res.crashes <= 0) { - common.db.collection('app_crashusers' + params.app_id).remove({"group": 0, uid: uid}, function() {}); - } - done(null, true); - }); - } - else { - done(); - } - } - else { - done(); - } - }); - }; - var dbAppUser = params.app_user; - var latest_version = params.qstring.metrics._app_version.replace(/\./g, ":"); - if ((typeof dbAppUser.hadFatalCrash !== "undefined" || typeof dbAppUser.hadNonfatalCrash !== "undefined") && typeof dbAppUser.av !== "undefined" && common.versionCompare(latest_version, dbAppUser.av) > 0) { - common.db.collection('app_crashusers' + params.app_id).find({uid: dbAppUser.uid}, {group: 1, _id: 0}).toArray(function(err, res) { - if (res && res.length) { - var crashes = []; - for (let i = 0; i < res.length; i++) { - if (res[i].group !== 0) { - crashes.push(res[i].group); - } - } - if (crashes.length) { - async.map(crashes, function(crash, done) { - checkCrash(latest_version, crash, dbAppUser.uid, done); - }, function(mapErr, mapRes) { - var shouldRecalculate = false; - if (mapRes && mapRes.length) { - for (let i = 0; i < mapRes.length; i++) { - if (mapRes[i]) { - shouldRecalculate = true; - break; - } - } - } - if (shouldRecalculate) { - common.db.collection('app_crashusers' + params.app_id).count({"group": 0, crashes: { $gt: 0 }}, function(crashErr, userCount) { - common.db.collection('app_crashusers' + params.app_id).count({"group": 0, crashes: { $gt: 0 }, fatal: { $gt: 0 }}, function(crashUsersErr, fatalCount) { - var set = {}; - set.users = userCount; - set.usersfatal = fatalCount; - common.db.collection('app_crashgroups' + params.app_id).update({'_id': "meta" }, {$set: set}, function() {}); - }); - }); - } - }); - } - } - }); - } - } - }); - - //process session being - plugins.register("/session/begin", function(ob) { - var params = ob.params; - var dbAppUser = params.app_user || {}; - var metrics = ["cr_s", "cr_u"]; - var platform = dbAppUser.p; - var version = dbAppUser.av; - if (params.qstring.metrics && params.qstring.metrics._os) { - platform = params.qstring.metrics._os; - } - if (params.qstring.metrics && params.qstring.metrics._app_version) { - version = params.qstring.metrics._app_version + ""; - if (version.indexOf('.') === -1) { - version += ".0"; - } - version = (version + "").replace(/^\$/, "").replace(/\./g, ":"); - } - common.recordCustomMetric(params, "crashdata", params.app_id, metrics, 1, null, ["cr_u"], dbAppUser.ls); - if (platform && version) { - common.recordCustomMetric(params, "crashdata", platform + "**" + version + "**" + params.app_id, metrics, 1, null, ["cr_u"], (version === dbAppUser.av && platform === dbAppUser.p) ? dbAppUser.ls : 0); - } - if (platform) { - common.recordCustomMetric(params, "crashdata", platform + "**any**" + params.app_id, metrics, 1, null, ["cr_u"], (platform === dbAppUser.p) ? dbAppUser.ls : 0); - } - if (version) { - common.recordCustomMetric(params, "crashdata", "any**" + version + "**" + params.app_id, metrics, 1, null, ["cr_u"], (version === dbAppUser.av) ? dbAppUser.ls : 0); - } - }); - - //post process session - plugins.register("/session/post", function(ob) { - var params = ob.params; - var dbAppUser = ob.dbAppUser; - - //check if it is not user's first session - if (dbAppUser.ls) { - //record crash free session - var metrics = []; - var update = {}; - if (!dbAppUser.hadFatalCrash) { - metrics.push("crfses"); - metrics.push("crauf"); - update.hadAnyFatalCrash = params.time.timestamp; - } - else { - update.hadFatalCrash = false; - } - - if (metrics.length) { - common.recordCustomMetric(params, "crashdata", params.app_id, metrics, 1, null, ["crauf"], dbAppUser.hadAnyFatalCrash); - common.recordCustomMetric(params, "crashdata", dbAppUser.p + "**" + dbAppUser.av + "**" + params.app_id, metrics, 1, null, ["crauf"], dbAppUser.hadAnyFatalCrash); - common.recordCustomMetric(params, "crashdata", dbAppUser.p + "**any**" + params.app_id, metrics, 1, null, ["crauf"], dbAppUser.hadAnyFatalCrash); - common.recordCustomMetric(params, "crashdata", "any**" + dbAppUser.av + "**" + params.app_id, metrics, 1, null, ["crauf"], dbAppUser.hadAnyFatalCrash); - } - - var userMetrics = []; - if (!dbAppUser.hadNonfatalCrash) { - userMetrics.push("craunf"); - userMetrics.push("crnfses"); - update.hadAnyNonfatalCrash = params.time.timestamp; - } - else { - update.hadNonfatalCrash = false; - } - - if (userMetrics.length) { - common.recordCustomMetric(params, "crashdata", params.app_id, userMetrics, 1, null, ["craunf"], dbAppUser.hadAnyNonfatalCrash); - common.recordCustomMetric(params, "crashdata", dbAppUser.p + "**" + dbAppUser.av + "**" + params.app_id, userMetrics, 1, null, ["craunf"], dbAppUser.hadAnyNonfatalCrash); - common.recordCustomMetric(params, "crashdata", dbAppUser.p + "**any**" + params.app_id, userMetrics, 1, null, ["craunf"], dbAppUser.hadAnyNonfatalCrash); - common.recordCustomMetric(params, "crashdata", "any**" + dbAppUser.av + "**" + params.app_id, userMetrics, 1, null, ["craunf"], dbAppUser.hadAnyNonfatalCrash); - } - - if (Object.keys(update).length) { - ob.updates.push({$set: update}); - } - } - }); - - //write api call - plugins.register("/sdk/user_properties", function(ob) { - var params = ob.params; - if (typeof params.qstring.crash === "string") { - try { - params.qstring.crash = JSON.parse(params.qstring.crash); - } - catch (SyntaxError) { - console.log('Parse crash JSON failed', params.qstring.crash, params.req.url, params.req.body); - //resolve(); - return false; - } - } - - if (params.qstring.crash && params.qstring.crash._error && params.qstring.crash._app_version && params.qstring.crash._os) { - var props = [ - //device metrics - "os", - "os_version", - "manufacture", //may not be provided for ios or be constant, like Apple - "device", //model for Android, iPhone1,1 etc for iOS - "resolution", - "app_version", - "cpu", //type of cpu used on device (for ios will be based on device) - "opengl", //version of open gl supported - "view", //screen, view or page where error happened - "browser", //browser in which error happened, if applicable - - //state of device - "ram_current", //in megabytes - "ram_total", - "disk_current", //in megabytes - "disk_total", - "bat_current", //battery level, probably usually from 0 to 100 - "bat_total", //but for consistency also provide total - "bat", //or simple value from 0 to 100 - "orientation", //in which device was held, landscape, portrait, etc - - //bools - "root", //true if device is rooted/jailbroken, false or not provided if not - "online", //true if device is connected to the internet (WiFi or 3G), false or not provided if not connected - "muted", //true if volume is off, device is in muted state - "signal", //true if have cell/gsm signal or is not in airplane mode, false when no gsm signal or in airplane mode - "background", //true if app was in background when it crashed - - //error info - "name", //optional if provided by OS/Platform, else will use first line of stack - "type", //optional type of the error - "error", //error stack - "nonfatal", //true if handled exception, false or not provided if crash - "logs", //some additional logs provided, if any - "run", //running time since app start in seconds - - //build specific fields - "architecture", - "app_build", - "binary_images", - "build_uuid", - "executable_name", - "load_address", - "native_cpp", - "javascript", - "plcrash", - "binary_crash_dump", - "unprocessed", - - //custom key/values provided by developers - "custom" - ]; - - trace.preprocessCrash(params.qstring.crash, function(error) { - if (error && error !== "") { - var report = {}; - for (let i = 0, l = props.length; i < l; i++) { - if (typeof params.qstring.crash["_" + props[i]] !== "undefined") { - if (bools[props[i]]) { - if (params.qstring.crash["_" + props[i]] + "" === "false") { - report[props[i]] = 0; - } - else if (params.qstring.crash["_" + props[i]] + "" === "true") { - report[props[i]] = 1; - } - } - else if (segments[props[i]]) { - report[props[i]] = params.qstring.crash["_" + props[i]] + ""; - } - else if (props[i] === "custom") { - report[props[i]] = {}; - for (let key in params.qstring.crash["_" + props[i]]) { - let safeKey = key.replace(/^\$/, "").replace(/\./g, ":"); - if (safeKey) { - report[props[i]][safeKey] = params.qstring.crash["_" + props[i]][key]; - } - } - } - else { - report[props[i]] = params.qstring.crash["_" + props[i]]; - if (props[i] === "os" && params.qstring.crash._not_os_specific) { - report[props[i] + "_name"] = params.qstring.crash["_" + props[i]] + ""; - } - } - } - } - report.cd = new Date(); - if (report.binary_images && typeof report.binary_images === "object") { - var needs_regeneration = false; - for (let k in report.binary_images) { - if (!report.binary_images[k].bn) { - report.binary_images[k].bn = k; - needs_regeneration = true; - } - } - if (needs_regeneration) { - var newObj = {}; - for (let k in report.binary_images) { - newObj[report.binary_images[k].bn + "-" + report.binary_images[k].la] = report.binary_images[k]; - } - report.binary_images = newObj; - } - - report.binary_images = JSON.stringify(report.binary_images); - } - report.nonfatal = (report.nonfatal && report.nonfatal !== "false") ? true : false; - report.not_os_specific = (params.qstring.crash._not_os_specific) ? true : false; - var seed = error + params.app_id + report.nonfatal + ""; - if (!params.qstring.crash._not_os_specific) { - seed = report.os + seed; - } - var hash = common.crypto.createHash('sha1').update(seed).digest('hex'); - var dbAppUser = params.app_user; - report.group = hash; - report.uid = dbAppUser.uid; - report.ts = params.time.timestamp; - let updateUser = {}; - if (!report.nonfatal) { - if (!dbAppUser.hadFatalCrash) { - updateUser.hadFatalCrash = "true"; - } - updateUser.hadAnyFatalCrash = report.ts; - } - else if (report.nonfatal) { - if (!dbAppUser.hadNonfatalCrash) { - updateUser.hadNonfatalCrash = "true"; - } - updateUser.hadAnyNonfatalCrash = report.ts; - } - - if ('app_version' in report && typeof report.app_version !== 'string') { - report.app_version += ''; - } - - // Parse app_version into separate major, minor, patch version fields - if ('app_version' in report) { - const versionComponents = common.parseAppVersion(report.app_version); - - // Only store the components as separate fields if parsing was successful - if (versionComponents.success) { - report.app_version_major = versionComponents.major; - report.app_version_minor = versionComponents.minor; - report.app_version_patch = versionComponents.patch; - report.app_version_prerelease = versionComponents.prerelease; - report.app_version_build = versionComponents.build; - } - } - - let updateData = {$inc: {}}; - - updateData.$inc["data.crashes"] = 1; - if (Object.keys(updateUser).length) { - updateData.$set = updateUser; - } - ob.updates.push(updateData); - - var set = { - group: hash, - uid: report.uid, - last: report.ts, - }; - if (dbAppUser.sc) { - set.sessions = dbAppUser.sc; - } - common.db.collection('app_crashusers' + params.app_id).findAndModify({group: hash, 'uid': report.uid}, {}, {$set: set, $inc: {reports: 1}}, {upsert: true, new: false}, function(err, user) { - user = user && user.ok ? user.value : null; - if (user && user.sessions && dbAppUser.sc && dbAppUser.sc > user.sessions) { - report.session = dbAppUser.sc - user.sessions; - } - common.db.collection('app_crashes' + params.app_id).insert(report, function(crashErr, res) { - if (res && res.insertedIds && res.insertedIds[0]) { - report._id = res.insertedIds[0]; - - var data = {}; - data.crash = report.group; - var drillP = [ - { name: "name", type: "s" }, - { name: "manufacture", type: "l" }, - { name: "cpu", type: "l" }, - { name: "opengl", type: "l" }, - { name: "view", type: "l" }, - { name: "browser", type: "l" }, - { name: "os", type: "l" }, - { name: "orientation", type: "l" }, - { name: "nonfatal", type: "l" }, - { name: "root", type: "l" }, - { name: "online", type: "l" }, - { name: "signal", type: "l" }, - { name: "muted", type: "l" }, - { name: "background", type: "l" }, - { name: "app_version", type: "l" }, - { name: "app_version_major", type: "n" }, - { name: "app_version_minor", type: "n" }, - { name: "app_version_patch", type: "n" }, - { name: "app_version_prerelease", type: "l" }, - { name: "app_version_build", type: "l" }, - { name: "ram_current", type: "n" }, - { name: "ram_total", type: "n" }, - { name: "disk_current", type: "n" }, - { name: "disk_total", type: "n" }, - { name: "bat_current", type: "n" }, - { name: "bat_total", type: "n" }, - { name: "bat", type: "n" }, - { name: "run", type: "n" } - ]; - for (let i = 0; i < drillP.length; i++) { - if (report[drillP[i].name] !== null && typeof report[drillP[i].name] !== "undefined") { - if (bools[drillP[i].name]) { - if (report[drillP[i].name]) { - data[drillP[i].name] = "true"; - } - else { - data[drillP[i].name] = "false"; - } - } - else { - data[drillP[i].name] = report[drillP[i].name]; - } - } - } - if (!('name' in report) && 'error' in report) { - data.name = (report.error.split('\n')[0] + "").trim(); - } - if (report.custom) { - for (let i in report.custom) { - if (!data[i]) { - data[i] = report.custom[i]; - } - } - } - var events = [{ - key: "[CLY]_crash", - count: 1, - segmentation: data - }]; - plugins.dispatch("/plugins/drill", {params: params, dbAppUser: dbAppUser, events: events}); - - - const processCrash = function(userAll) { - var groupSet = {}; - var groupInsert = {}; - var groupInc = {}; - var groupMin = {}; - var groupMax = {}; - - groupInsert._id = hash; - groupSet.os = report.os; - groupSet.lastTs = report.ts; - - if (report.name) { - groupSet.name = ((report.name + "").split('\n')[0] + "").trim(); - } - else { - groupSet.name = (report.error.split('\n')[0] + "").trim(); - } - - groupSet.nonfatal = (report.nonfatal) ? true : false; - - if (report.not_os_specific) { - groupSet.not_os_specific = true; - } - - if (report.javascript) { - groupSet.javascript = true; - } - - if (report.native_cpp) { - groupSet.native_cpp = true; - } - - if (report.plcrash) { - groupSet.plcrash = true; - } - - groupInc.reports = 1; - - if (!report.nonfatal && dbAppUser.sc && dbAppUser.sc > 0 && dbAppUser.tp) { - groupInc.loss = dbAppUser.tp / dbAppUser.sc; - } - - if (!user || !user.reports) { - groupInc.users = 1; - } - - groupInsert.is_new = true; - groupInsert.is_resolved = false; - groupInsert.startTs = report.ts; - groupInsert.latest_version = report.app_version; - groupInsert.latest_version_for_sort = common.transformAppVersion(report.app_version); - groupInsert.error = report.error; - groupInsert.lrid = report._id + ""; - - //process segments - for (let i = 0, l = segments.length; i < l; i++) { - if (report[segments[i]] !== undefined) { - let safeKey = (report[segments[i]] + "").replace(/^\$/, "").replace(/\./g, ":"); - if (safeKey) { - if (groupInc[segments[i] + "." + safeKey]) { - groupInc[segments[i] + "." + safeKey]++; - } - else { - groupInc[segments[i] + "." + safeKey] = 1; - } - } - } - } - - //process custom segments - if (report.custom) { - for (let key in report.custom) { - let safeKey = (report.custom[key] + "").replace(/^\$/, "").replace(/\./g, ":").slice(0, 100); - if (safeKey) { - if (groupInc["custom." + key + "." + safeKey]) { - groupInc["custom." + key + "." + safeKey]++; - } - else { - groupInc["custom." + key + "." + safeKey] = 1; - } - } - } - } - - //process bool values - for (let i in bools) { - if (report[i]) { - if (groupInc[i + ".yes"]) { - groupInc[i + ".yes"]++; - } - else { - groupInc[i + ".yes"] = 1; - } - } - else { - if (groupInc[i + ".no"]) { - groupInc[i + ".no"]++; - } - else { - groupInc[i + ".no"] = 1; - } - } - } - - //process ranges - for (let i = 0, l = ranges.length; i < l; i++) { - if (report[ranges[i] + "_current"] && report[ranges[i] + "_total"]) { - var ratio = ((parseInt(report[ranges[i] + "_current"]) / parseInt(report[ranges[i] + "_total"])) * 100).toFixed(2); - groupInc[ranges[i] + ".total"] = parseFloat(ratio); - groupInc[ranges[i] + ".count"] = 1; - groupMin[ranges[i] + ".min"] = parseFloat(ratio); - groupMax[ranges[i] + ".max"] = parseFloat(ratio); - } - else if (report[ranges[i]] !== undefined) { - groupInc[ranges[i] + ".total"] = parseFloat(report[ranges[i]]); - groupInc[ranges[i] + ".count"] = 1; - groupMin[ranges[i] + ".min"] = parseFloat(report[ranges[i]]); - groupMax[ranges[i] + ".max"] = parseFloat(report[ranges[i]]); - } - } - - let update = {}; - if (Object.keys(groupSet).length > 0) { - update.$set = groupSet; - } - if (Object.keys(groupInsert).length > 0) { - update.$setOnInsert = groupInsert; - } - if (Object.keys(groupInc).length > 0) { - update.$inc = groupInc; - } - if (Object.keys(groupMin).length > 0) { - update.$min = groupMin; - } - if (Object.keys(groupMax).length > 0) { - update.$max = groupMax; - } - - update.$addToSet = { - groups: hash, - app_version_list: report.app_version, - }; - - common.db.collection('app_crashgroups' + params.app_id).findAndModify({'groups': {$elemMatch: {$eq: hash}} }, {}, update, {upsert: true, new: false}, function(crashGroupsErr, crashGroup) { - crashGroup = crashGroup && crashGroup.ok ? crashGroup.value : null; - var isNew = ((!crashGroup || !crashGroup.reports) && !crashGroupsErr) ? true : false; - - var lastTs; - if (crashGroup) { - lastTs = crashGroup.lastTs; - } - - var metrics = []; - - if (report.nonfatal) { - metrics.push("crnf"); - metrics.push("crunf"); - } - else { - metrics.push("crf"); - metrics.push("cruf"); - } - - common.recordCustomMetric(params, "crashdata", params.app_id, metrics, 1, null, ["cru", "crunf", "cruf"], lastTs); - common.recordCustomMetric(params, "crashdata", report.os + "**" + report.app_version.replace(/\./g, ":") + "**" + params.app_id, metrics, 1, null, ["cru", "crunf", "cruf"], lastTs); - common.recordCustomMetric(params, "crashdata", report.os + "**any**" + params.app_id, metrics, 1, null, ["cru", "crunf", "cruf"], lastTs); - common.recordCustomMetric(params, "crashdata", "any**" + report.app_version.replace(/\./g, ":") + "**" + params.app_id, metrics, 1, null, ["cru", "crunf", "cruf"], lastTs); - - var group = {}; - if (!isNew && crashGroup) { - if (crashGroup.latest_version && common.versionCompare(report.app_version.replace(/\./g, ":"), crashGroup.latest_version.replace(/\./g, ":")) > 0) { - group.latest_version = report.app_version; - group.latest_version_for_sort = common.transformAppVersion(report.app_version); - } - if (plugins.getConfig('crashes').same_app_version_crash_update) { - if (crashGroup.latest_version && common.versionCompare(report.app_version.replace(/\./g, ":"), crashGroup.latest_version.replace(/\./g, ":")) >= 0) { - group.error = report.error; - group.lrid = report._id + ""; - } - } - else { - if (crashGroup.latest_version && common.versionCompare(report.app_version.replace(/\./g, ":"), crashGroup.latest_version.replace(/\./g, ":")) > 0) { - group.error = report.error; - group.lrid = report._id + ""; - } - } - if (crashGroup.resolved_version && crashGroup.is_resolved && common.versionCompare(report.app_version.replace(/\./g, ":"), crashGroup.resolved_version.replace(/\./g, ":")) > 0) { - group.is_resolved = false; - group.is_renewed = true; - } - if (Object.keys(group).length > 0) { - common.db.collection('app_crashgroups' + params.app_id).update({'groups': hash }, {$set: group}, function() {}); - } - } - - if (isNew) { - plugins.dispatch("/crashes/new", {data: {crash: groupInsert, user: dbAppUser, app: params.app}}); - } - - //update meta document - groupInc = {}; - groupInc.reports = 1; - if (!userAll || !userAll.crashes) { - groupInc.users = 1; - } - - if (!report.nonfatal && (!userAll || !userAll.fatal)) { - groupInc.usersfatal = 1; - } - - if (!report.nonfatal && dbAppUser.sc && dbAppUser.sc > 0 && dbAppUser.tp) { - groupInc.loss = dbAppUser.tp / dbAppUser.sc; - } - - if (isNew) { - groupInc.isnew = 1; - groupInc.crashes = 1; - } - if (group.is_renewed) { - groupInc.reoccurred = 1; - groupInc.resolved = -1; - } - if (report.nonfatal) { - groupInc.nonfatal = 1; - } - else { - groupInc.fatal = 1; - } - - groupInc["os." + report.os.replace(/^\$/, "").replace(/\./g, ":")] = 1; - groupInc["app_version." + report.app_version.replace(/^\$/, "").replace(/\./g, ":")] = 1; - common.writeBatcher.add('app_crashgroups' + params.app_id, "meta", {$inc: groupInc}); - - if (plugins.getConfig("crashes").automatic_symbolication === true) { - common.db.collection("app_crashsymbols" + params.app_id).findOne({build: report.build_uuid || report.app_version}, function(symbolFindError, crashSymbol) { - if (!symbolFindError && crashSymbol) { - var dispatchParams = { - params: {app: params.app, app_id: params.app_id, qstring: {report_id: report._id.toString(), symbol_id: crashSymbol._id.toString(), return_url: plugins.getConfig("api").domain + "/i/crash_symbols/symbolicatation_result"}}, - paths: [null, "i", "crash_symbols", "symbolicate"], - automated: true - }; - - plugins.dispatch("/i/crash_symbols", dispatchParams); - } - }); - } - }); - }; - - let update = {$set: {group: 0, 'uid': report.uid}}; - if (!user || !user.reports) { - var inc = {crashes: 1}; - if (!report.nonfatal) { - inc.fatal = 1; - } - update.$inc = inc; - } - - common.db.collection('app_crashusers' + params.app_id).findAndModify({group: 0, 'uid': report.uid}, {}, update, {upsert: true, new: false}, function(crashUsersErr, userAll) { - userAll = userAll && userAll.ok ? userAll.value : null; - processCrash(userAll); - }); - } - else { - console.error("Could not save crash", crashErr); - } - }); - }); - } - }, params.app && params.app.plugins); - } - }); //read api call plugins.register("/o", function(ob) { @@ -853,8 +158,7 @@ const FEATURE_NAME = 'crashes'; report_ids = report_ids.map(function(rid) { return common.db.ObjectID(rid); }); - - common.db.collection("app_crashes" + params.app_id).find({_id: {$in: report_ids}}).toArray(function(err, reports) { + common.drillDb.collection("drill_events").find({"a": (params.app_id + ""), "e": "[CLY]_crash", "n": {$in: report_ids}}).toArray(function(err, reports) { var reportMap = {}; reports.forEach(function(rep) { @@ -900,6 +204,7 @@ const FEATURE_NAME = 'crashes'; log.e("Error fetching crash reports from drill: " + cursorErr); } res0 = res0 || []; + console.log("Fetched " + res0.length + " crash reports from drill for crash group " + result._id); if (res0 && res0.length) { for (var z = 0; z < res0.length; z++) { //Converts to usual format @@ -936,26 +241,9 @@ const FEATURE_NAME = 'crashes'; res0[z] = dd; trace.postprocessCrash(res0[z]); } + result.data = res0; } - if (res0.length < plugins.getConfig("crashes").report_limit) { - var cursor = common.db.collection('app_crashes' + params.app_id).find({group: result._id}, {fields: {binary_crash_dump: 0}}).sort({ ts: -1 }); - cursor.limit(plugins.getConfig("crashes").report_limit - res0.length); - cursor.toArray(function(cursorErr2, res) { - if (cursorErr2) { - log.e("Error fetching crash reports from app_crashes: " + cursorErr2); - } - if (res && res.length) { - res.forEach(trace.postprocessCrash); - //apped res to res0 - res0 = res0.concat(res); - } - result.data = res0 || []; - common.returnOutput(params, result); - }); - } - else { - common.returnOutput(params, res0); - } + common.returnOutput(params, result); }); if (result.is_new) { common.db.collection('app_crashgroups' + params.app_id).update({groups: params.qstring.group}, {$set: {is_new: false}}, function() {}); @@ -1282,7 +570,7 @@ const FEATURE_NAME = 'crashes'; return; } var id = params.qstring.crash_id + ""; - common.db.collection('app_crashes' + params.qstring.app_id).findOne({'_id': common.db.ObjectID(id)}, {fields: {error: 1}}, function(err, crash) { + common.drillDb.collection("drill_events").findOne({'_id': id}, {fields: {error: 1}}, function(err, crash) { if (err || !crash) { common.returnMessage(params, 400, 'Crash not found'); return; @@ -1310,7 +598,7 @@ const FEATURE_NAME = 'crashes'; return; } var id = params.qstring.crash_id + ""; - common.db.collection('app_crashes' + params.qstring.app_id).findOne({'_id': common.db.ObjectID(id)}, {fields: {binary_crash_dump: 1}}, function(err, crash) { + common.drillDb.collection("drill_events").findOne({'_id': id}, {fields: {binary_crash_dump: 1}}, function(err, crash) { if (err || !crash) { common.returnMessage(params, 400, 'Crash not found'); return; @@ -1695,7 +983,7 @@ const FEATURE_NAME = 'crashes'; async.each(groups, function(group, done) { group.app_id = params.qstring.app_id; plugins.dispatch("/systemlogs", {params: params, action: "crash_deleted", data: group}); - common.db.collection('app_crashes' + params.qstring.app_id).remove({'group': {$in: group.groups} }, function() {}); + common.drillDb.collection("drill_events").remove({"a": (params.app_id + ""), "e": "[CLY]_crash", "n": {$in: group.groups}}, function() {}); common.db.collection('app_crashgroups' + params.qstring.app_id).remove({'_id': group._id }, function() { if (common.drillDb) { common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_crash" + params.qstring.app_id).digest('hex')).remove({"sg.crash": group._id}, function() {}); @@ -1844,16 +1132,12 @@ const FEATURE_NAME = 'crashes'; common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "uid": 1}, {background: true}, function() {}); common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "crashes": 1, "fatal": 1}, {sparse: true, background: true}, function() {}); common.db.collection('app_crashusers' + appId).ensureIndex({"uid": 1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"group": 1, ts: -1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"uid": 1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"name": "text"}, { background: true }, function() {}); }); plugins.register("/i/apps/delete", function(ob) { var appId = ob.appId; common.db.collection('app_crashgroups' + appId).drop(function() {}); common.db.collection('app_crashusers' + appId).drop(function() {}); - common.db.collection('app_crashes' + appId).drop(function() {}); common.db.collection('crash_share').remove({'app_id': appId }, function() {}); common.db.collection('crashdata').remove({'_id': {$regex: appId + ".*"}}, function() {}); /*if (common.drillDb) { @@ -1866,7 +1150,6 @@ const FEATURE_NAME = 'crashes'; var appId = ob.appId; var ids = ob.ids; common.db.collection('crashdata').remove({$and: [{'_id': {$regex: appId + ".*"}}, {'_id': {$nin: ids}}]}, function() {}); - common.db.collection('app_crashes' + appId).remove({ts: {$lt: ob.moment.unix()}}, function() {}); /*if (common.drillDb) { common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_crash" + appId).digest('hex')).remove({ts: {$lt: ob.moment.valueOf()}}, function() {}); common.drillDb.collection("drill_events").remove({a: appId + "", e: "[CLY]_crash", ts: {$lt: ob.moment.valueOf()}}, function() {}); @@ -1875,11 +1158,6 @@ const FEATURE_NAME = 'crashes'; plugins.register("/i/apps/clear_all", function(ob) { var appId = ob.appId; - common.db.collection('app_crashes' + appId).drop(function() { - common.db.collection('app_crashes' + appId).ensureIndex({"group": 1, ts: -1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"uid": 1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"name": "text"}, { background: true }, function() {}); - }); common.db.collection('app_crashusers' + appId).drop(function() { common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "uid": 1}, {background: true}, function() {}); common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "crashes": 1, "fatal": 1}, {sparse: true, background: true}, function() {}); @@ -1908,11 +1186,6 @@ const FEATURE_NAME = 'crashes'; plugins.register("/i/apps/reset", function(ob) { var appId = ob.appId; - common.db.collection('app_crashes' + appId).drop(function() { - common.db.collection('app_crashes' + appId).ensureIndex({"group": 1, ts: -1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"uid": 1}, {background: true}, function() {}); - common.db.collection('app_crashes' + appId).ensureIndex({"name": "text"}, { background: true }, function() {}); - }); common.db.collection('app_crashusers' + appId).drop(function() { common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "uid": 1}, {background: true}, function() {}); common.db.collection('app_crashusers' + appId).ensureIndex({"group": 1, "crashes": 1, "fatal": 1}, {sparse: true, background: true}, function() {}); diff --git a/plugins/crashes/install.js b/plugins/crashes/install.js index 8b6fa74599e..30ff9d63e43 100644 --- a/plugins/crashes/install.js +++ b/plugins/crashes/install.js @@ -15,7 +15,7 @@ pluginManager.dbConnection().then(function(countlyDb) { console.log("Adding crash collections to " + app.name); function cb() { cnt++; - if (cnt == 15) { + if (cnt == 12) { done(); } } @@ -31,10 +31,6 @@ pluginManager.dbConnection().then(function(countlyDb) { countlyDb.collection('app_crashusers' + app._id).ensureIndex({"group": 1, "uid": 1}, {background: true}, cb); countlyDb.collection('app_crashusers' + app._id).ensureIndex({"group": 1, "crashes": 1, "fatal": 1}, {sparse: true, background: true}, cb); countlyDb.collection('app_crashusers' + app._id).ensureIndex({"uid": 1}, {background: true}, cb); - countlyDb.collection('app_crashes' + app._id).ensureIndex({"group": 1, ts: -1}, {background: true}, cb); - countlyDb.collection('app_crashes' + app._id).dropIndex({"group": 1}, {background: true}, cb); - countlyDb.collection('app_crashes' + app._id).ensureIndex({"uid": 1}, {background: true}, cb); - countlyDb.collection('app_crashes' + app._id).ensureIndex({"name": "text"}, { background: true }, cb); } async.forEach(apps, upgrade, function() { fs.chmod(path.resolve(__dirname + "/bin/minidump_stackwalk"), 0o744, function(err) { diff --git a/plugins/crashes/tests.js b/plugins/crashes/tests.js index 4e5e12b79df..5d1b8a27b7d 100644 --- a/plugins/crashes/tests.js +++ b/plugins/crashes/tests.js @@ -327,6 +327,7 @@ describe('Testing Crashes', function() { if (err) { return done(err); } + console.log("crashes", res.text); var ob = JSON.parse(res.text); ob.should.have.property("_id", CRASHES[0]); ob.should.have.property("os", "Android"); diff --git a/plugins/data_migration/api/data_migration_helper.js b/plugins/data_migration/api/data_migration_helper.js index 6ad4caf4930..17ad7b1a1b2 100644 --- a/plugins/data_migration/api/data_migration_helper.js +++ b/plugins/data_migration/api/data_migration_helper.js @@ -523,7 +523,7 @@ module.exports = function(my_db) { scripts.push({cmd: 'mongo', args: [countly_db_name, ...dbargs0, "--eval", 'db.apps.update({ "_id": ObjectId("' + appid + '")}, { $set: { redirect_url: "' + res.redirect_url + '" } })']}); } - var appDocs = ['app_users', 'metric_changes', 'app_crashes', 'app_crashgroups', 'app_crashusers', 'app_nxret', 'app_viewdata', 'app_views', 'app_userviews', 'app_viewsmeta', 'blocked_users', 'campaign_users', 'consent_history', 'crashes_jira', 'event_flows', 'timesofday', 'feedback', 'push_', 'apm', "nps", "survey", "completed_surveys"]; + var appDocs = ['app_users', 'app_crashgroups', 'app_crashusers', 'app_viewdata', 'app_views', 'app_userviews', 'app_viewsmeta', 'blocked_users', 'campaign_users', 'consent_history', 'crashes_jira', 'event_flows', 'timesofday', 'feedback', 'push_', 'apm', "nps", "survey", "completed_surveys"]; for (let j = 0; j < appDocs.length; j++) { scripts.push({cmd: 'mongodump', args: [...dbargs, '--collection', appDocs[j] + appid, '--out', my_folder]}); } diff --git a/plugins/data_migration/scripts/getExportScripts.js b/plugins/data_migration/scripts/getExportScripts.js index 5192359c2f0..5d4e2b799c1 100644 --- a/plugins/data_migration/scripts/getExportScripts.js +++ b/plugins/data_migration/scripts/getExportScripts.js @@ -155,7 +155,7 @@ var create_export_scripts = function(data) { scripts.push({cmd: 'mongo', args: [countly_db_name, ...dbargs0, "--eval", 'db.apps.update({ "_id": ObjectId("' + appid + '")}, { $set: { redirect_url: "' + res.redirect_url + '" } })']}); } - var appDocs = ['app_users', 'metric_changes', 'app_crashes', 'app_crashgroups', 'app_crashusers', 'app_nxret', 'app_viewdata', 'app_views', 'app_userviews', 'app_viewsmeta', 'blocked_users', 'campaign_users', 'consent_history', 'crashes_jira', 'event_flows', 'timesofday', 'feedback', 'push_', 'apm', "nps", "survey", "completed_surveys"]; + var appDocs = ['app_users', 'app_crashgroups', 'app_crashusers', 'app_viewdata', 'app_views', 'app_userviews', 'app_viewsmeta', 'blocked_users', 'campaign_users', 'consent_history', 'crashes_jira', 'event_flows', 'timesofday', 'feedback', 'push_', 'apm', "nps", "survey", "completed_surveys"]; for (let j = 0; j < appDocs.length; j++) { scripts.push({cmd: 'mongodump', args: [...dbargs, '--collection', appDocs[j] + appid, '--out', my_folder, '--gzip']}); } diff --git a/plugins/dbviewer/tests.js b/plugins/dbviewer/tests.js index abe2d3d2821..0385aaf5aea 100644 --- a/plugins/dbviewer/tests.js +++ b/plugins/dbviewer/tests.js @@ -114,7 +114,6 @@ describe('Testing DBViewer', function() { ob[0].collections.should.not.have.property("members"); ob[0].collections.should.not.have.property("plugins"); ob[0].collections.should.not.have.property("jobs"); - ob[0].collections.should.have.property("app_crashes(" + APP_NAME + ")", "app_crashes" + APP_ID); ob[0].collections.should.have.property("app_users(" + APP_NAME + ")", "app_users" + APP_ID); done(); }); diff --git a/plugins/logger/api/ingestor.js b/plugins/logger/api/ingestor.js index 58a51258230..81b196a2778 100644 --- a/plugins/logger/api/ingestor.js +++ b/plugins/logger/api/ingestor.js @@ -267,6 +267,7 @@ plugins.setConfigs("logger", { m: params.req.method, b: params.bulk || false, c: (params.cancelRequest) ? params.cancelRequest : false, + p: (problems.length) ? problems : false, res: response }; diff --git a/plugins/plugins/frontend/public/javascripts/countly.views.js b/plugins/plugins/frontend/public/javascripts/countly.views.js index 9bf0f63590d..b49578b9f3d 100644 --- a/plugins/plugins/frontend/public/javascripts/countly.views.js +++ b/plugins/plugins/frontend/public/javascripts/countly.views.js @@ -1204,7 +1204,7 @@ {label: "configs.api.batch", list: ["batch_processing", "batch_period", "batch_on_master", "user_merge_paralel"]}, {label: "configs.api.cache", list: ["batch_read_processing", "batch_read_period", "batch_read_ttl", "batch_read_on_master"]}, {label: "configs.api.limits", list: ["event_limit", "event_segmentation_limit", "event_segmentation_value_limit", "metric_limit", "session_duration_limit", "array_list_limit"]}, - {label: "configs.api.others", list: ["safe", "domain", "export_limit", "offline_mode", "reports_regenerate_interval", "request_threshold", "sync_plugins", "send_test_email", "city_data", "country_data", "session_cooldown", "total_users", "prevent_duplicate_requests", "metric_changes", "data_retention_period", "trim_trailing_ending_spaces"]}, + {label: "configs.api.others", list: ["safe", "domain", "export_limit", "offline_mode", "reports_regenerate_interval", "request_threshold", "sync_plugins", "send_test_email", "city_data", "country_data", "session_cooldown", "total_users", "prevent_duplicate_requests", "data_retention_period", "trim_trailing_ending_spaces"]}, ] }); @@ -1238,7 +1238,6 @@ "session_cooldown": true, "total_users": true, "prevent_duplicate_requests": true, - "metric_changes": true, "trim_trailing_ending_spaces": true } }; diff --git a/plugins/plugins/frontend/public/localization/plugins.properties b/plugins/plugins/frontend/public/localization/plugins.properties index aecc967e390..fe8eef9cb6c 100644 --- a/plugins/plugins/frontend/public/localization/plugins.properties +++ b/plugins/plugins/frontend/public/localization/plugins.properties @@ -94,7 +94,6 @@ configs.api-sync_plugins = Sync plugin states configs.api-session_cooldown = Session cooldown (seconds) configs.api-total_users = Total users configs.api-metric_limit = Metric limit -configs.api-metric_changes = Record metric changes configs.api-request_threshold = Request threshold (seconds) configs.api-export_limit = Document export limit configs.api-reports_regenerate_interval = Regeneration interval for reports @@ -203,7 +202,6 @@ configs.help.api-session_cooldown = Time between session end and start when serv configs.help.api-total_users = If enabled, total users API will be enabled and used to override estimated total user counts in all reports. Enabling this will provide extra overhead, so consult Countly before enabling for highly loaded servers. configs.help.api-data_retention_period = Specifies how long to keep granular data before deleting it (0 means never delete it). This setting will only delete granular level data and will not affect aggregated data you see in sections such as Overview and Analytics. configs.help.api-metric_limit = Number of different metric values per annual period. Increasing this number may affect your server performance. -configs.help.api-metric_changes = Recording changes is required by Total users correction. Disable it if you know you won't be using Total users correction configs.help.api-request_threshold = Time before switching to report manager if a drill, funnel or other similar dashboard functionality request takes too long to complete. This should not be longer than HTTP timeout, which by default is 60 seconds or you won't get any response. configs.help.api-export_limit = Amount of lines in a CSV, PDF or CSV document exported in single file configs.help.api-prevent_duplicate_requests = Stores and compares request hash to prevent duplicate requests diff --git a/plugins/star-rating/api/api.js b/plugins/star-rating/api/api.js index b2b2a0bc6cc..26c58391d11 100644 --- a/plugins/star-rating/api/api.js +++ b/plugins/star-rating/api/api.js @@ -875,58 +875,6 @@ function uploadFile(myfile, id, callback) { }); plugins.register("/i/feedback/input", nonChecksumHandler); - plugins.register("/i", function(ob) { - var params = ob.params; - if (params.qstring.events && params.qstring.events.length && Array.isArray(params.qstring.events)) { - params.qstring.events = params.qstring.events.filter(function(currEvent) { - if (currEvent.key === "[CLY]_star_rating") { - /** - * register for process new rating event data. - * the original event format like: - * { key: '[CLY]_star_rating', count:1, sum:1, segmentation:{ platform:"iOS", version:"3.2", rating:2} - * this function will add a field call "platform_version_rate" in segmentation. - */ - currEvent.segmentation.platform = currEvent.segmentation.platform || "undefined"; //because we have a lot of old data with undefined - currEvent.segmentation.rating = currEvent.segmentation.rating || "undefined"; - currEvent.segmentation.ratingSum = Number(currEvent.segmentation.rating) || 0; - currEvent.segmentation.widget_id = currEvent.segmentation.widget_id || "undefined"; - currEvent.segmentation.app_version = currEvent.segmentation.app_version || "undefined"; - currEvent.segmentation.platform_version_rate = currEvent.segmentation.platform + "**" + currEvent.segmentation.app_version + "**" + currEvent.segmentation.rating + "**" + currEvent.segmentation.widget_id + "**"; - // is provided email & comment fields - - var collectionName = 'feedback' + ob.params.app._id; - common.db.collection(collectionName).insert({ - "email": currEvent.segmentation.email || "No email provided", - "comment": currEvent.segmentation.comment || "No comment provided", - "ts": (currEvent.timestamp) ? common.initTimeObj(params.appTimezone, currEvent.timestamp).timestamp : params.time.timestamp, - "device_id": params.qstring.device_id, - "cd": new Date(), - "uid": params.app_user.uid, - "contact_me": currEvent.segmentation.contactMe, - "rating": currEvent.segmentation.rating, - "platform": currEvent.segmentation.platform, - "app_version": currEvent.segmentation.app_version, - "widget_id": currEvent.segmentation.widget_id - }, function(err) { - if (err) { - return false; - } - }); - // increment ratings count for widget - common.db.collection('feedback_widgets').update({ - _id: common.db.ObjectID(currEvent.segmentation.widget_id) - }, { - $inc: { ratingsSum: currEvent.segmentation.ratingSum, ratingsCount: 1 } - }, function(err) { - if (err) { - return false; - } - }); - } - return true; - }); - } - }); /** * @api {post} /i/feedback/widgets/status Bulk update feedback widgets @@ -1636,25 +1584,12 @@ function uploadFile(myfile, id, callback) { } return false; }); - plugins.register("/i/apps/create", function(ob) { - var appId = ob.appId; - common.db.collection('feedback' + appId).ensureIndex({ - "uid": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - "ts": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - comment: 'text', email: 'text' - }, () => {}); - }); plugins.register("/i/apps/delete", function(ob) { var appId = ob.appId; common.db.collection('feedback_widgets').remove({ type: "rating", "app_id": appId }); - common.db.collection('feedback' + appId).drop(function() {}); common.db.collection("events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); /*if (common.drillDb) { common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); @@ -1662,11 +1597,6 @@ function uploadFile(myfile, id, callback) { }); plugins.register("/i/apps/clear", function(ob) { var appId = ob.appId; - common.db.collection('feedback' + appId).remove({ - ts: { - $lt: ob.moment.unix() - } - }, function() {}); common.db.collection("events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).remove({ ts: { $lt: ob.moment.unix() @@ -1682,17 +1612,6 @@ function uploadFile(myfile, id, callback) { }); plugins.register("/i/apps/clear_all", function(ob) { var appId = ob.appId; - common.db.collection('feedback' + appId).drop(function() { - common.db.collection('feedback' + appId).ensureIndex({ - "uid": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - "ts": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - comment: 'text', email: 'text' - }, () => {}); - }); common.db.collection("events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); /*if (common.drillDb) { common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); @@ -1704,17 +1623,6 @@ function uploadFile(myfile, id, callback) { type: "rating", "app_id": appId }); - common.db.collection('feedback' + appId).drop(function() { - common.db.collection('feedback' + appId).ensureIndex({ - "uid": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - "ts": 1 - }, function() {}); - common.db.collection('feedback' + appId).ensureIndex({ - comment: 'text', email: 'text' - }, () => {}); - }); common.db.collection("events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); /*if (common.drillDb) { common.drillDb.collection("drill_events" + crypto.createHash('sha1').update("[CLY]_star_rating" + appId).digest('hex')).drop(function() {}); @@ -1737,15 +1645,15 @@ function uploadFile(myfile, id, callback) { }); } }); - plugins.register("/i/app_users/delete", async function(ob) { + /*plugins.register("/i/app_users/delete", function(ob) { var appId = ob.app_id; var uids = ob.uids; if (uids && uids.length) { // By using await and no callback, error in db operation will be thrown // This error will then be caught by app users api dispatch so that it can cancel app user deletion - await common.db.collection("feedback" + appId).remove({ uid: { $in: uids } }); + //await common.db.collection("feedback" + appId).remove({ uid: { $in: uids } }); } - }); + });*/ plugins.register("/i/app_users/export", function(ob) { return new Promise(function(resolve) { var uids = ob.uids; diff --git a/plugins/star-rating/install.js b/plugins/star-rating/install.js index f2b73d74f04..e69de29bb2d 100644 --- a/plugins/star-rating/install.js +++ b/plugins/star-rating/install.js @@ -1,37 +0,0 @@ -var async = require('async'), - pluginManager = require('../pluginManager.js'); -console.log("Installing ratings plugin"); -pluginManager.dbConnection().then((countlyDb) => { - countlyDb.collection("feedback_widgets").updateMany({type: {$exists: false}}, {$set: {type: "rating"}}, function(err) { - if (err) { - console.log("Could not update widget type"); - countlyDb.close(); - return; - } - countlyDb.collection('apps').find({}).toArray(function(err, apps) { - - if (!apps || err) { - console.log("No apps to process"); - countlyDb.close(); - return; - } - function upgrade(app, done) { - var cnt = 0; - console.log("Adding ratings collections to " + app.name); - function cb() { - cnt++; - if (cnt == 3) { - done(); - } - } - countlyDb.collection('feedback' + app._id).ensureIndex({"uid": 1}, {background: true}, cb); - countlyDb.collection('feedback' + app._id).ensureIndex({"ts": 1}, {background: true}, cb); - countlyDb.collection('feedback' + app._id).ensureIndex({comment: 'text', email: 'text'}, {background: true}, cb); - } - async.forEach(apps, upgrade, function() { - console.log("Ratings plugin installation finished"); - countlyDb.close(); - }); - }); - }); -}); \ No newline at end of file diff --git a/ui-tests/cypress/lib/dashboard/manage/db/countly/dbCountly.js b/ui-tests/cypress/lib/dashboard/manage/db/countly/dbCountly.js index 197ed181260..d8ca86de05a 100644 --- a/ui-tests/cypress/lib/dashboard/manage/db/countly/dbCountly.js +++ b/ui-tests/cypress/lib/dashboard/manage/db/countly/dbCountly.js @@ -62,7 +62,7 @@ const verifyEmptyPageElements = () => { cy.verifyElement({ labelElement: dbCountlyPageElements.COLLECTION_AND_APP_NAME_LABEL, - labelText: "app_crashes" + labelText: "apps" }); cy.verifyElement({ @@ -86,7 +86,7 @@ const verifyFullDataPageElements = () => { cy.verifyElement({ labelElement: dbCountlyPageElements.COLLECTION_AND_APP_NAME_LABEL, - labelText: "app_crashes" + labelText: "apps" }); cy.shouldNotExist(dbCountlyPageElements.EMPTY_TABLE_ICON);