{"id":32180541,"url":"https://github.com/ejschoen/ring-correlation-id","last_synced_at":"2025-10-21T22:03:25.557Z","repository":{"id":65209264,"uuid":"193369794","full_name":"ejschoen/ring-correlation-id","owner":"ejschoen","description":"Wrap clj-http requests and ring handlers and responses with correlation ids for use in distributed systems.","archived":false,"fork":false,"pushed_at":"2025-05-10T22:21:18.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T22:00:56.414Z","etag":null,"topics":["clj-http","clojure","ring","timbre"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ejschoen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-23T16:16:50.000Z","updated_at":"2025-05-24T11:39:28.000Z","dependencies_parsed_at":"2024-11-18T08:37:56.050Z","dependency_job_id":null,"html_url":"https://github.com/ejschoen/ring-correlation-id","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.125,"last_synced_commit":"358538b8a65012b24c66d57dbe6b8ec8be2d28d1"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ejschoen/ring-correlation-id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejschoen%2Fring-correlation-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejschoen%2Fring-correlation-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejschoen%2Fring-correlation-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejschoen%2Fring-correlation-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ejschoen","download_url":"https://codeload.github.com/ejschoen/ring-correlation-id/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ejschoen%2Fring-correlation-id/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280341244,"owners_count":26314177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clj-http","clojure","ring","timbre"],"created_at":"2025-10-21T22:01:24.377Z","updated_at":"2025-10-21T22:03:25.547Z","avatar_url":"https://github.com/ejschoen.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ring-correlation-id\n\nA Ring-compatible Clojure library for correlation id middleware, to aid in tracing activity in a distributed system.\n\n## Usage\n\n```clojure\n(use '[ring.middleware.correlation-id :as r-id])\n;; For clj-http, provides an additional-middleware function the creates or conveys the current\n;; correlation id:\n(use '[clj-http.client :as http])\n(use '[clj-http.middleware.correlation-id :as c-id])\n\n;; For Ring: r-id/wrap-correlation-id ensures a :correlation-id header, and binds \n;; ring.middleware.correlation-id/*correlation-id*.\n;; Also sets Timbre *context* to {:correlation-id *correlation-id*}, \n;; so that the correlation id is natively accessible to appenders.\n;; c-id/ring-wrap-correlation-id adds additional middleware to clj-http, to inject\n;; *correlation-id* into the request headers.\n\n(def app\n  (-\u003e handler\n      c-id/ring-wrap-correlation-id\n      r-id/wrap-correlation-id))\n\n(defn my-handler [request]\n  {:status 200\n   :body (format \"Your correlation ID: %s\" r-id/*correlation-id*)})\n\n\n;; To just add correlation-id middleware to clj-http:\n(http/with-additional-middleware\n  [#'c-id/wrap-correlation-id]\n  (http/get ...))\n\n;; For Timbre, provides middleware that adds :correlation-id to the data map, so it's available\n;; to all appenders.\n;; This is most useful, for instance, with a custom appender that puts correlation-id into\n;; saved state--perhaps into logstash.\n(use '[timbre.middleware.correlation-id :as t-id])\n\n(t-id/merge-correlation-id-middleware!)\n;; or\n(t-id/with-correlation-id-middleware\n  ... your body here )\n\n```      \n\nTo tie this all together, use a Timbre appender (such as `taoensso.timbre.appenders.3rd-party.logstash`) in all communicating applications to write to a common data store.  \n\n## License\n\nCopyright © 2019 Eric Schoen\n\nDistributed under the Eclipse Public License either version 1.0 or (at\nyour option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejschoen%2Fring-correlation-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fejschoen%2Fring-correlation-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fejschoen%2Fring-correlation-id/lists"}