Protocol and function instrumentation: pass-through wrappers that record each call's latency and outcome through hive-ttracking.metrics/record!. Wrapped code is untouched.
Protocol and function instrumentation: pass-through wrappers that record each call's latency and outcome through hive-ttracking.metrics/record!. Wrapped code is untouched.
(wrap proto target)(wrap proto target {:keys [area label] :or {area :proto/call}})Return an object implementing protocol proto (a protocol var, e.g.
#'my.ns/IStore) that forwards every method to target and records each
call as [area label method-name] through hive-ttracking.metrics/record!
(outcome :error when the method throws; the throwable is rethrown).
opts: :area keyword, first element of the op key (default :proto/call) :label value, or (fn [target] => value); computed once at wrap time. nil label yields [area method-name].
The wrapper implements ONLY proto: other protocols or interfaces target
satisfies are not exposed. Where callers need them, use wrap-fn on the
individual call site instead. nil target returns nil. The reify class is
generated (eval) once per protocol and cached; wrapping is cheap after.
Return an object implementing protocol `proto` (a protocol var, e.g.
#'my.ns/IStore) that forwards every method to `target` and records each
call as [area label method-name] through hive-ttracking.metrics/record!
(outcome :error when the method throws; the throwable is rethrown).
opts:
:area keyword, first element of the op key (default :proto/call)
:label value, or (fn [target] => value); computed once at wrap time.
nil label yields [area method-name].
The wrapper implements ONLY `proto`: other protocols or interfaces target
satisfies are not exposed. Where callers need them, use `wrap-fn` on the
individual call site instead. nil target returns nil. The reify class is
generated (eval) once per protocol and cached; wrapping is cheap after.(wrap-fn k f)Wrap plain function f so every call is recorded as op key k through hive-ttracking.metrics/record! (outcome :error when f throws; rethrown). Returns a fn with f's behaviour.
Wrap plain function f so every call is recorded as op key k through hive-ttracking.metrics/record! (outcome :error when f throws; rethrown). Returns a fn with f's behaviour.
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 |