Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-83858

Include a "request ID" in log lines

    • Server Programmability

      When I'm searching a log file, usually I'm interested in several events that happened during the same request handler. Could we add a unique "request ID" to tie these together?

      This would be different than the existing "ctx" field, which lets you separate events from different threads, but not from different requests.

      I imagine the implementation would be something like:

      • keep a process-global counter for generating unique IDs
      • add an optional<int> currentRequestId to something (Client? RequestExecutionContext?)
      • when we start handling a request (same place we log "About to run"?), update currentRequestId with a fresh ID
      • look up currentRequestId when we populate log attributes, just like "ctx"
      • clear currentRequestId after we send the response

            Assignee:
            Unassigned Unassigned
            Reporter:
            david.percy@mongodb.com David Percy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: