Liking cljdoc? Tell your friends :D

fx.observability.metrics

Zero-dependency, high-concurrency in-memory metrics for fx effect pipelines.

Zero-dependency, high-concurrency in-memory metrics for fx effect pipelines.
raw docstring

counter-inc!clj/s

(counter-inc! desc)
(counter-inc! registry desc)
(counter-inc! registry desc n)

Increments counter descriptor in registry by n (default 1).

Increments counter descriptor in registry by `n` (default 1).
raw docstring

counter-inc>clj/s

(counter-inc> counter-desc)
(counter-inc> counter-desc-or-prev n-or-desc)
(counter-inc> prev-effect counter-desc n)

Creates an effect that increments counter-descriptor by n (default 1).

Example: (-> (fx/succeed> :ok) (fx.observability.metrics/counter-inc> (fx.observability.metrics/metric-counter "events.total")))

Creates an effect that increments `counter-descriptor` by `n` (default 1).

Example:
  (-> (fx/succeed> :ok)
      (fx.observability.metrics/counter-inc> (fx.observability.metrics/metric-counter "events.total")))
raw docstring

format-metrics-snapshotclj/s

(format-metrics-snapshot {:keys [counters gauges timers]})

Pure function transforming raw registry state map into a formatted snapshot map.

Pure function transforming raw registry state map into a formatted snapshot map.
raw docstring

gauge-set!clj/s

(gauge-set! desc val)
(gauge-set! registry desc val)

Sets gauge descriptor value in registry.

Sets gauge descriptor value in registry.
raw docstring

gauge-set>clj/s

(gauge-set> gauge-desc val)
(gauge-set> prev-effect gauge-desc val)

Creates an effect that sets gauge-descriptor to val-or-fn.

Example: (fx.observability.metrics/gauge-set> (fx.observability.metrics/metric-gauge "queue.size") 42)

Creates an effect that sets `gauge-descriptor` to `val-or-fn`.

Example:
  (fx.observability.metrics/gauge-set> (fx.observability.metrics/metric-gauge "queue.size") 42)
raw docstring

make-metrics-registryclj/s

(make-metrics-registry)

Creates a new isolated, concurrent metrics registry.

Creates a new isolated, concurrent metrics registry.
raw docstring

metric-counterclj/s

(metric-counter name)
(metric-counter name tags)

Creates a counter metric descriptor.

Creates a counter metric descriptor.
raw docstring

metric-descriptor?clj/s

(metric-descriptor? x)

Returns true if x is a MetricDescriptor.

Returns true if `x` is a MetricDescriptor.
raw docstring

metric-gaugeclj/s

(metric-gauge name)
(metric-gauge name tags)

Creates a gauge metric descriptor.

Creates a gauge metric descriptor.
raw docstring

metric-timerclj/s

(metric-timer name)
(metric-timer name tags)

Creates a latency timer metric descriptor.

Creates a latency timer metric descriptor.
raw docstring

metrics-layer>clj/s

(metrics-layer>)
(metrics-layer> registry)

Creates a managed Layer providing :fx.observability/metrics-registry. When called with no arguments, acquires a fresh isolated concurrent metrics registry. When called with registry, provides that registry. On release, resets the registry via reset-metrics!.

Creates a managed Layer providing `:fx.observability/metrics-registry`.
When called with no arguments, acquires a fresh isolated concurrent metrics registry.
When called with `registry`, provides that registry.
On release, resets the registry via `reset-metrics!`.
raw docstring

metrics-snapshot!clj/s

(metrics-snapshot!)
(metrics-snapshot! registry)

Returns a pure Clojure map snapshot of all metrics registered in registry.

Returns a pure Clojure map snapshot of all metrics registered in `registry`.
raw docstring

reset-metrics!clj/s

(reset-metrics!)
(reset-metrics! registry)

Resets all metric accumulators in registry to zero.

Resets all metric accumulators in `registry` to zero.
raw docstring

timer-record!clj/s

(timer-record! desc duration-ms)
(timer-record! registry desc duration-ms)

Records a latency observation in milliseconds into timer descriptor in registry.

Records a latency observation in milliseconds into timer descriptor in registry.
raw docstring

track-duration>clj/s

(track-duration> timer-desc eff)
(track-duration> prev-effect timer-desc eff)

Wraps effect measuring elapsed execution time and recording it into timer-descriptor.

Example: (fx.observability.metrics/track-duration> (fx.observability.metrics/metric-timer "db.query.time" {:table "users"}) (query-db> sql))

Wraps `effect` measuring elapsed execution time and recording it into `timer-descriptor`.

Example:
  (fx.observability.metrics/track-duration> (fx.observability.metrics/metric-timer "db.query.time" {:table "users"})
    (query-db> sql))
raw docstring

track-failure-count>clj/s

(track-failure-count> counter-desc eff)
(track-failure-count> prev-effect counter-desc eff)

Wraps effect, incrementing counter-descriptor upon failure or defect. Leaves counter unmodified if the effect succeeds.

Example: (fx.observability.metrics/track-failure-count> (fx.observability.metrics/metric-counter "orders.failure") (place-order> order))

Wraps `effect`, incrementing `counter-descriptor` upon failure or defect.
Leaves counter unmodified if the effect succeeds.

Example:
  (fx.observability.metrics/track-failure-count> (fx.observability.metrics/metric-counter "orders.failure")
    (place-order> order))
raw docstring

track-success-count>clj/s

(track-success-count> counter-desc eff)
(track-success-count> prev-effect counter-desc eff)

Wraps effect, incrementing counter-descriptor upon successful execution. Leaves counter unmodified if the effect fails.

Example: (fx.observability.metrics/track-success-count> (fx.observability.metrics/metric-counter "orders.success") (place-order> order))

Wraps `effect`, incrementing `counter-descriptor` upon successful execution.
Leaves counter unmodified if the effect fails.

Example:
  (fx.observability.metrics/track-success-count> (fx.observability.metrics/metric-counter "orders.success")
    (place-order> order))
raw docstring

update-timer-statsclj/s

(update-timer-stats stats duration-ms)

Pure function that incorporates a new duration observation (in milliseconds) into existing timer stats map.

Pure function that incorporates a new duration observation (in milliseconds)
into existing timer stats map.
raw docstring

with-metrics-registry>clj/s

(with-metrics-registry> registry-or-eff eff-or-registry)
(with-metrics-registry> prev-effect registry target-eff)

Scopes a metrics registry to effect.

Example: (fx.observability.metrics/with-metrics-registry> reg (app-pipeline>))

Scopes a metrics registry to `effect`.

Example:
  (fx.observability.metrics/with-metrics-registry> reg (app-pipeline>))
raw 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