mysql-statsd 4.0 → 4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -0
- data/lib/mysql-statsd.rb +1 -1
- data/lib/mysql-statsd/version.rb +1 -1
- data/spec/config_without_queries.yml +7 -0
- data/spec/runner_spec.rb +10 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69e5a9b210509c0c97ea0936f69dd03254a98969
|
4
|
+
data.tar.gz: 978c04604ac3d370393e6e3927c7a21e0b35361d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a03863d9973e918f4ba057959056860d15145155a950db83388b9d61adf81ae72ed73ecb55605cd270ccf764630fda7753476e88b455c3fb9933106a093f167
|
7
|
+
data.tar.gz: 1270c45a07b93787b10059c7f17593863327898caebbabe08328b582f8c0612d94abb3d7a63409b7d3bb3fa77999f648fbf51a4fadea3983e18b1bfab43c9da5
|
data/README.md
CHANGED
@@ -4,6 +4,18 @@ Sends data to StatsD from this queries:
|
|
4
4
|
|
5
5
|
* SHOW GLOBAL STATUS
|
6
6
|
* SHOW PROCESSLIST
|
7
|
+
* Custom
|
8
|
+
|
9
|
+
## Custom Queries
|
10
|
+
|
11
|
+
Define them in the config file under mysql.queries . For example:
|
12
|
+
|
13
|
+
mysql:
|
14
|
+
...
|
15
|
+
database: app_production
|
16
|
+
queries:
|
17
|
+
- SELECT count(1) as 'users.count' from users
|
18
|
+
- SELECT count(1) as 'premium_users.count' from users where premium = 1
|
7
19
|
|
8
20
|
## Installation
|
9
21
|
|
data/lib/mysql-statsd.rb
CHANGED
@@ -39,7 +39,7 @@ module Mysql
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def instrument_queries
|
42
|
-
config['mysql']['queries'].map { |query| mysql.query(query).first }.compact.each do |entry|
|
42
|
+
(config['mysql']['queries'] || []).map { |query| mysql.query(query).first }.compact.each do |entry|
|
43
43
|
statsd.gauge *entry.to_a.flatten
|
44
44
|
end
|
45
45
|
end
|
data/lib/mysql-statsd/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'mysql-statsd'
|
2
2
|
|
3
3
|
describe Mysql::Statsd::Runner do
|
4
|
-
|
4
|
+
let(:config_path) { "spec/config.yml" }
|
5
|
+
subject { Mysql::Statsd::Runner.new config_path }
|
5
6
|
|
6
7
|
before :each do
|
7
8
|
Mysql2::Client.any_instance.stub :connect
|
@@ -46,5 +47,13 @@ describe Mysql::Statsd::Runner do
|
|
46
47
|
subject.statsd.should_receive(:gauge).with('users.count', 15)
|
47
48
|
subject.run!
|
48
49
|
end
|
50
|
+
|
51
|
+
context "with a config file without queries" do
|
52
|
+
let(:config_path) { "spec/config_without_queries.yml" }
|
53
|
+
|
54
|
+
it "should not break" do
|
55
|
+
lambda { subject.run! }.should_not raise_exception
|
56
|
+
end
|
57
|
+
end
|
49
58
|
end
|
50
59
|
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.
|
4
|
+
version: '4.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Carrion
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- lib/mysql-statsd/version.rb
|
72
72
|
- mysql-statsd.gemspec
|
73
73
|
- spec/config.yml
|
74
|
+
- spec/config_without_queries.yml
|
74
75
|
- spec/runner_spec.rb
|
75
76
|
homepage: ''
|
76
77
|
licenses: []
|
@@ -97,4 +98,5 @@ specification_version: 4
|
|
97
98
|
summary: Picks data from MySQL and sends it to StatsD
|
98
99
|
test_files:
|
99
100
|
- spec/config.yml
|
101
|
+
- spec/config_without_queries.yml
|
100
102
|
- spec/runner_spec.rb
|