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

traced-kew

v0.1.4

Published

A promise library compatible with [Medium's kew promises library](https://github.com/Medium/kew) with support added for LightStep OpenTracing instrumentation.

Downloads

17

Readme

traced-kew

A promise library compatible with Medium's kew promises library with support added for LightStep OpenTracing instrumentation.

Compatibility-note: the library implementation currently relies on several LightStep-specific methods and is not compatible with all OpenTracing tracer implementations.

Getting started

npm install --save traced-kew

Initialize the OpenTracing global tracer (the library currently uses the OpenTracing global tracer for all operations):

Tracer.initGlobalTracer(LightStep.tracer({
    access_token   : '{your_access_token}',
    component_name : 'kew-example',
}));

Use the library as you would use the kew library:

import Q from 'traced-kew';

Q.all([
  Q.delay(50),
  Q.delay(20),
]).then(() => {
  console.log('Done!');
});

Use the traced version of the various kew methods to add OpenTracing tracing annotations:

import Q from 'traced-kew';

// Start a span to track the chained promises
let span = Tracer.startSpan('Q.all');
Q.tracedAll(span, [
  Q.tracedDelay('a delay of 50ms', span, 50),
  Q.tracedDelay('a delay of 20ms', span, 20),
]).tracedThen((span) => {
  span.logEvent('The promises have resolved!');
  console.log('Done!');
})
.finish(); // Let the library know the chaining is done

:success_parrot:

Demo

The access_token values in the examples need to be updated to your project's access token, then the following can be run:

make demo-ok    # Makes a trace with only successful operations
make demo-fail  # Makes a trace containing spans with errors

Trace for the resolved promises

demo-ok

Trace for the rejected promises

demo-fail

API

  • Static methods
    • all(promises), tracedAll(span, promises)
    • bindPromise(fn, scope, …boundArgs)
    • defer(), tracedDefer(name, parentSpan)
    • delay(ms), tracedDelay(name, parent, ms)
    • fcall is not yet implemented
    • isPromise is not yet implemented
    • isPromiseLike is not yet implemented
    • ncall is not yet implemented
    • nfcall is not yet implemented
    • reject(reason)
    • resolve(value)
    • spread(promise, fn)
    • stats()
    • allSettled(promises)
    • getNextTickFunction()
    • setNextTickFunction()
  • Instance methods
    • fail(function(reason)), tracedFail(function(span, reason))
    • fin(function), tracedFin(function(span))
    • makeNodeResolver()
    • spread(…args), tracedSpread(span, …args)
    • reject(reason)
    • resolve(value)
    • then(function(result)), tracedThen(function(span, result))
    • finish(function(span))
    • span()

Testing

make test