How to use the jaeger-client.RemoteReporter function in jaeger-client

To help you get started, we’ve selected a few jaeger-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github up1 / microservice-workshop / 08-tracing / service1.js View on Github external
'use strict'

const express = require('express')
const request = require('request-promise-native')
const opentracing = require('opentracing')
const jaeger = require('jaeger-client')

// Using UDP
const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender').default

const app = express()
const port = process.env.PORT || 3002

// Tracer
const udpSender = new UDPSender()
const reporter = new jaeger.RemoteReporter(udpSender)
const sampler = new jaeger.RateLimitingSampler(1)
const tracer = new jaeger.Tracer('service 1', reporter, sampler)

app.get('/', (req, res) => {
  const span = tracer.startSpan('http_server')
  span.setTag(opentracing.Tags.HTTP_URL, `${req.protocol}://${req.hostname}${req.originalUrl}`)
  span.setTag(opentracing.Tags.HTTP_METHOD, req.method)
  span.setTag('request_path', req.route.path)
  span.setTag('request_id', req.headers['x-request-id'])

  const requestOptions = {
    headers: { 'trace-span-context': span.context().toString() },
    json: true
  }

  Promise.all([
github up1 / microservice-workshop / 08-tracing / service2.js View on Github external
'use strict'

const express = require('express')
const opentracing = require('opentracing')
const jaeger = require('jaeger-client')
const request = require('request-promise-native')

// Using UDP
const UDPSender = require('jaeger-client/dist/src/reporters/udp_sender').default

const app = express()
const port = process.env.PORT || 3003

// Tracer
const udpSender = new UDPSender()
const reporter = new jaeger.RemoteReporter(udpSender)
const sampler = new jaeger.RateLimitingSampler(1)
const tracer = new jaeger.Tracer('service 2', reporter, sampler)

app.get('/site/:site', (req, res) => {
  const spanContext = jaeger.SpanContext.fromString(req.headers['trace-span-context'])
  const span = tracer.startSpan('http_server', {
    childOf: spanContext
  })
  span.setTag(opentracing.Tags.HTTP_URL, `${req.protocol}://${req.hostname}${req.originalUrl}`)
  span.setTag(opentracing.Tags.HTTP_METHOD, req.method)
  span.setTag('request_path', req.route.path)
  span.setTag('request_id', req.headers['x-request-id'])

  const requestOptions = {
    headers: { 'trace-span-context': span.context().toString() },
    json: true
github vulcainjs / vulcain-corejs / src / instrumentations / trackers / JaegerInstrumentation.ts View on Github external
static create() {
        let jaegerAddress = DynamicConfiguration.getPropertyValue("jaeger");
        if (jaegerAddress) {
            if (!jaegerAddress.startsWith("http://")) {
                jaegerAddress = "http://" + jaegerAddress;
            }
            if (!/:[0-9]+/.test(jaegerAddress)) {
                jaegerAddress = jaegerAddress + ':9411';
            }

            const sender = new UDPSender();
            const tracer = new jaeger.Tracer(Service.fullServiceName,
                new jaeger.RemoteReporter(sender),
                new jaeger.RateLimitingSampler(1));

            return new JaegerInstrumentation(tracer);
        }
        return null;
    }