collective-metrics 0.1.9 → 0.1.10
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/Gemfile +1 -0
- data/README.md +2 -0
- data/lib/collective/collector.rb +6 -0
- data/lib/collective/collectors/mongodb.rb +28 -0
- data/lib/collective/collectors/rabbitmq.rb +0 -4
- data/lib/collective/version.rb +1 -1
- data/lib/collective.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 379c0c2d2acab801d80078737558b671ca1dae95
|
4
|
+
data.tar.gz: 30738a23f12a71cdd9ae100364158a30843ab82e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 346d61c9ceab426f7da3ecf1240e45b13202ad1884288a792fe0e34f5cff84adde525f063cf4a3986b12f5772e805fbdbe3415c2769e1f1b16d98d72e1f09aff
|
7
|
+
data.tar.gz: 721dde8e9e5769c6de1dc8aefce6d64f72cdce8c403daf02ab614ec71e060ff860e706becb4fa91de05539b02319d9c65ffb20d83eab6beb93a220f2be506c5d
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,7 @@ It includes collectors for the following:
|
|
22
22
|
* Redis
|
23
23
|
* Memcached
|
24
24
|
* RabbitMQ (You need to have the management plugin enabled)
|
25
|
+
* MongoDB
|
25
26
|
|
26
27
|
## Installation
|
27
28
|
|
@@ -39,6 +40,7 @@ Add a Collectfile:
|
|
39
40
|
use Collective::Collectors::Sidekiq
|
40
41
|
use Collective::Collectors::Redis
|
41
42
|
use Collective::Collectors::RabbitMQ, url: ENV['RABBITMQ_MANAGEMENT_URL']
|
43
|
+
use Collective::Collectors::Mongodb, config: File.expand_path('./config/mongoid.yml')
|
42
44
|
```
|
43
45
|
|
44
46
|
Start the collectors.
|
data/lib/collective/collector.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Collective::Collectors
|
2
|
+
class Mongodb < Collective::Collector
|
3
|
+
requires :mongoid
|
4
|
+
|
5
|
+
collect do
|
6
|
+
db = stats.delete('db')
|
7
|
+
|
8
|
+
group 'mongodb' do |group|
|
9
|
+
stats.each do |metric, value|
|
10
|
+
group.instrument metric, value, source: db if instrumentable?(value)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def stats
|
18
|
+
session.command(dbStats: 1, scale: 1)
|
19
|
+
end
|
20
|
+
|
21
|
+
def session
|
22
|
+
@session ||= begin
|
23
|
+
Mongoid.load!(options[:config])
|
24
|
+
Mongoid.default_session
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/collective/version.rb
CHANGED
data/lib/collective.rb
CHANGED
@@ -12,6 +12,7 @@ module Collective
|
|
12
12
|
autoload :Redis, 'collective/collectors/redis'
|
13
13
|
autoload :Memcached, 'collective/collectors/memcached'
|
14
14
|
autoload :RabbitMQ, 'collective/collectors/rabbitmq'
|
15
|
+
autoload :Mongodb, 'collective/collectors/mongodb'
|
15
16
|
end
|
16
17
|
|
17
18
|
class << self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collective-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric J. Holmes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rufus-scheduler
|
@@ -151,6 +151,7 @@ files:
|
|
151
151
|
- lib/collective/collector.rb
|
152
152
|
- lib/collective/collector/dsl.rb
|
153
153
|
- lib/collective/collectors/memcached.rb
|
154
|
+
- lib/collective/collectors/mongodb.rb
|
154
155
|
- lib/collective/collectors/rabbitmq.rb
|
155
156
|
- lib/collective/collectors/redis.rb
|
156
157
|
- lib/collective/collectors/sidekiq.rb
|