Skip to content

Trace a Scan by Request ID

Run the Trace a Scan by Request ID MicroSim Fullscreen

About This MicroSim

A member writes in: their scan around 9:14 this morning says the photo search was not checked. Why?

The log below holds twelve lines from three requests that ran at the same moment. Read in order, the lines mix together. Read by request ID, one request's lines tell a complete story from start to finish. This is request path tracing: follow one request through every part of the app it touched.

The trap is the red line. Entry 12 is at error level, and it is about a check that was not checked. But it belongs to a different member's scan. The line that explains this member's problem is a warning. The log data is illustrative and matches the worked example in the chapter: scan s-551, request r-7f3a and a 10-second timeout.

How to Use

  1. Read the member's message, then the twelve log lines.
  2. Answer question 1: which request ID belongs to scan s-551? Pick it from the list and press Check answer.
  3. The filter unlocks. Choose Only r-7f3a to hide every other request's lines.
  4. Answer question 2 by clicking the log line that explains the gap, or by picking it from the list.
  5. Answer question 3: which part of the request path failed?
  6. Each question allows two tries. After the second wrong try, the sim shows the answer and why.
  7. When you finish, the path of request r-7f3a appears as four steps. Click a step to find its line in the log.

Iframe Embed Code

You can add this MicroSim to any web page by adding this to your HTML:

<iframe src="https://arunbatchu.github.io/good-enough-engineering/sims/trace-scan-by-request-id/main.html"
        height="624px"
        width="100%"
        scrolling="no"></iframe>

Lesson Plan

Grade Level

Adult professional (Good Enough Engineering)

Duration

10-15 minutes

Prerequisites

Logging, log levels, structured logging, request IDs, request path tracing, the "not checked" result and timeouts (Chapters 9 and 12).

Activities

  1. Exploration (3 min): Read the log unfiltered. Try to say which lines belong to scan s-551 before using the filter.
  2. Guided Practice (7 min): Answer the three questions. Use the filter after question 1 and notice how many lines disappear.
  3. Assessment (5 min): Explain in two sentences why entry 12 is not the cause, and why entry 11 finishing normally does not mean nothing went wrong.

Assessment

  • All three questions correct with no more than one wrong try in total.
  • Can explain why the error-level line is not always the cause.
  • Can name the part of the path that failed and the entry that shows it.

References

  1. Chapter 12: Errors, Logs and Knowing What Happened - the chapter this sim belongs to, including the worked example of logging one scan.
  2. W3C Trace Context - the web standard for passing a request's identity between services in a header.