batsd 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.md +49 -1
  2. data/lib/batsd.rb +1 -1
  3. data/lib/batsd/version.rb +1 -1
  4. metadata +2 -2
data/README.md CHANGED
@@ -1,4 +1,52 @@
1
1
  batsd-ruby
2
2
  ==========
3
3
 
4
- A ruby client for batsd.
4
+ A Ruby client for [batsd](https://github.com/noahhl/batsd), a ruby-based alternative to statsd for aggregating and storing statistics.
5
+
6
+ # Installation
7
+
8
+ A simple gem installation.
9
+
10
+ gem install batsd
11
+
12
+ Or you can include it in your Gemfile:
13
+
14
+ gem "batsd"
15
+
16
+ # Getting Started
17
+
18
+ You can connect to Batsd by instantiating the Batsd class:
19
+
20
+ client = Batsd.new
21
+
22
+ This assumes Batsd was started with a default configuration, and it listening on `localhost`, port `8127`. If you need to connect to a remote server or a different port, pass in the appropriate options:
23
+
24
+ client = Batsd.new(:host => "10.0.0.1", :port => 8127)
25
+
26
+ The options and defaults are:
27
+
28
+ :host => "127.0.0.1"
29
+ :port => 8127
30
+ :timeout => 2000 #milliseconds
31
+ :max_attempts => 2
32
+
33
+ Now you can grab the list of available keys:
34
+
35
+ keys = client.available
36
+
37
+ To pull the stats for a key:
38
+
39
+ start_timestamp = Time.now - (60*60) # 1 hour ago
40
+ end_timestamp = Time.now
41
+ stats = client.stats("metric_name", start_timestamp, end_timestamp)
42
+
43
+ Each stat is returned as a hash with a `:timestamp` and `:value`. To pull only the timestamps or values for a range:
44
+
45
+ start_timestamp = Time.now - (60*60) # 1 hour ago
46
+ end_timestamp = Time.now
47
+ values = client.values("metric_name", start_timestamp, end_timestamp)
48
+ timestamps = client.timestamps("metric_name", start_timestamp, end_timestamp)
49
+
50
+ # Contributing
51
+
52
+ [Fork the project](https://github.com/hathaway/batsd-client) and send pull requests.
@@ -98,7 +98,7 @@ class Batsd
98
98
  raise InvalidValuesError
99
99
  end
100
100
  end
101
- results = values[metric_name].collect{|v| { timestamp: Time.at(v["timestamp"].to_i), value: v["value"].to_f } }
101
+ results = values[metric_name].collect{|v| { :timestamp => Time.at(v["timestamp"].to_i), :value => v["value"].to_f } }
102
102
  results
103
103
  end
104
104
 
@@ -1,3 +1,3 @@
1
1
  class Batsd
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: batsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-08 00:00:00.000000000 Z
12
+ date: 2013-02-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Batsd client for Ruby. Provides an interface for querying data in a
15
15
  batsd server.