fastify-jaeger
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

fastify-jaeger

js-standard-style Lint, Test

Fastify plugin for Jaeger distributed tracing system.

Install

npm install fastify-jaeger

Usage

Require the plugin and register it within Fastify, the pass the following options: { serviceName [, exposeAPI] }

exposeAPI: (true by default) Exposes the Span API, binded to the current request, which allows the user to setTags, and log the current span.

This plugins supports all options and configurations of jaeger-client-node's initTracer method.

  • The options param can be configured via opts.initTracerOpts
  • All other top-level opts will be passed in as the config param.

It uses the logger set to the fastify instance as the tracer logger.

const fastify = require('fastify')()

fastify.register(require('fastify-jaeger'), {
  serviceName: 'my-service-name'
})

fastify.get('/', (req, reply) => {
  reply.send({ hello: 'world' })
})

fastify.listen(3000, err => {
  if (err) throw err
  console.log('Server listening on localhost:', fastify.server.address().port)
})

License

Licensed under MIT.

/fastify-jaeger/

    Package Sidebar

    Install

    npm i fastify-jaeger

    Weekly Downloads

    16

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    12.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • maumercado