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 +4 -4
- data/README.md +5 -2
- data/lib/mysql-statsd.rb +8 -1
- data/lib/mysql-statsd/version.rb +1 -1
- data/spec/runner_spec.rb +4 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60c44d6868a4e8bb040d294554b41de7dd8587f2
|
4
|
+
data.tar.gz: 49adbedfb43619aaefe16dfe3c0709a31ab32ee8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6554affeb5a2beb1ad891a96e2b937b56b0bd6f348ce843b1350f6152261a8b8bddcfc860efaff0272cdbe12c651330b21c9d7eb7fef84b6603b6c4188fa5896
|
7
|
+
data.tar.gz: f6af0c38cf068ae98dab1cbcd74a61b24d9502d655acb609ec41082dd8068d1d508c739d1c868039f795536ecedb53a18a337543ff34437e97e9fb0e7a97b622
|
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# MySQL::StatsD
|
2
2
|
|
3
|
-
|
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
|
|
data/lib/mysql-statsd.rb
CHANGED
@@ -28,7 +28,10 @@ module Mysql
|
|
28
28
|
private
|
29
29
|
|
30
30
|
def instrument_process_list
|
31
|
-
show("PROCESSLIST").each
|
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
|
data/lib/mysql-statsd/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -33,8 +33,10 @@ describe Mysql::Statsd::Runner do
|
|
33
33
|
subject.run!
|
34
34
|
end
|
35
35
|
|
36
|
-
it "should
|
37
|
-
subject.mysql.
|
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: '
|
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-
|
11
|
+
date: 2013-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|