Code Monkey home page Code Monkey logo

jaeger-tracer-node's Introduction

Jaeger Tracer for NodeJS

js-standard-style

Basic Usage

This module automaticaly does most of the work by patching external libraries, such as http, ioredis, mongodb, and sequelize. The only thing that has to be done import this module before all others and configure the tracer.

const jaeger = require('jaeger-tracer-node')

// Other imports

jaeger.configure({
  disable: false,
  probability: 0.001,
  serviceName: 'my-service',
  tags: {
    'my-tag': 'my-value'
  }
})

// Main loop

Advanced Usage

In case there is need for manually creating spans, two approaches exist for referencing the parent.

Notice that the spans need to be propagated in order for the patched libraries to know which is the current span. Also, if your custom code sends requests to other servers, the span can be injected into a carrier for transmission.

Using a span carrier

This carrier can be something similar to an HTTP header or null.

let span = jaeger.startSpan(carrier, 'my-span', {
  'my-tag': 'my-value'
})

span.propagate(() => {
  mySynchronousFunction(request)
})
span.finish()

Using the current span

The current span will never be null, so no check is needed. However, if it is not set, the new span will lack a parent.

let parent = jaeger.currentSpan()
let span = parent.startSpan('my-span')

span.inject(myCarrier)

myFunctionWithCallback(myCarrier, err => {
  span.finish(err)
})

jaeger-tracer-node's People

Contributors

aleksanderllada avatar capella avatar cscatolini avatar ghostec avatar matheuscscp avatar vctandrade avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.