Liking cljdoc? Tell your friends :D

hive-ttracking

Clojars Project cljdoc release License: MIT

Time tracking, budgets and benchmarking for Clojure, as values. Spans, declarative budgets, statistical benchmarks and :tt/* events — every public call returns a Result, and nothing in the domain layer reads the system clock directly.

Coordinates

;; deps.edn
io.github.hive-agi/hive-ttracking {:mvn/version "0.1.10"}

Usage

(require '[hive-ttracking.core :as tt])

(tt/with-tracker [t {}]
  (tt/track {:name :fetch} (fetch! url))
  (tt/track {:name :parse} (parse body)))   ;; both land in `t`

(tt/track-race {:name :either} (a) (b))

Bounded contexts

NamespaceProvides
hive-ttracking.coreThin facade — with-tracker, track, track-race. All fns return Result
hive-ttracking.clockThe clock facade domain code must route through
hive-ttracking.budgetDeclarative budgets, policy and assertion. Pure — no I/O, no deps on hive-weave or hive-events
hive-ttracking.spanSpan sink abstraction plus pure helpers over span values
hive-ttracking.benchWarmup + N timed iterations, p50/p95/p99/min/max/mean/stddev, and a defbench macro wrapping deftest with a p95 threshold assertion
hive-ttracking.eventsPure builders for the :tt/* event namespace, with a defensive publish wrapper over hive.events/dispatch
hive-ttracking.instrumentPass-through defrecord/reify wrappers for protocols — wrapped code is untouched, no call sites rewritten
hive-ttracking.initIAddon init hook, invoked when the library is on the classpath and enabled by config

Two design constraints worth knowing

Domain code must not call java.time.* or System/currentTimeMillis. It routes through hive-ttracking.clock, so a test can pin time without with-redefs on a JVM static.

Instrumentation is open-closed. Wrapping a protocol implementation adds a pass-through record around it; the wrapped code is not edited and no call site changes.

License

MIT.

Can you improve this documentation?Edit on GitHub

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