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

sweter

v1.0.0

Published

Simple web performance reporter

Downloads

10

Readme

Sweter Build Status

Simple web performance reporter with scheduling and ElasticSearch support. Sweter uses phantomas under the hood and reports timeToFirstByte, domInteractive and domComplete timings.

Installation

npm install -g sweter

Usage

$ sweter --help

  Usage
    sweter <url> [options]

  Example
    sweter allegro.pl --runs 1067

  Options
    --runs       number of tests to be performed
    --timeout    timeout for single test run, defaults to 30s
    --reporter   console (default), elastic, stats or json
    --schedule   schedule in cron format "* * * * * *"
    --daemonize  daemonize a process

  Elastic options
    --elastic-host    elastic host
    --elastic-index   elastic index

Reporters

Console reporter

By default Sweter outputs data to console

$ sweter google.com

Sat, 04 Apr 2015 10:40:01 GMT
  timeToFirstByte: 139
  domInteractive: 293
  domComplete: 664

Stats reporter

$ sweter google.com --reporter stats

{
  "date":"2015-07-29T12:54:20.403Z",
  "timeToFirstByte": { "median":0.25 },
  "domInteractive":  { "median":0.7  },
  "domComplete":     { "median":1.79 }
}

JSON reporter

$ sweter google.com --reporter json

{"timeToFirstByte":329,"domInteractive":610,"domComplete":1557}

Elastic reporter

Sweter can feed Elastic instance

$ sweter google.com \
    --reporter elastic \
    --elastic-host localhost \
    --elastic-index sweter

$ curl http://localhost:9200/sweter/_search
{
  "_index": "sweter",
  "_type": "object",
  "_id": "AUyLZuLrG92aw_Xb4w3P",
  "_score": 1,
  "_source": {
    "timestamp": 1428267917998,
    "metrics": {
      "timeToFirstByte": 365,
      "domInteractive": 764,
      "domComplete": 3890
    }
  }
}

Custom reporters

You can write your own reporter if you want. See https://github.com/msn0/sweter-custom-reporter as an example and use it this way

$ sweter google.com --reporter sweter-custom-reporter

So, assuming your node module name is foo then

$ sweter google.com --reporter foo

If foo requires some additional params then pass them this way

$ sweter google.com \
    --reporter foo \
    --foo-param1 "my param" \
    --foo-param2 777

Examples

Measure google.com performance every day at 1:00AM and send data to ElasticSearch:

$ sweter google.com \
    --runs 1067 \
    --reporter elastic \
    --elastic-host localhost \
    --elastic-index google \
    --schedule "0 0 1 * * *" \
    --daemonize

Measure google.com performance every four hours and log median to file:

$ sweter google.com \
    --runs 600 \
    --reporter stats \
    --schedule "0 0 */4 * * *" >> report

Debugging

$ DEBUG=* sweter google.com

License

Apache-2.0 © Michał Jezierski