How to use the @pm2/io.meter function in @pm2/io

To help you get started, we’ve selected a few @pm2/io examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keymetrics / app-playground / app.js View on Github external
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)
github maxindelicato / makerads / server / utils / tracking.js View on Github external
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);
}
github maxindelicato / makerads / server / utils / tracking.js View on Github external
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);
}

@pm2/io

PM2.io NodeJS APM

Apache-2.0
Latest version published 1 month ago

Package Health Score

85 / 100
Full package analysis

Similar packages