Clojure API over the Prometheus Java SDK.
This API doesn't try to keep you far away from the Java API. You will likely end up using that API directly. The functions here provide idiomatic (and performant) access to the Collectors.
All Collector creation functions take the same set of
options. :name
and :help
are required, :namespace
,
:subsystem
& :labels
are optional.
The expected usage pattern is to create a long lived Collector instance, and use the functions in this package to track the metrics. Most commonly, you will create a package level private var to keep a reference to a metric.
(require '[daaku.metrics :as m])
(def ^:private m-emails-sent (m/counter {:name :emails-sent
:help "emails we sent"}))
(defn- send-email []
(println "sending email")
(m/inc m-emails-sent))
Clojure API over the Prometheus Java SDK. This API doesn't try to keep you far away from the Java API. You will likely end up using that API directly. The functions here provide idiomatic (and performant) access to the Collectors. All Collector creation functions take the same set of options. `:name` and `:help` are required, `:namespace`, `:subsystem` & `:labels` are optional. The expected usage pattern is to create a long lived Collector instance, and use the functions in this package to track the metrics. Most commonly, you will create a package level private var to keep a reference to a metric. ```clojure (require '[daaku.metrics :as m]) (def ^:private m-emails-sent (m/counter {:name :emails-sent :help "emails we sent"})) (defn- send-email [] (println "sending email") (m/inc m-emails-sent)) ```
(dec m)
(dec m amount)
Decrement a Collector by 1 or the given amount.
Decrement a Collector by 1 or the given amount.
(enumeration {:keys [states] :as opts})
Create Enumeration Collector. Also requires :states
.
Create Enumeration Collector. Also requires `:states`.
(histogram opts)
Create Histogram Collector.
Create Histogram Collector.
(inc this)
(inc this amount)
Increment a Collector by 1 or the given amount.
Increment a Collector by 1 or the given amount.
(observe this amount)
Observe a given value.
Observe a given value.
(start-timer this)
Start a timer. Returns a function that when called will stop the timer.
Start a timer. Returns a function that when called will stop the timer.
(register r c)
Register into a CollectorRegistry the given Collector.
Register into a CollectorRegistry the given Collector.
(sanitize-name v)
Sanitize a name to create a safe string suitable as a name, namespace, subsystem or label.
Sanitize a name to create a safe string suitable as a name, namespace, subsystem or label.
(sanitize-value v)
Sanitize a value. Keywords are special and their name is used,
everything else is transformed to using str
.
Sanitize a value. Keywords are special and their name is used, everything else is transformed to using `str`.
(set-info this info)
Set the information of an Info Collector. Info keys and values will be sanitized.
Set the information of an Info Collector. Info keys and values will be sanitized.
(set m amount)
Set a Collector's value to the given amount.
Set a Collector's value to the given amount.
(set-state this state)
Set the state of an Enumeration Collector. State value will be sanitized.
Set the state of an Enumeration Collector. State value will be sanitized.
(time collector & body)
Measure in the Collector the run time duration of the given forms.
Measure in the Collector the run time duration of the given forms.
(with-labels this labels)
Create a child with the provided labels.
Create a child with the provided labels.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close