README.md in mini_graphite-0.2.1 vs README.md in mini_graphite-0.3.7
- old
+ new
@@ -1,10 +1,10 @@
# MiniGraphite
Simple wrapper for Graphite and Statsd
-## Instructions
+## Instructions
Check the `test` folder for examples, if you need more explanations please contact us.
## Installation
@@ -25,45 +25,60 @@
### Config
Dalia::MiniGraphite.config({
:graphite_host => "my.graphite.server.com",
:graphite_port => 2003, # default 2003
- :statsd_host => "my.graphite.server.com",
+ :statsd_host => "my.statsd.server.com",
:statsd_port => 8125, # default 8125
:mock_mode => false, # default false
:debug_mode => true # default false
})
+Also support multiple servers:
+
+ Dalia::MiniGraphite.config({
+ :graphite_host => ["my.graphite1.server.com", "my.graphite2.server.com"],
+ :graphite_port => 2003, # default 2003
+ :statsd_host => ["my.statsd1.server.com", "my.statsd2.server.com", "my.statsd3.server.com"],
+ :statsd_port => 8125, # default 8125
+ :mock_mode => false, # default false
+ :debug_mode => true # default false
+ })
+
### Simple signals
Dalia::MiniGraphite.datapoint("my.key", 120, Time.now) # to Graphite
- Dalia::MiniGraphite.counter("my.key", 120) # to StatSD
+ Dalia::MiniGraphite.counter("my.key", 120) # to StatSD with `c` modifyer
+ Dalia::MiniGraphite.time("my.key", 120) # to StatSD with `ms` modifyer
### Block wrapper benchmark
+ # Dalia::MiniGraphite.benchmark_wrapper(key_prefix, result_send_method)
result =
- Dalia::MiniGraphite.benchmark_wrapper("key_prefix", [send_result={true,false}]) do
+ Dalia::MiniGraphite.benchmark_wrapper("key_prefix", :length) do
sleep(1)
"RESULT"
end
puts result # => RESULT
-This will send 4 signals:
+This will send several signals:
-- *key_prefix.ini* # At the begining of the block
-- *key_prefix.result* # At the end of the block, send the block result. Only if `send_result` paramater is `true`.
-- *key_prefix.time, [ms]* # At the end of the block, with the Benchmark.realtime result of the execution
-- *key_prefix.end* # At the end of the block
+- *key_prefix.ini:1|c* # At the begining of the block
+- *key_prefix.result:6|c* # At the end of the block, send the block `result.send(result_send_method)`. Only if `result_send_method` paramater is present.
+- *key_prefix.time:1000|c* # At the end of the block, with the Benchmark.realtime result of the execution
+- *key_prefix.end:1|c* # At the end of the block
+- *key_prefix.time_stats:1000|ms* # At the end of the block, with the Benchmark.realtime result of the execution
### Routes reporter for Sinatra
The rack middleware must be added to the Rack chain in config.ru passing along with it a block with config options:
- *set_graphite_key "graphite_key", /route_regexp/* # The regular expression will be used to match the Sinatra route and the corresponding graphite_key will be used to build the Graphite metrics:
-"[graphite_key].count" # The counter of the times a particular route is requested.
-"[graphite_key].duration" # The duration in milliseconds of each request/response cycle.
+- "[graphite\_key].count" # The counter of the times a particular route is requested.
+- "[graphite\_key].duration" # The duration in milliseconds of each request/response cycle.
+- "[graphite\_key].duration\_stats" # The duration in milliseconds of each request/response cycle in a "ms" metric
If the requested url doesn't match any configured regular expression the Graphite metrics will not be sent.
Example: