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

piglet

v0.0.2

Published

Your friendly little restful time series service.

Downloads

14

Readme

piglet

Your friendly little restful time series service.

The Proposal

  • /:id/:type

    • POST
      • Request => Data is a JSON number. Time will be the current time on the server.
  • /:id/:type/:start

    • GET
      • Response => Range is from the given start till current time.

        ?format=json: key is time, value is a number. ?format=<jpeg|png|svg>: Rendered graph of data.

      • Parameters => format=<json|jpeg|png|svg> (defaults to json) height= (defaults to 480) width= (defaults to 640) slice= (see below) (defaults to 1 minute) aggregate=<none|count|sum|mean|median|max|min|Q1|Q2|Q3> (defaults to mean) merge= (defaults to none)

    • POST
      • Request => Data is a JSON number. Time is set to the value in the url.
  • /:id/:type/:start/:stop

    • Same as above but: Range is from the given start to stop time.

Alternation in the URL can be used to select multiple ids and types at a time:

/vm/{cpu,ram,io}/1365472770/1365473070

Time can be in a convient format like that accepted by 'at' (aka timespec):

/vm/{cpu,ram,io}/last monday/last wednesday
/vm/{cpu,ram,io}/last month

All of a given type can be selected with '*':

/vm/*/yesterday

With a limited form of globbing we could also permit matches on a subset of types:

vm/net.*,io.sda{1,2}/last week

That would permit a very nice 'subtype' style where you could have several types for network or io, but also easily select all of them. If merge is specified, then the subtypes under the supplied type (e.g. merge=net) would be recombined into a pseudo-type (e.g. All of the net.* values would be seen as just generic 'net' values).

If a slice is specified, the data is aggregated into fixed size chunks. The midpoint is the time reported for the slice. The aggregation method specifies how the data in a given slice should be combined into a single datapoint.

Responses with JSON will always be canonical/rooted:

{
  "vm": {
    "cpu": {
      "1365472770": 0.20
      ...
    },
    "ram": {...}
    "io": {...}
  }
}

In this way it is consistent for the user to parse responses where they have requested multiple series.

/vm{1,2,3}/cpu,ram/yesterday?slice=10m
{
  "vm1": {
    "cpu": {
      "1365472770": 0.20
      ...
    },
    "ram": {...}
  },
  "vm2": {...},
  "vm3": {...}
}