How to use inspector-influx - 4 common examples

To help you get started, we’ve selected a few inspector-influx 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 destinygg / chat-bot / lib / services / metrics / influx-metrics-reporter.js View on Github external
constructor(config, tags) {
    const dbConfig = {
      username: config.username,
      password: config.password,
      database: config.database,
      port: config.port,
      host: config.host,
      protocol: config.protocol,
      precision: 'm',
    };

    // So uh. This library doesn't support path-prefixes.
    // So let's just monkey patch that in.
    const sender = new DefaultSender(dbConfig);

    const oldDiscard = sender.db.pool.discard;
    const oldText = sender.db.pool.text;

    sender.db.pool.text = function internal(props) {
      // eslint-disable-next-line no-param-reassign
      props.path = config.pathPrefix + props.path;
      // eslint-disable-next-line prefer-rest-params
      return oldText.apply(this, arguments);
    };

    sender.db.pool.discard = function internal(props) {
      // eslint-disable-next-line no-param-reassign
      props.path = config.pathPrefix + props.path;
      // eslint-disable-next-line prefer-rest-params
      return oldDiscard.apply(this, arguments);
github destinygg / chat-bot / lib / services / metrics / influx-metrics-reporter.js View on Github external
sender.db.pool.text = function internal(props) {
      // eslint-disable-next-line no-param-reassign
      props.path = config.pathPrefix + props.path;
      // eslint-disable-next-line prefer-rest-params
      return oldText.apply(this, arguments);
    };

    sender.db.pool.discard = function internal(props) {
      // eslint-disable-next-line no-param-reassign
      props.path = config.pathPrefix + props.path;
      // eslint-disable-next-line prefer-rest-params
      return oldDiscard.apply(this, arguments);
    };

    this.reporter = new InfluxMetricReporter({
      sender,
      tags,
      unit: MILLISECOND,
      reportInterval: 30000,
    });

    this.reporter.setLog({
      info: () => {},
      trace: () => {},
      debug: () => {},
      warn: () => {},
      error: () => {},
    });

    this.metrics = {};
    this.registry = new MetricRegistry();
github rstiller / inspector-metrics / examples / express4-multi-process-js / src / metrics.js View on Github external
async function influxReporter (registry, tags) {
  const {
    DefaultSender,
    InfluxMetricReporter
  } = require('inspector-influx')

  const sender = new DefaultSender({
    database: 'express4',
    hosts: [{
      host: '127.0.0.1',
      port: 8086
    }]
  })
  const reporter = new InfluxMetricReporter({
    log: null,
    minReportingTimeout: 30,
    reportInterval: 5000,
    sender
  })

  reporter.setTags(tags)
  reporter.addMetricRegistry(registry)
github rstiller / inspector-metrics / examples / express4-multi-process-js / src / metrics.js View on Github external
async function influxReporter (registry, tags) {
  const {
    DefaultSender,
    InfluxMetricReporter
  } = require('inspector-influx')

  const sender = new DefaultSender({
    database: 'express4',
    hosts: [{
      host: '127.0.0.1',
      port: 8086
    }]
  })
  const reporter = new InfluxMetricReporter({
    log: null,
    minReportingTimeout: 30,
    reportInterval: 5000,
    sender
  })

  reporter.setTags(tags)
  reporter.addMetricRegistry(registry)

  await reporter.start()

  return reporter
}

inspector-influx

InfluxDB metric reporter for nodejs

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis