How to use the prom-client.defaultMetrics function in prom-client

To help you get started, we’ve selected a few prom-client 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 hipages / inceptum / src / metrics / Metrics.ts View on Github external
static setup(jobName) {
    const defaultMetrics = Prometheus.defaultMetrics;

    // Skip `osMemoryHeap` probe, and probe every 5th second.
    const defaultInterval = defaultMetrics(['osMemoryHeap'], 10000);
    process.on('exit', () => { clearInterval(defaultInterval); });

    if (Context.hasConfig('metrics.gateway') &&
      Context.hasConfig('metrics.gateway.active') &&
      Context.getConfig('metrics.gateway.active')
    ) {
      const gateway = new Prometheus.Pushgateway(Object.assign(Context.getConfig('metrics.gateway.hostport'), { timeout: 2000 }));
      const tags = {
        jobName
      };
      const interval = setInterval(() => {
        gateway.pushAdd(tags, (err) => {
          if (err) {
github hipages / inceptum / src / metrics / Metrics.ts View on Github external
static setup(appName: string, context: Context) {
    const defaultMetrics = prometheus.defaultMetrics;

    // Skip `osMemoryHeap` probe, and probe every 5th second.
    const defaultInterval = defaultMetrics(['osMemoryHeap'], 10000);
    process.on('exit', () => { clearInterval(defaultInterval); });

    if (context.hasConfig('metrics.gateway') &&
      context.hasConfig('metrics.gateway.active') &&
      context.getConfig('metrics.gateway.active')
    ) {
      const gateway = new prometheus.Pushgateway(context.getConfig('metrics.gateway.hostport'));
      const tags = {
        jobName: 'msPush',
        appName,
      };
      const interval = setInterval(() => {
        gateway.pushAdd(tags, (err) => {