(ns metabase.server.middleware.request-id
  (:require [metabase.config :refer [*request-id*]]))

Attach a unique request ID to the request

(defn wrap-request-id
  [handler]
  (fn [request response raise]
    (binding [*request-id* (random-uuid)]
      (handler (assoc request :request-id *request-id*) response raise))))