Liking cljdoc? Tell your friends :D

iapetos.core


clearclj

(clear registry)

Unregister the given collectors.

Unregister the given collectors.
sourceraw docstring

collector-registryclj

(collector-registry)
(collector-registry registry-name)

Create a fresh iapetos collector registry.

Create a fresh iapetos collector registry.
sourceraw docstring

counterclj

(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.
sourceraw docstring

decclj

(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.
sourceraw docstring

default-registryclj

source

gaugeclj

(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.
sourceraw docstring

histogramclj

(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.
sourceraw docstring

incclj

(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.
sourceraw docstring

observeclj

(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.
sourceraw docstring

registerclj

(register registry & collectors)

Register the given collectors.

Register the given collectors.
sourceraw docstring

register-asclj

(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.
sourceraw docstring

register-lazyclj

(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.
sourceraw docstring

setclj

(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.
sourceraw docstring

set-to-current-timeclj

(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.
sourceraw docstring

start-timerclj

(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.
sourceraw docstring

subsystemclj

(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.
sourceraw docstring

summaryclj

(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.
sourceraw docstring

unregisterclj

(unregister registry & collector-names)

Unregister the given collectors.

Unregister the given collectors.
sourceraw docstring

valueclj

(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.
sourceraw docstring

with-activity-countercljmacro

(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.
sourceraw docstring

with-countercljmacro

(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.
sourceraw docstring

with-counterscljmacro

(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.
sourceraw docstring

with-durationcljmacro

(with-duration collector & body)

Wrap the given block to write its execution time to the given collector.

Works with gauge, histogram and summary collectors.

Wrap the given block to write its execution time to the given collector.

Works with [[gauge]], [[histogram]] and [[summary]] collectors.
sourceraw docstring

with-failure-countercljmacro

(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.
sourceraw docstring

with-failure-timestampcljmacro

(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.
sourceraw docstring

with-success-countercljmacro

(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.
sourceraw docstring

with-success-timestampcljmacro

(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.
sourceraw docstring

with-timestampcljmacro

(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.
sourceraw docstring

with-timestampscljmacro

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close