mysql-statsd 0.0.1 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +4 -0
- data/lib/mysql-statsd.rb +12 -5
- data/lib/mysql-statsd/version.rb +1 -1
- data/spec/runner_spec.rb +16 -0
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f9a7420bd091f1b7919f1daca835cadb13ca9601
|
4
|
+
data.tar.gz: 151df80630308b8f1e4f1b7bb11005143dcb4bde
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0d52dd5a554ad9e713832ebb4aee30359a694431b2b1f352b5132d641023b2f046d27a2fc945c10d1d60662a6a6a6acae8ec4561ac418ed114cf313c2a46acbc
|
7
|
+
data.tar.gz: ef2bd48b5a3d86efe7a9f6ee38dc111230972d3413468f0ee76000c6ddd1920758e8381ad8c8d1e324630f9c91941594140f276287fb894d4dfcc429c56733c8
|
data/README.md
CHANGED
data/lib/mysql-statsd.rb
CHANGED
@@ -13,9 +13,8 @@ module Mysql
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def run!
|
16
|
-
|
17
|
-
|
18
|
-
end
|
16
|
+
instrument_statuses
|
17
|
+
instrument_process_list
|
19
18
|
end
|
20
19
|
|
21
20
|
def statsd
|
@@ -28,8 +27,16 @@ module Mysql
|
|
28
27
|
|
29
28
|
private
|
30
29
|
|
31
|
-
def
|
32
|
-
|
30
|
+
def instrument_process_list
|
31
|
+
show("PROCESSLIST").each { |entry| statsd.increment entry["Command"].downcase }
|
32
|
+
end
|
33
|
+
|
34
|
+
def instrument_statuses
|
35
|
+
show("GLOBAL STATUS").each { |entry| statsd.gauge entry["Variable_name"].downcase, entry["Value"] }
|
36
|
+
end
|
37
|
+
|
38
|
+
def show(term)
|
39
|
+
mysql.query "SHOW #{term}"
|
33
40
|
end
|
34
41
|
end
|
35
42
|
end
|
data/lib/mysql-statsd/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -22,4 +22,20 @@ describe Mysql::Statsd::Runner do
|
|
22
22
|
it "should set the mysql user from the config file" do
|
23
23
|
subject.mysql.query_options[:username].should == 'user'
|
24
24
|
end
|
25
|
+
|
26
|
+
describe "#run!" do
|
27
|
+
before :each do
|
28
|
+
subject.mysql.stub(:query).and_return []
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should query the global status" do
|
32
|
+
subject.mysql.should_receive(:query).with("SHOW GLOBAL STATUS").and_return [{'Variable_name' => 'Fake', 'Value' => 1}]
|
33
|
+
subject.run!
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should query the process list" do
|
37
|
+
subject.mysql.should_receive(:query).with("SHOW PROCESSLIST").and_return [{'Command' => 'Fake'}]
|
38
|
+
subject.run!
|
39
|
+
end
|
40
|
+
end
|
25
41
|
end
|
metadata
CHANGED
@@ -1,62 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mysql-statsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: '2.0'
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Diego Carrion
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: mysql2
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: statsd-ruby
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: Picks data from MySQL and sends it to StatsD
|
@@ -80,27 +73,26 @@ files:
|
|
80
73
|
- spec/runner_spec.rb
|
81
74
|
homepage: ''
|
82
75
|
licenses: []
|
76
|
+
metadata: {}
|
83
77
|
post_install_message:
|
84
78
|
rdoc_options: []
|
85
79
|
require_paths:
|
86
80
|
- lib
|
87
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
82
|
requirements:
|
90
|
-
- -
|
83
|
+
- - '>='
|
91
84
|
- !ruby/object:Gem::Version
|
92
85
|
version: '0'
|
93
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
87
|
requirements:
|
96
|
-
- -
|
88
|
+
- - '>='
|
97
89
|
- !ruby/object:Gem::Version
|
98
90
|
version: '0'
|
99
91
|
requirements: []
|
100
92
|
rubyforge_project:
|
101
|
-
rubygems_version:
|
93
|
+
rubygems_version: 2.0.3
|
102
94
|
signing_key:
|
103
|
-
specification_version:
|
95
|
+
specification_version: 4
|
104
96
|
summary: Picks data from MySQL and sends it to StatsD
|
105
97
|
test_files:
|
106
98
|
- spec/runner_spec.rb
|