function request(req, {tracer, serviceName, remoteServiceName}) { this.instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return tracer.scoped(() => { const reqWithHeaders = this.instrumentation.recordRequest(req, req.path, getRequestMethod(req)); this.traceId = tracer.id; return reqWithHeaders; }); }
function wrapRequest(request, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return request.defaults((options, callback) => tracer.scoped(() => { const method = options.method || 'GET'; const url = options.uri || options.url; const wrappedOptions = instrumentation.recordRequest(options, url, method); const traceId = tracer.id; const recordResponse = (response) => { tracer.scoped(() => { instrumentation.recordResponse(traceId, response.statusCode); }); }; const recordError = (error) => { tracer.scoped(() => { instrumentation.recordError(traceId, error); }); }; return request(wrappedOptions, callback) .on('response', recordResponse) .on('error', recordError); })); }
function wrapFetch(fetch, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return function zipkinfetch(input, opts = {}) { return new Promise((resolve, reject) => { tracer.scoped(() => { const url = (typeof input === 'string') ? input : input.url; const method = opts.method || 'GET'; const zipkinOpts = instrumentation.recordRequest(opts, url, method); const traceId = tracer.id; fetch(url, zipkinOpts).then((res) => { tracer.scoped(() => { instrumentation.recordResponse(traceId, res.status); }); resolve(res); }).catch((err) => { tracer.scoped(() => { instrumentation.recordError(traceId, err); }); reject(err); }); }); }); }; }
function wrapGot(got, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName});
serviceName = _ref.serviceName, remoteServiceName = _ref.remoteServiceName; var instrumentation = new Instrumentation.HttpClient({ tracer: tracer, serviceName: serviceName,
this.instrumentation = new _zipkin.Instrumentation.HttpClient({ tracer: tracer, remoteServiceName: remoteServiceName
function wrapAxios(axios, options = {}) { const {tracer} = options; const instrumentation = new Instrumentation.HttpClient(options); const zipkinRecordRequest = config => tracer.scoped(() => { const newConfig = instrumentation.recordRequest(
const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName});
function request(req, {tracer, serviceName, remoteServiceName}) { this.instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return tracer.scoped(() => { const reqWithHeaders = this.instrumentation.recordRequest(req, req.path, getRequestMethod(req)); this.traceId = tracer.id; return reqWithHeaders; }); }
function wrapRequest(request, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return request.defaults((options, callback) => tracer.scoped(() => { const method = options.method || 'GET'; const url = options.uri || options.url; const wrappedOptions = instrumentation.recordRequest(options, url, method); const traceId = tracer.id; const recordResponse = (response) => { tracer.scoped(() => { instrumentation.recordResponse(traceId, response.statusCode); }); }; const recordError = (error) => { tracer.scoped(() => { instrumentation.recordError(traceId, error); }); }; return request(wrappedOptions, callback) .on('response', recordResponse) .on('error', recordError); })); }
function wrapFetch(fetch, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName}); return function zipkinfetch(input, opts = {}) { return new Promise((resolve, reject) => { tracer.scoped(() => { const url = (typeof input === 'string') ? input : input.url; const method = opts.method || 'GET'; const zipkinOpts = instrumentation.recordRequest(opts, url, method); const traceId = tracer.id; fetch(url, zipkinOpts).then((res) => { tracer.scoped(() => { instrumentation.recordResponse(traceId, res.status); }); resolve(res); }).catch((err) => { tracer.scoped(() => { instrumentation.recordError(traceId, err); }); reject(err); }); }); }); }; }
function wrapAxios(axios, options = {}) { const {tracer} = options; const instrumentation = new Instrumentation.HttpClient(options); const zipkinRecordRequest = config => tracer.scoped(() => { const newConfig = instrumentation.recordRequest(
function wrapGot(got, {tracer, serviceName, remoteServiceName}) { const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName});
const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName});