Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jaeger-tracer

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jaeger-tracer - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

build/ClsManager.d.ts
import { Span } from './interfaces/jaegaer-span.interface';
import { Request, Response } from 'express';
export declare let associateNMSWithReqBeforeGoingNext: (req: any, res: any, next: Function, mainSpan: Span, interceptorMiddleware: Function) => void;
export declare let initiateCLS: (req: Request, res: Response) => void;
export declare let saveToCls: (key: string, value: any) => any;
export declare let getFromCls: (key: string) => any;
export declare let getContext: () => import("continuation-local-storage").Namespace;

12

build/ClsManager.js

@@ -7,9 +7,9 @@ "use strict";

exports.associateNMSWithReqBeforeGoingNext = function (req, res, next, mainSpan, interceptorMiddleware) {
session.run(function () {
session.bindEmitter(req);
session.bindEmitter(res);
session.set(constants_1.constants.mainSpan, mainSpan);
interceptorMiddleware(req, res, next);
});
session.set(constants_1.constants.mainSpan, mainSpan);
interceptorMiddleware(req, res, next);
};
exports.initiateCLS = function (req, res) {
session.bindEmitter(req);
session.bindEmitter(res);
};
exports.saveToCls = function (key, value) {

@@ -16,0 +16,0 @@ return session.set(key, value);

@@ -7,2 +7,3 @@ "use strict";

var tracer_1 = require("./tracer");
var constants_1 = require("./constants");
var FORMAT_HTTP_HEADERS = require('opentracing').FORMAT_HTTP_HEADERS;

@@ -12,2 +13,4 @@ exports.jaegarTracerMiddleWare = function (serviceName, config, options) {

return function (req, res, next) {
ClsManager_1.initiateCLS(req, res);
ClsManager_1.saveToCls(constants_1.constants.tracer, tracer);
var parentSpanContext = tracer.extract(FORMAT_HTTP_HEADERS, req.headers);

@@ -14,0 +17,0 @@ var mainReqSpan = span_1.spanMaker(req.path, parentSpanContext, tracer);

@@ -14,4 +14,2 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var ClsManager_1 = require("./ClsManager");
var constants_1 = require("./constants");
var initJaegerTracer = require('jaeger-client').initTracer;

@@ -37,5 +35,4 @@ exports.initTracer = function (serviceName, config, options) {

var tracer = initJaegerTracer(config, options);
ClsManager_1.saveToCls(constants_1.constants.tracer, tracer);
return tracer;
};
//# sourceMappingURL=tracer.js.map
{
"name": "jaeger-tracer",
"version": "1.0.1",
"version": "1.0.2",
"description": "client library for jaegar to ease out the instrumenting in express and any other backend application in nodejs",

@@ -5,0 +5,0 @@ "main": "build/index.js",

import { createNamespace } from 'continuation-local-storage';
import { constants } from './constants';
import { Span } from './interfaces/jaegaer-span.interface';
import { Request, Response } from 'express';

@@ -19,22 +20,27 @@

// binding the cls to the req
session.run(() => {
// session.run(() => {
// before rerouting just inputing binding the req , and res to the cls to
// be used later to the spans
session.bindEmitter(req);
session.bindEmitter(res);
// before rerouting just inputing binding the req , and res to the cls to
// be used later to the spans
// session.bindEmitter(req);
// session.bindEmitter(res);
// setting the main span to be accessible by all other function whereever we want them
// and also this will always be binded to the existence to that req and res
session.set(constants.mainSpan, mainSpan);
// setting the main span to be accessible by all other function whereever we want them
// and also this will always be binded to the existence to that req and res
session.set(constants.mainSpan, mainSpan);
// just calling the response interceptor middleware to be applied on the response later on
// this middleware should call next inside it automatically
interceptorMiddleware(req, res, next);
// just calling the response interceptor middleware to be applied on the response later on
// this middleware should call next inside it automatically
interceptorMiddleware(req, res, next);
// going to the next middleware normally
// next();
});
// going to the next middleware normally
// next();
// });
}
export let initiateCLS = (req: Request, res: Response) => {
session.bindEmitter(req);
session.bindEmitter(res);
}
export let saveToCls = (key: string, value: any) => {

@@ -41,0 +47,0 @@ return session.set(key, value);

import { Request, Response } from "express-serve-static-core";
import { associateNMSWithReqBeforeGoingNext } from "./ClsManager";
import { associateNMSWithReqBeforeGoingNext, saveToCls, initiateCLS } from "./ClsManager";
import { Config, Options } from "./interfaces/jaeger-client-config.interface";

@@ -7,2 +7,3 @@ import { spanMaker } from "./span";

import { initTracer } from './tracer';
import { constants } from "./constants";
let { FORMAT_HTTP_HEADERS } = require('opentracing');

@@ -29,2 +30,8 @@

// initiating the cls
initiateCLS(req, res);
// saving the tracer in the cls after its initialization
saveToCls(constants.tracer, tracer);
// extract the parent context from the tracer

@@ -31,0 +38,0 @@ let parentSpanContext = tracer.extract(FORMAT_HTTP_HEADERS, req.headers);

@@ -58,5 +58,2 @@ import { saveToCls } from "./ClsManager";

// saving the tracer in the cls after its initialization
saveToCls(constants.tracer, tracer);
return tracer;

@@ -63,0 +60,0 @@ };

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc