Skip to content

Commit

Permalink
Merge pull request #5649 from Countly/anna/master
Browse files Browse the repository at this point in the history
Script to look for bad results in drill/aggregated report.
  • Loading branch information
Cookiezaurs authored Oct 8, 2024
2 parents e533b6b + 05c6371 commit a99f421
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bin/scripts/data-reports/check_comparison_report.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//Script to look for meaningful differences in drill vs aggregated data.
var data = {"601ba83d99111111d9": {"name": "My Good test APP", "total": 25, "bad": 0}, "6026972d182f7e014cd82114": {"name": "My BAD APP", "total": 100, "bad": 2, "events": {"BAD EVENT": {"e": "BAD EVENT", "report": {"totals": {"c": 1000}, "data": {"2024.10.2": {"c": 1000, "s": 0, "dur": -9.094947017729282e-13}}}}}}}; //output of compare_drill_aggregated.js script

//Should be adjusted based on data amount.
var total_treshold = 100; //If modulus daily value is bigger than this, it will be autputted
var daily_treshold = 50; //If for any day any value is biiger that this - it will be outputted.

for (var appid in data) {
if (data[appid].bad > 0) {
for (var event in data[appid].events) {
var is_any_total_bad = false;
for (var m in data[appid].events[event].report.totals) {
if (data[appid].events[event].report.totals[m] > total_treshold || data[appid].events[event].report.totals[m] < -1 * total_treshold) {
is_any_total_bad = true;
}
}
if (is_any_total_bad) {
console.log("total difference in APP:" + appid + " for event " + event + " " + JSON.stringify(data[appid].events[event].report.totals));

for (var date in data[appid].events[event].report.data) {
var is_any_bad = false;
for (var m2 in data[appid].events[event].report.data[date]) {
if (data[appid].events[event].report.data[date][m2] > daily_treshold || data[appid].events[event].report.data[date][m2] < daily_treshold * -1) {
is_any_bad = true;
}
}
if (is_any_bad) {
console.log(" " + date + " : " + JSON.stringify(data[appid].events[event].report.data[date]));
}
}

}
}
}
}

0 comments on commit a99f421

Please sign in to comment.