@telemetry-js/publisher-logzio-metrics
v0.2.0
Published
Publish metrics to Logz.io Metrics
Downloads
2
Maintainers
Readme
publisher-logzio-metrics
Publish metrics to Logz.io Metrics.
Atelemetry
plugin.
Table of Contents
Usage
const telemetry = require('@telemetry-js/telemetry')()
const logzio = require('@telemetry-js/publisher-logzio-metrics')
telemetry.task()
.collect(..)
.schedule(..)
.publish(logzio, { token: '***' })
Format
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.
Options
token
String, required. Secret token of Logz.io metrics account. Note that metrics accounts and their tokens are separate from log accounts.
resolution
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.
time
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.
type
String, default 'custom'
. Log type for Logz.io to know how to parse documents.
hostname
String, default 'listener.logz.io'
.
port
Number, default 5050
.
Install
With npm do:
npm install @telemetry-js/publisher-logzio-metrics
Acknowledgements
This project is kindly sponsored by Reason Cybersecurity Ltd.
License
MIT © Vincent Weevers