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

@risingstack/opentracing-auto

v1.5.2

Published

Out of the box OpenTracing instrumentation for Node.js

Downloads

10

Readme

opentracing-auto

Build Status

Out of the box distributed tracing for Node.js applications with OpenTracing. Support multiple Tracers.

WARNING: experimental library, do not use in production yet

Technologies

Requirements

  • Node.js, >= v8

Getting started

npm install @risingstack/opentracing-auto
// must be in the first two lines of your application
const Instrument = require('@risingstack/opentracing-auto')
const { Tracer } = require('opentracing') // or any OpenTracing compatible tracer like jaeger-client
const tracer1 = new Tracer()
const tracer2 = new Tracer()

const instrument = new Instrument({
  tracers: [tracer1, tracer2]
})

// rest of your code
const express = require('express')
// ...

This package depends on require-in-the-middle and shimmer to monkeypatch tracing information onto the modules listed below. Therefore it is crucial that you require() supported modules after creating the tracing instrument.

If you are using node 8.5+'s experimental module support, you will need to manually hook supported modules:

import Instrument from '@risingstack/opentracing-auto';
import jaeger from 'jaeger-client';
import UDPSender from 'jaeger-client/dist/src/reporters/udp_sender';
import http from 'http';

const instrument = new Instrument({
  tracers: [
    new jaeger.Tracer(
      'my-service-name',
      new jaeger.RemoteReporter(new UDPSender.default({ host: 'my-jaeger-host' })),
      new jaeger.RateLimitingSampler(1),
      {}
    ),
  ],
});

instrument.hookModule(http, 'http');

API

new Instrument({ tracers: [tracer1, tracer2] })

Instrument modules.

  • tracers: Array of OpenTracing compatible tracers
    • required
  • httpTimings: Adds HTTP timings (DNS lookup, Connect, TLS, Time to first byte, Content transfer)
    • default: false

instrument.unpatch()

Unpatch instrumentations

Instrumentations

Example

The example require a running MongoDB and Jaeger.

To start Jaeger and visit it's dashboard:

docker run -d -p5775:5775/udp -p6831:6831/udp -p6832:6832/udp -p5778:5778 -p16686:16686 -p14268:14268 jaegertracing/all-in-one:latest && open http://localhost:16686
npm run example
curl http://localhost:3000
open http://localhost:16686

Jaeger Node.js tracing

HTTP timings

You can enable it with the httpTimings: true

HTTP timings

Debug

Start your application with the DEBUG=opentracing-auto* environment variable.

Feature ideas

  • More database instrumentation: Redis etc.
  • More messaging layer instrumentation: HTTP/2, GRPC, RabbitMQ, Kafka etc.