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
From the course: Node.js: Debugging and Performance Tuning
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Why and what should I log?6m 26s
-
Problems with Node.js console6m 1s
-
(Locked)
Implementing Express error pages6m 48s
-
(Locked)
Choosing a logging library5m 40s
-
(Locked)
Adding Winston for Node logging4m 41s
-
(Locked)
Request logging with Morgan6m 39s
-
(Locked)
Correlating requests in logs6m 18s
-
(Locked)
Cross-application request correlation5m 32s
-
(Locked)
Challenge: Cross-application request IDs2m 14s
-
(Locked)
Solution: Cross-application request IDs9m 30s
-
(Locked)
-
-
-