Skip to content

pyr/clj-statsd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clj-statsd is a client for the statsd protocol for the clojure programming language.

Clojars Project

An Example

Here is a snippet showing the use of clj-statsd:

(ns testing (:require [clj-statsd :as s])) (s/setup "127.0.0.1" 8125) ;; Set a shared prefix for all stats keys (s/setup "127.0.0.1" 8125 :prefix :my-app) (s/increment :some_counter) ;; simple increment (s/decrement "some_other_counter") ;; simple decrement (s/increment :some_counter 2) ;; double increment (s/increment :some_counter 2 0.1) ;; sampled double increment (s/timing :timing_value 300) ;; record 300ms for "timing_value" (s/gauge :current_value 42) ;; record an arbitrary value (s/modify-gauge :current_value -2) ;; offset a gauge (s/with-timing :some_slow_code ;; time (some-slow-code) and then (some-slow-code)) ;; send the result using s/timing (s/with-sampled-timing :slow_code 1.0 ;; Like s/with-timing but with (slow-code) ;; a sample rate. (s/with-tagged-timing :slow 1.0 ["foo"] ;; Like s/with-timing but with (slow) ;; a sample rate and tags.

Buckets can be strings or keywords. For more information please refer to statsd

Shutdown

Since clj-statsd uses agents, (shutdown-agents) must be called when exiting the program.

About

simple client library to interface with statsd

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 9