-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
25 lines (20 loc) · 648 Bytes
/
index.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
const lynx = require('lynx');
// instantiate a metrics client
// Note: the metric hostname is hardcoded here
const metrics = new lynx('localhost', 8125);
// sleep for a given number of milliseconds
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function main() {
// send message to the metrics server
metrics.timing('test.core.delay', Math.random() * 1000);
// sleep for a random number of milliseconds to avoid flooding metrics server
return sleep(3000);
}
// infinite loop
(async () => {
console.log("🚀🚀🚀");
while (true) { await main() }
})()
.then(console.log, console.error);