mysql-statsd 2.0 → 3.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9a7420bd091f1b7919f1daca835cadb13ca9601
4
- data.tar.gz: 151df80630308b8f1e4f1b7bb11005143dcb4bde
3
+ metadata.gz: 60c44d6868a4e8bb040d294554b41de7dd8587f2
4
+ data.tar.gz: 49adbedfb43619aaefe16dfe3c0709a31ab32ee8
5
5
  SHA512:
6
- metadata.gz: 0d52dd5a554ad9e713832ebb4aee30359a694431b2b1f352b5132d641023b2f046d27a2fc945c10d1d60662a6a6a6acae8ec4561ac418ed114cf313c2a46acbc
7
- data.tar.gz: ef2bd48b5a3d86efe7a9f6ee38dc111230972d3413468f0ee76000c6ddd1920758e8381ad8c8d1e324630f9c91941594140f276287fb894d4dfcc429c56733c8
6
+ metadata.gz: 6554affeb5a2beb1ad891a96e2b937b56b0bd6f348ce843b1350f6152261a8b8bddcfc860efaff0272cdbe12c651330b21c9d7eb7fef84b6603b6c4188fa5896
7
+ data.tar.gz: f6af0c38cf068ae98dab1cbcd74a61b24d9502d655acb609ec41082dd8068d1d508c739d1c868039f795536ecedb53a18a337543ff34437e97e9fb0e7a97b622
data/README.md CHANGED
@@ -1,12 +1,15 @@
1
1
  # MySQL::StatsD
2
2
 
3
- Queries 'SHOW GLOBAL STATUS' and sends the data to StatsD.
3
+ Sends data to StatsD from this queries:
4
+
5
+ * SHOW GLOBAL STATUS
6
+ * SHOW PROCESSLIST
4
7
 
5
8
  ## Installation
6
9
 
7
10
  gem install mysql-statsd
8
11
 
9
- Then copy config.yml.sample to a desired path and customize
12
+ Then copy config.yml.sample to a desired path and customize.
10
13
 
11
14
  ## Usage
12
15
 
@@ -28,7 +28,10 @@ module Mysql
28
28
  private
29
29
 
30
30
  def instrument_process_list
31
- show("PROCESSLIST").each { |entry| statsd.increment entry["Command"].downcase }
31
+ show("PROCESSLIST").each do |entry|
32
+ statsd.increment metric("Command", entry)
33
+ statsd.increment metric("State", entry)
34
+ end
32
35
  end
33
36
 
34
37
  def instrument_statuses
@@ -38,6 +41,10 @@ module Mysql
38
41
  def show(term)
39
42
  mysql.query "SHOW #{term}"
40
43
  end
44
+
45
+ def metric(name, entry)
46
+ "#{name}.#{entry[name].gsub(" ", "_")}".downcase
47
+ end
41
48
  end
42
49
  end
43
50
  end
@@ -1,5 +1,5 @@
1
1
  module Mysql
2
2
  module Statsd
3
- VERSION = "2.0"
3
+ VERSION = "3.0"
4
4
  end
5
5
  end
@@ -33,8 +33,10 @@ describe Mysql::Statsd::Runner do
33
33
  subject.run!
34
34
  end
35
35
 
36
- it "should query the process list" do
37
- subject.mysql.should_receive(:query).with("SHOW PROCESSLIST").and_return [{'Command' => 'Fake'}]
36
+ it "should instrument the process list" do
37
+ subject.mysql.stub(:query).with("SHOW PROCESSLIST").and_return [{'Command' => 'Jump', 'State' => 'Long Lived'}]
38
+ subject.statsd.should_receive(:increment).with('command.jump')
39
+ subject.statsd.should_receive(:increment).with('state.long_lived')
38
40
  subject.run!
39
41
  end
40
42
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql-statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '3.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Carrion
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-15 00:00:00.000000000 Z
11
+ date: 2013-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec