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

nogger-node-adapter

v0.5.3

Published

nogger - the node.js logger - node apdapter

Downloads

25

Readme

nogger - node.js logger and monitor

This is an adapter for node.js to use nogger. It allows to export logs and metrics about the server like cpu and memory consumption. More on nogger at the main repository: https://github.com/paul-em/nogger

Getting started

Install the module with: npm install nogger-node-adapter --save In your project you simply include and initialize it by passing the config. var nogger = require('nogger-node-adapter').init(config); For the options in the config see the config part.

Custom Metrics

To use custom metrics you simply access objects from var metrics = nogger.metrics;

Static

The static metrics allows you to log a text or numbers you don't want to visualize in any chart.

Here is an example:

var staticMetric = new nogger.metrics.Static(function(){
    return {
        "TestStatic" : "This is a text that will appear on the page"
    }
});

This will look like this on the dashboard:

Nogger Screenshot

Arguments:

  • val - the value to log. This can be a function that returns the value.
  • interval - interval in ms how often the value should be updated

Options:

staticMetric.getData() // returns the Data
staticMetric.update() // triggers an update

Counter

Counter for incrementing and decrementing numbers and showing this in a graph.

Here is an example:

var counter = new nogger.metrics.Counter('TestCounter');
counter.inc();
counter.dec();

This will look like this on the dashboard:

Nogger Screenshot

Arguments:

  • name - the name that should appear as headline
  • interval - interval in ms how often the value should be updated in the database

Options:

counter.inc() // increments the value
counter.dec() // decrements the value
counter.getData() // returns the Data
counter.update() // triggers an update

Meter

Meter for only upwards counting objects and visualising this in a graph.

Here is an example:

var meter = new nogger.metrics.Meter('TestMeter');
meter.mark();

This will look like this on the dashboard:

Nogger Screenshot

Arguments:

  • name - the name that should appear as headline
  • interval - interval in ms how often the value should be updated in the database

Options:

meter.mark() // increments the value
meter.getData() // returns the Data
meter.update() // triggers an update

Histogram

Histogram allows to use different values each time. It is also allowed to combine different data model in one histogram.

Here is an example:

var histogram = new nogger.metrics.Histogram('TestHistogram2', ['alphaVal', 'betaVal'], function(){
    return [
        alphaVal,
        betaVal
    ];
});

This will look like this on the dashboard:

Nogger Screenshot

Arguments:

  • name - the name that should appear as headline
  • labels - the label(s) of the value(s)
  • val - can be a value or a function that returns one or multiple values in form of an array
  • interval - interval in ms how often the value should be updated in the database

Options:

histogram.getData() // returns the Data
histogram.update() // triggers an update

Timer

This class allows you to measure time in nanoseconds. The mean, max and min value in interval is stored.

Here is an example:

var timer = new nogger.metrics.Timer('TestTimer');
timer.start();
timer.end();

This will look like this on the dashboard:

Nogger Screenshot

Arguments:

  • name - the name that should appear as headline
  • interval - interval in ms how often the value should be updated in the database

Options:

timer.start() // starts the timer
timer.end() // stops the timer
timer.getData() // returns the Data
timer.update() // triggers an update
timer.runnning // is true or false

Config

These are the default config options that can be overwritter


    rotate: 'daily', // how often a new logFile should be generated
    timezoneOffset: -60, // offset to your local timezone
    maxLogLength: 250, // length of the string after it should be replaced with '...'
    redisIP: '127.0.0.1', // ip of Redis database - preferably on your server
    redisPort: 6379, // port of Redis database - 6379 is the default port for Redis
    redisMetricsDb: 0, // Redis database where all metrics are saved
    redisLogsDb: 1 // Redis database where all logs are saved

License

Copyright (c) 2014 Paul Em. Licensed under the MIT license.