mysql-statsd 3.0 → 3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mysql-statsd.rb +5 -6
- data/lib/mysql-statsd/version.rb +1 -1
- data/spec/runner_spec.rb +4 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33315d1d0830c9231d1e5a1caa378c571721035e
|
4
|
+
data.tar.gz: fc0648c6053c4b5e767f12926624b52cc0bf04d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8adf89846ef5a0736a3abf97499d023bb219bb14d0767c72b3e84360c7f55130b31706061a1f677ec398a8254d6a0ee3f4e0eae5cfc4b3baa2b65a7e4f48cb
|
7
|
+
data.tar.gz: f723ab5dc4d0cecad9bd11238a5a4b9b24852bc8caf59c82fc09a7ae76102f67bb69a3ca0a93e21051dc2db7a161c52e75aa373a1e5b9335972f196b4d0c4866
|
data/lib/mysql-statsd.rb
CHANGED
@@ -28,10 +28,9 @@ module Mysql
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def instrument_process_list
|
31
|
-
show
|
32
|
-
|
33
|
-
|
34
|
-
end
|
31
|
+
@process_list = show "PROCESSLIST"
|
32
|
+
instrument_processes "State"
|
33
|
+
instrument_processes "Command"
|
35
34
|
end
|
36
35
|
|
37
36
|
def instrument_statuses
|
@@ -42,8 +41,8 @@ module Mysql
|
|
42
41
|
mysql.query "SHOW #{term}"
|
43
42
|
end
|
44
43
|
|
45
|
-
def
|
46
|
-
"#{
|
44
|
+
def instrument_processes(metric_name)
|
45
|
+
@process_list.map { |row| row[metric_name] }.group_by(&:to_s).each { |metric, values| statsd.gauge "#{metric_name}.#{metric.gsub(" ", "_")}".downcase, values.count }
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
data/lib/mysql-statsd/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -34,9 +34,10 @@ describe Mysql::Statsd::Runner do
|
|
34
34
|
end
|
35
35
|
|
36
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(:
|
39
|
-
subject.statsd.should_receive(:
|
37
|
+
subject.mysql.stub(:query).with("SHOW PROCESSLIST").and_return [{'Command' => 'Jump', 'State' => 'Long Lived'}, {'Command' => 'Jump', 'State' => 'Long Dead'}]
|
38
|
+
subject.statsd.should_receive(:gauge).with('state.long_lived', 1)
|
39
|
+
subject.statsd.should_receive(:gauge).with('state.long_dead', 1)
|
40
|
+
subject.statsd.should_receive(:gauge).with('command.jump', 2)
|
40
41
|
subject.run!
|
41
42
|
end
|
42
43
|
end
|