jaeger-client-utility

1.0.1 • Public • Published

jaeger-client-utility

This is wrapper for jaeger-client for easy use and implement

Install

npm i -s jaeger-client-utility opentracing

Example 1

This example will show how to use jaeger to tracing event in service

import jaegerClient from 'jaeger-client-utility'
 
jaegerClient.init({ serviceName: 'test-jeager-wrapper' })
 
const span = jaegerClient.startSpan('test')
 
//do something in services
 
span.finish()

After running servicer tracing data will send to Jaeger's server

See more information here

Example 2

This example will show how to trace multiple services

service-1

import jargerClient from 'jaeger-client-utility'
import { FORMAT_HTTP_HEADERS } from 'opentracing'
 
jaegerClient.init({ serviceName: 'test-service-1' })
 
const span = jaegerClient.startSpan('service1')
 
//do something in services and send span to next service
 
jaegerClient.inject(FORMAT_HTTP_HEADERS, header)
 
// send span with header to another services
 
span.finish()

service-2

import jargerClient from 'jaeger-client-utility'
import { FORMAT_HTTP_HEADERS } from 'opentracing'
 
jaegerClient.init({ serviceName: 'test-service-2' })
 
const span = jaegerClient.startSpan('service2' {
  isChild: {
    format: FORMAT_HTTP_HEADERS,
    injectData: payload
  }
})
 
//do something in services
 
span.finish()

This code wiil start parent span from service-1 and make service-2 span as a child of service-1

See more infomation about span here

/jaeger-client-utility/

    Package Sidebar

    Install

    npm i jaeger-client-utility

    Weekly Downloads

    43

    Version

    1.0.1

    License

    ISC

    Unpacked Size

    12.7 kB

    Total Files

    10

    Last publish

    Collaborators

    • nv4re
    • true-e-logisctics-admin
    • dream07312
    • kazekun
    • tosbodes
    • boshido
    • jokergn
    • bossbossk20
    • doctoraod