Open obenjiro opened 3 months ago
@amje @korvin89 guys, what do you think?
@obenjiro Hey! Sounds good. I suggest you to connect with maintainers of nodekit and expresskit
@resure What do you think about adding handlesome-log-transfer as built-in package for ExpressKit?
I think that in its current state we should not include handsome log transfer
in NodeKit or ExpressKit. However, it could be distributed as a separate library.
We have also met with Alexey and discussed potential ways to further develop this component, so we may reconsider this RFC in the future.
Objective
The problem at hand is the complexity and difficulty in debugging HTTP requests made from a client to a Node.js Express server, especially when these requests pass through multiple middleware layers and backend APIs. This challenge is compounded by the asynchronous nature of Node.js, which makes tracing and logging these requests cumbersome and inefficient. Effective debugging is crucial for identifying and resolving issues, ensuring the reliability and performance of web applications.
Solution Proposal
We propose the creation of a tool named
handsome-log-transfer
that will be integrated with Express and injected into JavaScript. The primary function of this tool is to facilitate debugging of HTTP requests from the client to the Express server and through various middleware to backend APIs. By leveraging Node.js AsyncStorage, we can automatically augment every outgoing HTTP request, providing a functionality akin to a tracing tool.Those traces will be logged to browser console.
In this example you can see that we can trace the reason why client HTTP request for /data get HTTP 500 error. First, we make request for /todos and then trying to go to wrong hostname *.com2 that doesn't exist.
Key Features:
Implementation Steps:
Technical Architecture:
Below is a Mermaid diagram illustrating the high-level architecture of
handsome-log-transfer
.PS: Tool with only work in DEBUG mode to avoid leakage of any private data (like tokens, private session variables)