jaeger-tracer
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -5,3 +5,3 @@ export declare let initTracer: (serviceName: string, config?: import("./interfaces/jaeger-client-config.interface").Config, options?: import("./interfaces/jaeger-client-config.interface").Options) => import("./interfaces/jaegar-tracer.interface").Tracer; | ||
export declare let spanMaker: (name: string, parentContext: import("./interfaces/jaegaer-span.interface").SpanContext | null, tracer: import("./interfaces/jaegar-tracer.interface").Tracer) => import("./interfaces/jaegaer-span.interface").Span; | ||
export declare let jaegarTracerMiddleware: (serviceName: string, config?: import("./interfaces/jaeger-client-config.interface").Config | undefined, options?: import("./interfaces/jaeger-client-config.interface").Options | undefined) => (req: import("express-serve-static-core").Request, res: import("express-serve-static-core").Response, next: Function) => void; | ||
export declare let jaegarTracerMiddleware: (http: any, serviceName: string, config?: import("./interfaces/jaeger-client-config.interface").Config | undefined, options?: import("./interfaces/jaeger-client-config.interface").Options | undefined) => (req: import("express-serve-static-core").Request, res: import("express-serve-static-core").Response, next: Function) => void; | ||
export declare let getContext: () => import("continuation-local-storage").Namespace; | ||
@@ -8,0 +8,0 @@ export declare let unirestWrapper: <T extends { |
import { Request, Response } from "express-serve-static-core"; | ||
import { Config, Options } from "./interfaces/jaeger-client-config.interface"; | ||
export declare let jaegarTracerMiddleWare: (serviceName: string, config?: Config | undefined, options?: Options | undefined) => (req: Request, res: Response, next: Function) => void; | ||
export declare let jaegarTracerMiddleWare: (http: any, serviceName: string, config?: Config | undefined, options?: Options | undefined) => (req: Request, res: Response, next: Function) => void; |
@@ -11,3 +11,3 @@ "use strict"; | ||
var session = continuation_local_storage_1.getNamespace(constants_1.constants.clsNamespace); | ||
exports.jaegarTracerMiddleWare = function (serviceName, config, options) { | ||
exports.jaegarTracerMiddleWare = function (http, serviceName, config, options) { | ||
var tracer = tracer_1.initTracer(serviceName, config, options); | ||
@@ -21,3 +21,3 @@ var middleware = function (req, res, next) { | ||
var responseInterceptor = spanDataSetter_1.setResSpanData(req, res, mainReqSpan); | ||
spanDataSetter_1.putParentHeaderInOutgoingRequests(tracer, mainReqSpan); | ||
spanDataSetter_1.putParentHeaderInOutgoingRequests(http, tracer, mainReqSpan); | ||
ClsManager_1.associateNMSWithReqBeforeGoingNext(req, res, next, mainReqSpan, responseInterceptor); | ||
@@ -24,0 +24,0 @@ }); |
@@ -6,2 +6,2 @@ import { Request, Response } from "express"; | ||
export declare let setResSpanData: (req: Request, res: Response, span: Span) => any; | ||
export declare let putParentHeaderInOutgoingRequests: (tracer: Tracer, span: Span) => void; | ||
export declare let putParentHeaderInOutgoingRequests: (http: any, tracer: Tracer, span: Span) => void; |
@@ -13,14 +13,5 @@ "use strict"; | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var express_mung_1 = require("express-mung"); | ||
var Tags = require('opentracing').Tags; | ||
var http = __importStar(require("http")); | ||
var https = __importStar(require("https")); | ||
var requestWrappers_1 = require("./requestWrappers"); | ||
@@ -64,8 +55,5 @@ exports.setReqSpanData = function (req, res, span) { | ||
}; | ||
exports.putParentHeaderInOutgoingRequests = function (tracer, span) { | ||
exports.putParentHeaderInOutgoingRequests = function (http, tracer, span) { | ||
var headers = requestWrappers_1.getInjectHeaders(tracer, span); | ||
var httpModule = http; | ||
var httpsModule = https; | ||
var oldHttpRequest = httpModule.request; | ||
var oldHttpsRequest = httpsModule.request; | ||
var oldHttpRequest = http.request; | ||
var newRequestHttp = function () { | ||
@@ -77,17 +65,7 @@ var args = []; | ||
if (args[0] && args[0]['headers']) | ||
args[0]['headers'] = __assign({}, args[0]['headers'], headers); | ||
args[0]['headers'] = __assign({}, args[0]['headers'] || {}, headers || {}); | ||
return oldHttpRequest.apply(void 0, args); | ||
}; | ||
var newRequestHttps = function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
if (args[0] && args[0]['headers']) | ||
args[0]['headers'] = __assign({}, args[0]['headers'], headers); | ||
return oldHttpsRequest.apply(void 0, args); | ||
}; | ||
httpModule.request = newRequestHttp; | ||
httpsModule.request = newRequestHttps; | ||
http.request = newRequestHttp; | ||
}; | ||
//# sourceMappingURL=spanDataSetter.js.map |
{ | ||
"name": "jaeger-tracer", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"description": "client library for jaegar to ease out the instrumenting in express and any other backend application based on express in nodejs", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -40,2 +40,2 @@ import { createNamespace, Namespace, getNamespace } from 'continuation-local-storage'; | ||
return session; | ||
} | ||
} |
@@ -31,3 +31,2 @@ import { getContext as gc } from './ClsManager'; | ||
/** | ||
@@ -34,0 +33,0 @@ * exporting the wrappers |
import { getNamespace } from 'continuation-local-storage'; | ||
import { Request, Response } from "express-serve-static-core"; | ||
import { associateNMSWithReqBeforeGoingNext, saveToCls } from "./ClsManager"; | ||
import { associateNMSWithReqBeforeGoingNext, saveToCls, getFromCls } from "./ClsManager"; | ||
import { constants } from "./constants"; | ||
@@ -16,3 +16,3 @@ import { Config, Options } from "./interfaces/jaeger-client-config.interface"; | ||
*/ | ||
export let jaegarTracerMiddleWare = function (serviceName: string, config?: Config, options?: Options) { | ||
export let jaegarTracerMiddleWare = function (http: any, serviceName: string, config?: Config, options?: Options) { | ||
@@ -45,3 +45,3 @@ // initiating the tracer outside the middleware so we dont have to initiate it everytime a request comes | ||
// monkey patch http and https modules to put the headers inside | ||
putParentHeaderInOutgoingRequests(tracer, mainReqSpan); | ||
putParentHeaderInOutgoingRequests(http, tracer, mainReqSpan); | ||
@@ -48,0 +48,0 @@ // calling the cls manager and after that running the response interceptor inside it |
@@ -67,13 +67,10 @@ import { Request, Response } from "express"; | ||
export let putParentHeaderInOutgoingRequests = (tracer: Tracer, span: Span) => { | ||
export let putParentHeaderInOutgoingRequests = (http: any, tracer: Tracer, span: Span) => { | ||
let headers = getInjectHeaders(tracer, span); | ||
let httpModule: any = http; | ||
let httpsModule: any = https; | ||
let oldHttpRequest: any = httpModule.request; | ||
let oldHttpsRequest: any = httpsModule.request; | ||
let oldHttpRequest: any = http.request; | ||
let newRequestHttp = function (...args: any[]) { | ||
if (args[0] && args[0]['headers']) | ||
args[0]['headers'] = { ...args[0]['headers'], ...headers }; | ||
args[0]['headers'] = { ...args[0]['headers'] || {}, ...headers || {} }; | ||
@@ -83,11 +80,3 @@ return oldHttpRequest(...args); | ||
let newRequestHttps = function (...args: any[]) { | ||
if (args[0] && args[0]['headers']) | ||
args[0]['headers'] = { ...args[0]['headers'], ...headers }; | ||
return oldHttpsRequest(...args); | ||
} | ||
httpModule.request = newRequestHttp; | ||
httpsModule.request = newRequestHttps; | ||
http.request = newRequestHttp; | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
0
75453
1041