Counters, gauges and histograms for the replikativ stack, with nothing underneath them.
One process-wide registry — metrics are process-level by nature; scoping is by label — of named instruments, each a family of series keyed by its labels:
(inc! :konserve_bytes_written_total {:backend :file} 4096) (gauge! :datahike_connections {:database "…"} 3) (observe! :datahike_commit_seconds {:database "…"} 0.042)
snapshot returns the registry as plain data; replikativ.metrics.prometheus
renders it in the exposition format, replikativ.metrics.konserve/sink
folds konserve's events into it, and replikativ.metrics.jvm samples the
JVM at scrape time. Recording is one swap! on an atom: safe from any
thread, cheap, and never throws for a well-formed call.
Names are keywords in Prometheus style (snake_case, unit last:
_seconds, _bytes, _total for counters); labels a map of keyword to
keyword, string, number or uuid. describe! adds the help text and
histogram buckets a scrape shows; an instrument first seen by a recording
call gets its type from that call and no help.
Counters, gauges and histograms for the replikativ stack, with nothing
underneath them.
One process-wide registry — metrics are process-level by nature; scoping
is by label — of named instruments, each a family of series keyed by its
labels:
(inc! :konserve_bytes_written_total {:backend :file} 4096)
(gauge! :datahike_connections {:database "…"} 3)
(observe! :datahike_commit_seconds {:database "…"} 0.042)
`snapshot` returns the registry as plain data; `replikativ.metrics.prometheus`
renders it in the exposition format, `replikativ.metrics.konserve/sink`
folds konserve's events into it, and `replikativ.metrics.jvm` samples the
JVM at scrape time. Recording is one `swap!` on an atom: safe from any
thread, cheap, and never throws for a well-formed call.
Names are keywords in Prometheus style (`snake_case`, unit last:
`_seconds`, `_bytes`, `_total` for counters); labels a map of keyword to
keyword, string, number or uuid. `describe!` adds the help text and
histogram buckets a scrape shows; an instrument first seen by a recording
call gets its type from that call and no help.Histogram buckets for durations in seconds: 1 ms to 10 s.
Histogram buckets for durations in seconds: 1 ms to 10 s.
(describe! name {:keys [type help buckets]})Declare name: :type, :help, and for a histogram :buckets (upper
bounds, ascending; default-buckets otherwise). Idempotent; a series
recorded before the description keeps its data.
Declare `name`: `:type`, `:help`, and for a histogram `:buckets` (upper bounds, ascending; `default-buckets` otherwise). Idempotent; a series recorded before the description keeps its data.
(gauge! name labels v)Set the gauge name for labels to v.
Set the gauge `name` for `labels` to `v`.
(inc! name labels)(inc! name labels n)Count n (1) on the counter name for labels.
Count `n` (1) on the counter `name` for `labels`.
(observe! name labels v)Record the value v on the histogram name for labels.
Record the value `v` on the histogram `name` for `labels`.
(observe-since! name labels t0)Record on the histogram name the seconds elapsed since t0 (a timer).
Record on the histogram `name` the seconds elapsed since `t0` (a `timer`).
name -> {:type :counter|:gauge|:histogram :help str :buckets [..] :series {labels state}}
name -> {:type :counter|:gauge|:histogram :help str :buckets [..] :series {labels state}}
(reset!)Forget every instrument and series — for tests.
Forget every instrument and series — for tests.
(snapshot)The registry as data: {name {:type :help :buckets :series {labels state}}},
where a counter's or gauge's state is its value and a histogram's is
{:count :sum :buckets [per-bucket counts …, +Inf]}.
The registry as data: `{name {:type :help :buckets :series {labels state}}}`,
where a counter's or gauge's state is its value and a histogram's is
`{:count :sum :buckets [per-bucket counts …, +Inf]}`.(timer)The start of a duration measurement; pair with observe-since!.
The start of a duration measurement; pair with `observe-since!`.
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 |