Created
January 12, 2020 16:25
-
-
Save endeepak/0e2328fd8dd8af5c4a8388a51ebdb5ca to your computer and use it in GitHub Desktop.
NodeJS Request Log Tracing : HTTP Request Wrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('request-promise'); | |
const requestTracing = require('request-tracing'); // Wrapper library to read the tracing information from CLS context | |
const requestPromiseWrapper = async (body) => { | |
const requestBody = Object.assign({}, body); | |
requestBody.headers['X-Tracing-Id'] = requestTracing.getTracingId(); // Same as requestTracingNamespace.get('tracingId'); | |
return request(requestBody); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment