Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
randomVariable++
}, 400)
io.metric({
name: 'Var count',
value: () => {
return randomVariable
}
})
/**
* Probe system #3 - Meter
*
* Probe things that are measured as events / interval.
*/
const meter = io.meter({
name: 'req/min',
timeframe: 60
})
/**
* Use case for Meter Probe
*
* Create a mock http server
*/
http.createServer((req, res) => {
// Then mark it at every connections
meter.mark()
res.end('Thanks')
}).listen(5005)
import io from '@pm2/io';
import { click, impression } from '../db';
const impressionsSec = io.meter({
name: 'impressions/sec'
});
const clicksSec = io.meter({
name: 'clicks/sec'
});
export function trackImpression(adId, referrer) {
impressionsSec.mark();
impression(adId, referrer);
}
export function trackClick(adId, referrer) {
clicksSec.mark();
click(adId, referrer);
}
import io from '@pm2/io';
import { click, impression } from '../db';
const impressionsSec = io.meter({
name: 'impressions/sec'
});
const clicksSec = io.meter({
name: 'clicks/sec'
});
export function trackImpression(adId, referrer) {
impressionsSec.mark();
impression(adId, referrer);
}
export function trackClick(adId, referrer) {
clicksSec.mark();
click(adId, referrer);
}