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

elasticsearch-statsd-backend

v1.1.1

Published

An Elasticsearch backend for statsd

Downloads

2

Readme

elasticsearch-statsd-backend 🔎

Elasticsearch backend for statsd

Overview

This backend allows Statsd to save to Elasticsearch. Supports dynamic index creation and custom index templates.

History

Originally written by Github user rameshpy, this library was created as a feature branch of etsy/statsd. A repository was created as a restructuring of the existing feature branch into a standalone backend repository. This project was then forked and published to npm under elasticsearch-statsd-backend with a complete rewrite. You can find the markkimsal code at [email protected] (the previous repo was never published to npm) and this rewrite from v1.0.0 and onward.

Installation

$ npm install elasticsearch-statsd-backend

Requires node 6+ which is the highest node statsd supports. It has been tested on Elasticsearch 6 and 7.

Configuration

This backend looks for configuration under the elasticsearch key in your statsd config file. The default values are below

{
  backends: [ 'elasticsearch-statsd-backend' /*, 'other backends' */],
	// debug: true,
  elasticsearch: {
    url: 'http://localhost:9200/', // The url of your elasticserach server
    shutdownOnStartupError: false, // process.exit statsd if the templates cannot be created on startup helpful in docker environments
    indexPrefix:'statsd_' // Prefix of the dynamic index to be created
    indexTimestamp: 'day' // hour | day | month  - timestamp specificity for index naming
    counterIndexName: 'counter',
    timerIndexName: 'timer',
    gaugeIndexName: 'gauge',
    setIndexName: 'set',
    counterTemplate: undefined, // JSON object representing an index template
    timerTemplate: undefined, // JSON object representing an index template
    gaugeTemplate: undefined, // JSON object representing an index template
    setTemplate: undefined, // JSON object representing an index template
	}
}

Indexes

By default index creation will look like this. Indexes are only created if they have data.

  • statsd_counter_2019-04-25
  • statsd_timer_2019-04-25
  • statsd_gauge_2019-04-25
  • statsd_set_2019-04-25

This is ${indexPrefix}${typeIndexName}_${indexTimestamp}. The indexTimestamp will use more or less of an UTC ISO string depending on your needs. eg;

  • hour looks like 2019-04-25T16
  • day looks like 2019-04-25
  • months looks like 2019-04

Templates

The default templates use your configuration data to match index created with your prefix and type names. If you supply your own template you'll have to do that manually.

Every index has three fields that are the same.

  • @timestamp which is a date
  • metric which is a text with custom analyser to allow lowercase * searches
  • metric.raw field as type keyword

Timers have a field for every calculated metric, counters, and gauges have a value which is a long type. Sets have a dynamic value field which is an object.

You can see /lib/templates.js for more details.

Contributors wanted!

This library was developed at Bustle. However writing docs and code is a lot of work! Thank you in advance for helping out and keeping projects like this open source.