Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于单个请求,我们可以通过在请求开始时使用 consol.log(start) 和在发送响应时使用 console.log(end) 来监控其响应时间。我希望如果对 API 的任何请求长时间挂起(大于 5-10 秒),我应该能够终止请求,返回错误,并记录请求和堆栈跟踪。我怎样才能在应用程序级别做到这一点,而不是为每个请求添加这个 console.log?
在服务器上,我确实有 Nginx。