{"repo":"puzpuzpuz/cls-rtracer","free":true,"listed":false,"github":"https://github.com/puzpuzpuz/cls-rtracer","clone":"git clone https://github.com/puzpuzpuz/cls-rtracer.git","description":"Request Tracer - CLS-based request id generation for Express, Fastify, Koa and Hapi, batteries included","language":"JavaScript","stars":311,"topics":["nodejs","express","koa","cls","continuation-local-storage","request-id","logging","fastify","hapi"],"license":"MIT","category":"analytics","readme_excerpt":"cls-rtracer Request Tracer - Express & Koa middlewares and Fastify & Hapi plugins for CLS-based request id generation, batteries included. An out-of-the-box solution for adding request ids into your logs. Check out this blog post that describes the rationale behind cls-rtracer . Automatically generates a UUID V1 value as the id for each request and stores it in AsyncLocalStorage (CLS core API, see this blog post). Optionally, if the request contains X-Request-Id header, uses its value instead. Allows to obtain the generated request id anywhere in your routes later and use it for logging or any other purposes. Tested and works fine with Express v5, Fastify v2 and v5, Koa v1 and v3, and Hapi v21. Supported Node.js versions cls-rtracer v3 requires Node.js 16.0.0 or newer. How to use it - Step 1 Install: Note for TypeScript users: typings are included. How to use it - Step 2 (Common instructions) Use the middleware (or plugin) provided by the library before the first middleware that needs to have access to request ids. Note that some middlewares, may cause CLS context (i.e. Async Hooks execution path) to get lost. To avoid such issues, you should use any third party middleware that does not need access to request ids before you use this middleware. See issue #20 as an example. How to use it - Step 2 (Express users) Use the middleware provided by the library: Obtain request id in middlewares on the incoming request: You can access the same request id from code that does not have a","default_branch":null,"files":null,"tree":[],"storefront":"/r/puzpuzpuz","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/puzpuzpuz/cls-rtracer/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}