One log line or three?
transcript
A web client is flaky. It fails twice. Then it works on the third try. You wrap it with a retry, and with logging. How many log lines do you get? It depends who is outside.
Put logging on the outside. It calls the retry. The retry hides the two failures. Logging sees one call. One call, one answer. One line: ok.
Now put logging on the inside. The retry calls it every attempt. Timeout. Timeout. Then success. Logging saw every attempt. Three lines.
Here is the log with logging inside. Timeout. Timeout again. The retry tries once more. Then it works. One request, three lines.
So for one request, you get one line, or three. Same client. Same two failures. Only the order changed.
The outer wrapper sees the call, once. The inner wrapper sees every attempt. Pick the order for the question you want answered.
Full breakdown in the lecture.