Dropwizard Metrics instrumentation for core.cache caches.
To count the cache hits and the misses, wrap the cache in
instrumented-cache-factory.
(def my-registry (MetricsRegistry.))
(defn create-cache []
(-> (lru-cache-factory {})
(instrumented-cache-factory :registry my-registry)))
If you follow the usage pattern recommend by core.cache documentation and wrap
the cache in an atom, you can measure the cache size with
cache-size-gauge.
(def my-cache-a (atom (create-cache)))
(.register my-registry "clojure.core.cache.size" (cache-size-gauge my-cache-a))
Dropwizard Metrics instrumentation for core.cache caches.
## Usage
To count the cache hits and the misses, wrap the cache in
[[instrumented-cache-factory]].
(def my-registry (MetricsRegistry.))
(defn create-cache []
(-> (lru-cache-factory {})
(instrumented-cache-factory :registry my-registry)))
If you follow the usage pattern recommend by core.cache documentation and wrap
the cache in an atom, you can measure the cache size with
[[cache-size-gauge]].
(def my-cache-a (atom (create-cache)))
(.register my-registry "clojure.core.cache.size" (cache-size-gauge my-cache-a))(instrumented-cache-factory base
&
{:keys [registry metric-name]
:or {metric-name "clojure.core.cache"}})Wrap base cache with instrumentation logic that counts the hits and the misses.
Expects :registry argument that is the MetricRegistry for the metrics.
Optionally :metric-name argument specifies the name prefix for the metircs.
Wrap base cache with instrumentation logic that counts the hits and the misses. Expects `:registry` argument that is the MetricRegistry for the metrics. Optionally `:metric-name` argument specifies the name prefix for the metircs.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |