A clj-http middleware that reports timing metrics.
NOTE: The middleware currently only supports synchronous operations.
The following example uses the default Codahale metric registry and specifies that the metric titles should be based upon the request URL and apply a prefix.
The metric title for the URL http://subdomain.example.com/some/path
is
my-prefix.com.example.subdomain.some.path
in the following setup. Timing
metrics will appear under that title.
(require '[clj-http.client :as client])
(require '[clj-http.middleware.metrics :as m])
(def wrap-metrics
(m/build-wrap-metrics (m/prefixed-title-fn m/title-from-url "my-prefix"))
(client/with-additional-middleware [#'wrap-metrics]
(client/get ...))
Copyright © 2019 Thomas C. Taylor
Distributed under the Eclipse Public License version 2.0.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close