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 🙏

© 2026 – Pkg Stats / Ryan Hefner

async-tracer

v0.6.1

Published

Trace all async operations, output as newline delimited JSON logs, with minimal overhead.

Downloads

237

Readme

async-tracer

Trace all async operations, output as newline delimited JSON logs, with minimal overhead.

Build Status

Supports

Node v4 to v6

Usage

Write to a stream

require('async-tracer')(process.stderr)

Write to a path

require('async-tracer')('/var/async.' + process.pid + '.log')

Write to a file handle

require('async-tracer')(1) // 1 is STDOUT, default
require('async-tracer')() //same thing

API

require('async-tracer') => (WritableStream, opts) => {enable, disable}
require('async-tracer') => (String: path, ops) => {enable, disable}
require('async-tracer') => (Number: handle, opts) => {enable, disable}

Interface

enable

Start tracing (will start automatically if autostart option is true)

disable

Stop all tracing

Opts

autostart [default: true] Boolean

Begin tracing immediately

append [default: false] Boolean

Only applies to when a path is supplied, opens file with a flag instead of w flag.

prefix [default: undefined] Object

Additional data to attach to the beginning of each log message.

suffix [default: undefined] Object

Additional data to attach to the end of each log message.

stacks [default: false] Boolean or Number

If true then include an array of call sites in each init log, as the stack property. The stack array takes the following form:

["functionName:fileName:lineNum:colNum"]

If set to a number, (from 1 to Infinity) stacks will also determine the maximum amount of frames to capture for the log (defaults to Infinity if true).

contexts [default: false] Boolean

Supply the operations context in the pre and post logs as the ctx property. The context is an exposed C object that holds state for the async op.

Benchmarks

Overhead of using async-tracer is about 25%.

npm run benchmark

With tracing

Running 10s test @ http://localhost:3000
10 connections with 10 pipelining factor

Stat         Avg      Stdev     Max
Latency (ms) 0.23     0.8       54
Req/Sec      33283.64 2291.73   35135
Bytes/Sec    3.7 MB   250.51 kB 3.93 MB

Without tracing

Running 10s test @ http://localhost:3000
10 connections with 10 pipelining factor

Stat         Avg      Stdev     Max
Latency (ms) 0.13     0.44      33
Req/Sec      45426.91 1279.75   46303
Bytes/Sec    5.06 MB  150.72 kB 5.24 MB

Overhead of turning on tracing with async_wrap is around 8%, so the net overhead is 17%, mostly this is the cost of writing to a stream.

Benchmarking Options

The cost of turning stacks and contexts options on can also be determined with:

npm run benchmark-options

Overhead of enabling context is surprisingly low, 4580k reqs without contexts 4370k reqs with context - about 5% overhead (profiled on Node 6.1.0, Mac OS X 2013, 2.6ghz i7, 16gb).

However, YMMV based on real world usage. Another consideration of logging contexts is the log file size (although compression is likely to be quite effective).

Overhead of enabling stacks is roughly the same as for enabling contexts.

Example

var http = require('http')
require('async-tracer')()

http.createServer(function (req, res) {
  res.end('hello world')
}).listen(3000)
curl http://localhost:3000

Test

npm test

License

MIT

Acknowledgements

Sponsored by nearForm