-
Notifications
You must be signed in to change notification settings - Fork 3
/
config-example.js
executable file
·36 lines (29 loc) · 1.03 KB
/
config-example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Place paths to your implementations absolute or relative to the config-script
var defaultMapImpl = require("./lib/DefaultMapImpl.js"),
NAGIOS_IPS = /^214\.96\.80\.23[01]$/;
module.exports = {
filterRaw: function (hit) {
// do not count requests from nagios monitoring
if (NAGIOS_IPS.test(hit.ip)) {
return false;
}
// do not count weird requests
if (hit.userAgent === '-' && hit.referer === '-') {
return false;
}
return true;
},
filterCooked: function (cooked) {
// only count mobile devices which are Mobile Grade A
return cooked.mobileGrade === 'A';
},
map: function (cooked, emit) {
// a somewhat derived example to filter based on emitted objects (better use filterCooked!)
defaultMapImpl(cooked, function (emittedObject) {
if (emittedObject.mobileGrade && emittedObject.mobileGrade.A >= 1 ||
true) {
emit(emittedObject);
}
});
}
};