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

doc-metrix-network

v0.0.1

Published

Provides an API for doc-metrix network performance metrics.

Downloads

3

Readme

doc-metrix-network

NPM version Build Status Coverage Status Dependencies

Provides an API for doc-metrix network performance metrics.

Installation

$ npm install doc-metrix-network

For use in the browser, use browserify.

Usage

To interface with the network metric documentation,

var metrics = require( 'doc-metrix-network' );

The interface has the following methods...

Metrics

Metric centric methods...

metrics.mexists( name )

Checks whether a metric having the provided name is included in the documentation.

metrics.mexists( 'net.bytesRX' );
// returns true

metrics.mexists( 'cpu.utilization' );
// returns false

Note: method is not case sensitive.

metrics.mlist()

Lists all metrics included in the documentation.

metrics.mlist();
// returns an array of metric names

metrics.mfilter( regexp )

Lists all metrics satisfying a regular expression filter.

metrics.mfilter( /Bytes/i );

Note: filtering for metric names is case sensitive. Ignore case /i for case insensitive filtering.

metrics.mget( [filter] )

Returns metric documentation. The provided filter may be a string or a regular expression. If a metric does not have documentation, returns null. To return a single metric's documentation,

metrics.mget( 'net.bytesRX' );
// returns {...}

metrics.mget( 'cpu.utilization' );
// returns null

To return metric documentation matching a filter,

metrics.mget( /Bytes/i );
// returns {...}

To return all metric documentation,

metrics.mget();
// returns {"metric1":{...},"metric2":{...},...}

Note: when the filter is a string, the method is not case sensitive.

Note: when the filter is a regular expression, the method is case sensitive. If case does not matter, ignore case /i;

Devices

Device centric methods...

metrics.dexists( name )

Checks whether a device having the provided name is known to have associated metric documentation.

metrics.dexists( 'eth0' );
// returns true

metrics.dexists( 'cpu0' );
// returns false

metrics.dlist()

Lists all devices known to have associated metric documentation.

metrics.dlist();
// returns an array of device names

Note: the returned list may contain regular expressions. Regular expressions are included to account for platform variability.

metrics.dget( [name] )

Returns metric documentation associated with devices. If a device does not have associated metric documentation, returns null. To return a single device's metric documentation,

metrics.dget( 'eth0' );
// returns {"metric0":{...},"metric1":{...},...}

metrics.dget( 'cpu0' );
// returns null

To return all devices and their associated documentation,

metrics.dget();
// returns {"device0":{...},"device1":{...},...}

Examples

To run the example code from the top-level application directory,

$ node ./examples/index.js

Notes

After running the following commands,

$ npm install
$ npm update

this package, when used as a dependency, will attempt an HTTP request to retrieve the latest documentation from Github.

During development, run the following command to retrieve the latest documentation

$ npm run docs

Tests

Unit

Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:

$ make test

All new feature development should have corresponding unit tests to validate correct functionality.

Test Coverage

This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:

$ make test-cov

Istanbul creates a ./reports/coverage directory. To access an HTML version of the report,

$ open reports/coverage/lcov-report/index.html

License

MIT license.


Copyright

Copyright © 2014. NodePrime.