https://github.com/risingstack/jaeger-node
Out of the box distributed tracing for Node.js applications.
https://github.com/risingstack/jaeger-node
jaeger node nodejs opentracing tracing
Last synced: 6 months ago
JSON representation
Out of the box distributed tracing for Node.js applications.
- Host: GitHub
- URL: https://github.com/risingstack/jaeger-node
- Owner: RisingStack
- License: mit
- Created: 2017-06-05T16:19:10.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-01T08:03:59.000Z (over 8 years ago)
- Last Synced: 2025-08-21T01:47:45.407Z (6 months ago)
- Topics: jaeger, node, nodejs, opentracing, tracing
- Language: JavaScript
- Homepage:
- Size: 195 KB
- Stars: 67
- Watchers: 7
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jaeger-node
[](https://travis-ci.org/RisingStack/jaeger-node)
Out of the box distributed tracing for [Node.js](https://nodejs.org) applications.
**WARNING: experimental library, do not use in production yet**
**This library is a higher level wrapper around [opentracing-auto](https://github.com/RisingStack/opentracing-auto), that you should consider to use instead of this library.**
## Technologies
- [async_hooks](https://github.com/nodejs/node/blob/master/doc/api/async_hooks.md)
- [Jaeger](https://uber.github.io/jaeger/)
- [OpenTracing](http://opentracing.io/)
**Requirements**
- Node.js, >= v8
- Jaeger
## Getting started
```sh
npm install @risingstack/jaeger
```
```js
// must be in the first two lines of your application
const Tracer = require('@risingstack/jaeger')
const tracer = new Tracer({
serviceName: 'my-server-2'
})
// rest of your code
const express = require('express')
// ...
```
**To start Jaeger and visit it's dashboard:**
```sh
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
```
## Example
The example require a running MongoDB.
```sh
npm run example
curl http://localhost:3000
open http://localhost:16686
```

## API
### new Tracer(args)
Create a new Tracer and instrument modules.
- `args.serviceName`: Name of your service
- **required**
- example: `'my-service-1'`
- `args.sampler`: Jaeger sampler, see [sampler docs](https://github.com/uber/jaeger-client-node/tree/master/src/samplers)
- *optional*
- default: `new jaeger.RateLimitingSampler(1)`
- `args.reporter`: Jaeger reporter, see [reporter docs](https://github.com/uber/jaeger-client-node/tree/master/src/reporters)
- *optional*
- default: `new jaeger.RemoteReporter(new UDPSender())`
- `args.options`: Jaeger options, see [docs](https://github.com/uber/jaeger-client-node#initialization)
- *optional*
- example: `{ tags: { gitHash: 'foobar' } }`
## Instrumentations
Check out [opentracing-auto instrumentations](https://github.com/RisingStack/opentracing-auto#instrumentations).
## EMSGSIZE and UDP buffer limits
Read more about it in the [Client Libraries](https://github.com/uber/jaeger/blob/master/docs/client_libraries.md#emsgsize-and-udp-buffer-limits) documentation.