Publish metrics to Logz.io Metrics.
Atelemetry
plugin.
Click to expand
const telemetry = require('@telemetry-js/telemetry')()
const logzio = require('@telemetry-js/publisher-logzio-metrics')
telemetry.task()
.collect(..)
.schedule(..)
.publish(logzio, { token: '***' })
Metrics are grouped by time and tags (known as dimensions in Logz.io) into what Logz.io calls a document. Which looks like this:
{
"type": "custom",
"token": "***",
"@timestamp": 1599221440000,
"metrics": {
"telemetry.beep.count": 26,
"telemetry.boop.count": 81,
},
"dimensions": {
"environment": "test"
}
}
Documents are then sent to Logz.io as NDJSON over TCP. This traffic is not encrypted.
String, required. Secret token of Logz.io metrics account. Note that metrics accounts and their tokens are separate from log accounts.
Expected millisecond interval between repeated metrics. A number or string to be parsed by bruce-millis
, default is 1 second. Metrics are grouped by their time, rounded to the nearest multiple of resolution
.
If the resolution is too small then no grouping will occur, leading to inefficient documents. If the resolution is too large (i.e. more than your schedule interval or summarize window) then metrics - that have the same name and dimensions within that time window - will be overwritten, only sending the last value to Logz.io.
Format of the @timestamp
field. The right choice depends on how your Logz.io account is configured to parse timestamps. Can be one of:
'ms'
: unix timestamp in milliseconds (default)'iso'
: simplified extended ISOfalse
: don't add a@timestamp
field, in which case metrics take the time at which they're received by Logz.io. If you're unsure which format to use, start withfalse
and inspect raw logs in Logz.io to see which format Logz.io itself adds. Be aware that Logz.io silently drops documents that have an unexpected format.
String, default 'custom'
. Log type for Logz.io to know how to parse documents.
String, default 'listener.logz.io'
.
Number, default 5050
.
With npm do:
npm install @telemetry-js/publisher-logzio-metrics
This project is kindly sponsored by Reason Cybersecurity Ltd.
MIT © Vincent Weevers