(clear registry)
Unregister the given collectors.
Unregister the given collectors.
(collector-registry)
(collector-registry registry-name)
Create a fresh iapetos collector registry.
Create a fresh iapetos collector registry.
(counter metric
&
[{:keys [description labels]
:or {description "a counter metric."}
:as options}])
Create a new Counter
collector:
:description
: a description for the counter,:labels
: a seq of available labels for the counter.Create a new `Counter` collector: - `:description`: a description for the counter, - `:labels`: a seq of available labels for the counter.
(dec collector)
(dec collector amount)
(dec registry metric)
(dec registry metric amount)
(dec registry metric labels)
(dec registry metric labels amount)
Decrement the given metric by the given amount. This can be either called using a registry and metric name or directly on a collector:
(-> registry (inc :app/active-users-total))
(-> registry :app/active-users-total (inc))
The return value of this operation is either the collector or registry that was passed in.
Decrement the given metric by the given amount. This can be either called using a registry and metric name or directly on a collector: ``` (-> registry (inc :app/active-users-total)) (-> registry :app/active-users-total (inc)) ``` The return value of this operation is either the collector or registry that was passed in.
(gauge metric
&
[{:keys [description labels]
:or {description "a gauge metric."}
:as options}])
Create a new Gauge
collector:
:description
: a description for the gauge,:labels
: a seq of available labels for the gauge.Create a new `Gauge` collector: - `:description`: a description for the gauge, - `:labels`: a seq of available labels for the gauge.
(histogram metric
&
[{:keys [description buckets labels]
:or {description "a histogram metric."}
:as options}])
Create a new Histogram
collector:
:description
: a description for the histogram,:buckets
: a seq of double values describing the histogram buckets,:labels
: a seq of available labels for the histogram.Create a new `Histogram` collector: - `:description`: a description for the histogram, - `:buckets`: a seq of double values describing the histogram buckets, - `:labels`: a seq of available labels for the histogram.
(inc collector)
(inc collector amount)
(inc registry metric)
(inc registry metric amount)
(inc registry metric labels)
(inc registry metric labels amount)
Increment the given metric by the given amount. This can be either called using a registry and metric name or directly on a collector:
(-> registry (inc :app/active-users-total))
(-> registry :app/active-users-total (inc))
The return value of this operation is either the collector or registry that was passed in.
Increment the given metric by the given amount. This can be either called using a registry and metric name or directly on a collector: ``` (-> registry (inc :app/active-users-total)) (-> registry :app/active-users-total (inc)) ``` The return value of this operation is either the collector or registry that was passed in.
(observe collector amount)
(observe registry metric amount)
(observe registry metric labels amount)
Observe the given amount for the desired metric. This can be either called using a registry and metric name or directly on a collector:
(-> registry (observe :app/active-users-total 10.0))
(-> registry :app/active-users-total (observe 10.0))
The return value of this operation is either the collector or registry that was passed in.
Observe the given amount for the desired metric. This can be either called using a registry and metric name or directly on a collector: ``` (-> registry (observe :app/active-users-total 10.0)) (-> registry :app/active-users-total (observe 10.0)) ``` The return value of this operation is either the collector or registry that was passed in.
(register registry & collectors)
Register the given collectors.
Register the given collectors.
(register-as registry metric collector)
Register the given collector under the given metric name. This is useful for plain Prometheus collectors, i.e. those that are not provided by iapetos.
Register the given collector under the given metric name. This is useful for plain Prometheus collectors, i.e. those that are not provided by iapetos.
(register-lazy registry & collectors)
Prepare the given collectors but only actually register them on first use. This can be useful for metrics that should only be available conditionally, e.g. the failure timestamp for a batch job.
Prepare the given collectors but only actually register them on first use. This can be useful for metrics that should only be available conditionally, e.g. the failure timestamp for a batch job.
(set collector amount)
(set registry metric amount)
(set registry metric labels amount)
Set the given metric to the given value. This can be either called using a registry and metric name or directly on a collector:
(-> registry (set :app/active-users-total 10.0))
(-> registry :app/active-users-total (set 10.0))
The return value of this operation is either the collector or registry that was passed in.
Set the given metric to the given value. This can be either called using a registry and metric name or directly on a collector: ``` (-> registry (set :app/active-users-total 10.0)) (-> registry :app/active-users-total (set 10.0)) ``` The return value of this operation is either the collector or registry that was passed in.
(set-to-current-time collector)
(set-to-current-time registry metric)
(set-to-current-time registry metric labels)
Set the given metric to the current timestamp. This can be either called using a registry and metric name or directly on a collector:
(-> registry (set-to-current-time :app/last-success-unixtime))
(-> registry :app/last-success-unixtime set-to-current-time)
The return value of this operation is either the collector or registry that was passed in.
Set the given metric to the current timestamp. This can be either called using a registry and metric name or directly on a collector: ``` (-> registry (set-to-current-time :app/last-success-unixtime)) (-> registry :app/last-success-unixtime set-to-current-time) ``` The return value of this operation is either the collector or registry that was passed in.
(start-timer collector)
(start-timer registry metric)
(start-timer registry metric labels)
Start a timer that, when stopped, will store the duration in the given metric. This can be either called using a registry and metric name or a collector:
(-> registry (start-timer :app/duration-seconds))
(-> registry :app/duration-seconds (start-timer))
The return value will be a function that should be called once the operation to time has run.
Start a timer that, when stopped, will store the duration in the given metric. This can be either called using a registry and metric name or a collector: ``` (-> registry (start-timer :app/duration-seconds)) (-> registry :app/duration-seconds (start-timer)) ``` The return value will be a _function_ that should be called once the operation to time has run.
(subsystem registry subsystem-name)
Create a new registry bound to the given subsystem. The resulting value will not have access to any of the original registry's collectors.
Subsystems can be nested, resulting in joining the subsystem names with underscores.
Create a new registry bound to the given subsystem. The resulting value will not have access to any of the original registry's collectors. Subsystems can be nested, resulting in joining the subsystem names with underscores.
(summary metric
&
[{:keys [description quantiles labels]
:or {description "a summary metric."}
:as options}])
Create a new Summary
collector:
:description
: a description for the summary,:quantiles
: a map of double [quantile error] entries:labels
: a seq of available labels for the summary.Create a new `Summary` collector: - `:description`: a description for the summary, - `:quantiles`: a map of double [quantile error] entries - `:labels`: a seq of available labels for the summary.
(unregister registry & collector-names)
Unregister the given collectors.
Unregister the given collectors.
(value collector)
(value registry metric)
(value registry metric labels)
Read the current value of a metric. This can be either called using a registry and a metric name or directly on a collector:
(-> registry (value :app/duration-seconds))
(-> registry :app/duration-seconds (value))
The return value depends on the type of collector.
Read the current value of a metric. This can be either called using a registry and a metric name or directly on a collector: ``` (-> registry (value :app/duration-seconds)) (-> registry :app/duration-seconds (value)) ``` The return value depends on the type of collector.
(with-activity-counter collector & body)
Wrap the given block to increment the given collector once it is entered
and decrement it once execution is done. This needs a gauge
collector
(since counter
ones cannot be decremented).
Example: Counting the number of in-flight requests in an HTTP server.
Wrap the given block to increment the given collector once it is entered and decrement it once execution is done. This needs a [[gauge]] collector (since [[counter]] ones cannot be decremented). Example: Counting the number of in-flight requests in an HTTP server.
(with-counter collector & body)
Wrap the given block to increment the given counter once it is done.
Wrap the given block to increment the given counter once it is done.
(with-counters {:keys [total success failure] :as counters} & body)
Wrap the given block to increment the given counters:
:total
: incremented when the block is left,:success
: incremented when the block has executed successfully,:failure
: incremented when the block has thrown an exception.Wrap the given block to increment the given counters: - `:total`: incremented when the block is left, - `:success`: incremented when the block has executed successfully, - `:failure`: incremented when the block has thrown an exception.
(with-failure-counter collector & body)
Wrap the given block to increment the given counter if it throws.
Wrap the given block to increment the given counter if it throws.
(with-failure-timestamp collector & body)
Wrap the given block to store the current timestamp in the given collector once execution has failed.
Needs a gauge
collector.
Wrap the given block to store the current timestamp in the given collector once execution has failed. Needs a [[gauge]] collector.
(with-success-counter collector & body)
Wrap the given block to increment the given counter once it has run successfully.
Wrap the given block to increment the given counter once it has run successfully.
(with-success-timestamp collector & body)
Wrap the given block to store the current timestamp in the given collector once execution is done successfully.
Needs a gauge
collector.
Wrap the given block to store the current timestamp in the given collector once execution is done successfully. Needs a [[gauge]] collector.
(with-timestamp collector & body)
Wrap the given block to store the current timestamp in the given collector once execution is done.
Needs a gauge
collector.
Wrap the given block to store the current timestamp in the given collector once execution is done. Needs a [[gauge]] collector.
(with-timestamps {:keys [last-run last-success last-failure]} & body)
Wrap the given block to set a number of timestamps depending on whether execution succeeds or fails:
:last-run
: the last time the block was run,
:last-success
: the last time the block was run successfully,
:last-failure
: the last time execution failed.
All keys are optional but have to point at a gauge
collector if given.
Wrap the given block to set a number of timestamps depending on whether execution succeeds or fails: `:last-run`: the last time the block was run, `:last-success`: the last time the block was run successfully, `:last-failure`: the last time execution failed. All keys are optional but have to point at a [[gauge]] collector if given.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close