We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Inter-Process Context

It's important to pass logging context between parts of one app, but we also need to pass context between processes and services over the network.

Request IDs

In a microservices architecture, you'll usually propagate a request ID across services so related logs can be correlated.

2023/10/01 12:34:57 severity="INFO" message="Authentication succeeded" service="auth" user="alice" request_id="ibaev4EiyaiS1Kot"
2023/10/01 12:34:57 severity="INFO" message="request served" service="api" request_id="ibaev4EiyaiS1Kot"

For HTTP services, the easiest way to propagate this ID is with a header like X-Request-ID.

Assignment

Propagate request IDs through headers and logs.

Including the request ID in the response header makes debugging easier – clients can report the ID, and you can search your logs for it.

Restart your server with LINKO_LOG_FILE=linko.access.log set:

LINKO_LOG_FILE=linko.access.log go run .

Run and submit the CLI tests from the root of the Linko repo.