npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@telemetry-js/publisher-logzio-metrics

v0.2.0

Published

Publish metrics to Logz.io Metrics

Downloads

6

Readme

publisher-logzio-metrics

Publish metrics to Logz.io Metrics.
A telemetry plugin.

npm status node Test JavaScript Style Guide

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 ISO
  • false: 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 with false 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.

reason logo

License

MIT © Vincent Weevers