Liking cljdoc? Tell your friends :D

zeph.metrics

Simple metrics collection for Zeph.

Provides counters, gauges, and histograms with no external dependencies.

Usage: (require '[zeph.metrics :as m])

;; Increment a counter (m/inc! :http/requests) (m/inc! :http/requests 5)

;; Register a gauge (m/gauge! :connections/active #(count @connections))

;; Record histogram values (m/record! :request/latency-ms elapsed)

;; Get all metrics (m/get-all)

;; Time a block of code (m/with-timer :db/query-ms (execute-query!))

Simple metrics collection for Zeph.

Provides counters, gauges, and histograms with no external dependencies.

Usage:
  (require '[zeph.metrics :as m])

  ;; Increment a counter
  (m/inc! :http/requests)
  (m/inc! :http/requests 5)

  ;; Register a gauge
  (m/gauge! :connections/active #(count @connections))

  ;; Record histogram values
  (m/record! :request/latency-ms elapsed)

  ;; Get all metrics
  (m/get-all)

  ;; Time a block of code
  (m/with-timer :db/query-ms
    (execute-query!))
raw docstring

clear!clj

(clear!)

Clear all metrics completely.

Clear all metrics completely.
sourceraw docstring

counterclj

(counter name)

Get current counter value.

Get current counter value.
sourceraw docstring

dec!clj

(dec! name)

Decrement a counter by 1.

Decrement a counter by 1.
sourceraw docstring

format-prometheusclj

(format-prometheus)

Format metrics in Prometheus text format.

Format metrics in Prometheus text format.
sourceraw docstring

gauge!clj

(gauge! name supplier-fn)

Register a gauge with a supplier function.

Register a gauge with a supplier function.
sourceraw docstring

get-allclj

(get-all)

Get all metric values as a map.

Get all metric values as a map.
sourceraw docstring

get-countersclj

(get-counters)

Get all counter values.

Get all counter values.
sourceraw docstring

get-gaugesclj

(get-gauges)

Get all gauge values.

Get all gauge values.
sourceraw docstring

get-histogramsclj

(get-histograms)

Get all histogram stats.

Get all histogram stats.
sourceraw docstring

histogramclj

(histogram name)

Get histogram stats as a map.

Get histogram stats as a map.
sourceraw docstring

inc!clj

(inc! name)
(inc! name delta)

Increment a counter by 1 or delta.

Increment a counter by 1 or delta.
sourceraw docstring

record!clj

(record! name value)

Record a value in a histogram.

Record a value in a histogram.
sourceraw docstring

record-connection!clj

(record-connection! event)

Record a connection event.

Record a connection event.
sourceraw docstring

record-error!clj

(record-error!)
(record-error! error-type)

Record an error.

Record an error.
sourceraw docstring

record-request!clj

(record-request!)
(record-request! status-code)
(record-request! status-code latency-ms)

Record an HTTP request with optional latency.

Record an HTTP request with optional latency.
sourceraw docstring

reset!clj

(reset!)

Reset all metrics (counters and histograms).

Reset all metrics (counters and histograms).
sourceraw docstring

with-timercljmacro

(with-timer name & body)

Time a block of code and record to histogram.

Time a block of code and record to histogram.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close