From the course: Node.js: Debugging and Performance Tuning

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Solution: Cross-application request IDs

Solution: Cross-application request IDs

From the course: Node.js: Debugging and Performance Tuning

Start my 1-month free trial

Solution: Cross-application request IDs

(light music) - [Instructor] Here's my solution to add cross application transaction tracing to the entire Rock.Paper.Scissors application. This is an opportunity to compare approaches and development styles. All right here we go. The first thing we're gonna do is add express requestId and requestLogger to servers, games, app.js. So let's open it up, servers, games, app.js. We've actually already done this work in players, so let's go take a look. There's players app.js and there's the require statements. So let's paste those in. And let's look back at the use statements and copy those. There's the requestLogger and expressRequestId and there's the use statements, perfect. And actually if we compare the two files they're exactly the same. The next thing that we're going to do is log the port when the server starts up. So we're gonna add the logger to servers games index and servers players index. Let's open those files. We can close apps and open up the indexes. We want both of them…

Contents