0.2.1 • Published 1 year ago

@coralogix/statsd-backend v0.2.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

statsd-coralogix-backend

License: MIT npm

node

A plugin to connect StatsD to Coralogix.

Coralogix documentation can be found here.

Breaking change notice

  • In version 0.1.* we were calculating _total for counters as rate per sedonds. This was fixed in 0.2.0 where we added internal acumulator for _total of counters and we do report the metric correctly.

Configuration

module.export: {
    // You can get it from coralogix UI at `/#/settings/send-your-data`
    privateKey: "****FILL_ME_IN****",
    apiHost: "https://ingress.coralogix.com/prometheus/v1",
    // Your metrics will be prefixed by this prefix
    prefix: "test_prefix",
    // Coralogix specific label that will be added to all metrics
    applicationName: "test_application",
    // Coralogix specific label that will be added to all metrics
    subsystemName: "test_subsystem",
    // For controlling number of seconds for which we accumulate counter totals before droping them,
    //   this is here to not leak memory with infinite number of metrics kept there. Defaults to 3600.
    // Generally it should be lot higher than you flush_interval.
    totalsAccumulatorTtlSeconds: 3600,
    // Mappings used to define histogram buckets and whatnot
    mappings: {
      timer_test: {
        histogram_options: { buckets: [50, 100, 250, 500, 1000] },
        // Any additional labels for specific metric
        labels: { job: 'test_job' }
      },
      timer_test_2: {
        histogram_options: { buckets: [50, 100, 250, 500, 1000] }
      }
    }
  }

Additional labels on metrics without config

This would end up adding labels

  • with name tag_1and value value_1
  • with name tag_2and value value_2
echo "timer_test:65|ms|#tag_1:value,tag_2:value_2" | /usr/bin/nc -u -w0 127.0.0.1 8125

How to install the backend

cd /path/to/statsd-dir
npm install @coralogix/statsd-backend

How to enable the backend

Add statsd-coralogix-backend to your list of StatsD backends:

backends: ["@coralogix/statsd-backend"]

Full config example

module.exports = {
  deleteIdleStats: true,
  deleteGauges: true,
  deleteTimers: true,
  deleteCounters: true,
  port: 8125,
  backends: ["@coralogix/statsd-backend"],
  coralogix: {
    privateKey: "****FILL_ME_IN****",
    apiHost: "https://ingress.coralogix.com/prometheus/v1",
    prefix: "test_prefix",
    applicationName: "test_application",
    subsystemName: "test_subsystem",
    totalsAccumulatorTtlSeconds: 3600,
    mappings: {
      timer_test: {
        histogram_options: { buckets: [50, 100, 250, 500, 1000] },
        labels: { job: 'test_job' }
      },
      timer_test_2: {
        histogram_options: { buckets: [50, 100, 250, 500, 1000] }
      }
    }
  }
}