Rails applies an invariant to incoming requests that the Rack request request_id always has a value. This defaults to the X-Request-ID header, but otherwise a request ID is assigned internally.
@andrew-pickin-epi and @der have asked that this internally assigned request ID is not logged when logging messages via the json-rails-logger. Looking at the code, I think this means accessing the headers array on the incoming request directly, rather than relying on the request_id method. So the thread local variable is only set if the incoming request has an X-Request-Id header.
Rails applies an invariant to incoming requests that the Rack request
request_id
always has a value. This defaults to theX-Request-ID
header, but otherwise a request ID is assigned internally.@andrew-pickin-epi and @der have asked that this internally assigned request ID is not logged when logging messages via the json-rails-logger. Looking at the code, I think this means accessing the
headers
array on the incoming request directly, rather than relying on therequest_id
method. So the thread local variable is only set if the incoming request has anX-Request-Id
header.