Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marianoguerra/pipe-metrics.clj
a lib to add coda hale's metrics to marianoguerra's pipe library
https://github.com/marianoguerra/pipe-metrics.clj
Last synced: about 1 month ago
JSON representation
a lib to add coda hale's metrics to marianoguerra's pipe library
- Host: GitHub
- URL: https://github.com/marianoguerra/pipe-metrics.clj
- Owner: marianoguerra
- Created: 2013-04-03T14:43:08.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-04-04T08:14:20.000Z (over 11 years ago)
- Last Synced: 2024-06-22T21:42:11.811Z (5 months ago)
- Language: Clojure
- Size: 117 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pipe-metrics
a lib to add coda hale's metrics to marianoguerra's pipe library
## Usage
check clojars project's site for instructions:
https://clojars.org/org.marianoguerra/pipe-metrics
example usage:
user=> (use 'marianoguerra.pipe)
user=> (use 'marianoguerra.pipe-metrics)
user=> (defn plus-one [{value :value}] {:value (inc value)})user=> (pipe {:value 42} (counter "my-counter") plus-one)
{:value 43}user=> (get-metric "my-counter")
#user=> (require '[metrics.counters :as counters])
user=> (counters/value (get-metric "my-counter"))
1user=> (pipe {:value 42} (counter "my-counter") plus-one)
{:value 43}user=> (pipe {:value 42} (counter "my-counter") plus-one)
{:value 43}user=> (counters/value (get-metric "my-counter"))
3; you can specify a custom update function that can change the
; metric according to something else (like current value on the pipe)user=> (defn increase-counter-by-two [counter value inc! dec! clear!] (inc! counter 2))
#'user/increase-counter-by-two
user=> (defn decrease-counter [counter value inc! dec! clear!] (dec! counter))
#'user/decrease-counter
user=> (defn clear-counter [counter value inc! dec! clear!] (clear! counter))
#'user/clear-counter
user=> (pipe {:value 42} (counter "my-counter" :update-fn decrease-counter) plus-one)
{:value 43}
user=> (counters/value (get-metric "my-counter"))
2
user=> (pipe {:value 42} (counter "my-counter" :update-fn clear-counter) plus-one)
{:value 43}
user=> (counters/value (get-metric "my-counter"))
0## License
Copyright © 2013 marianoguerra
Distributed under the Eclipse Public License, the same as Clojure.