moro 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34ef7c854e9ecea55267282eb62a5a681e3d22de
4
- data.tar.gz: a9e86c9356324eec44e9205f3fa9e238ba61166b
3
+ metadata.gz: 34adee1dfcd02a1f9c4c579d64b42cbb5b728591
4
+ data.tar.gz: 12eb654e192d7a43ce5839de430c6573a0486762
5
5
  SHA512:
6
- metadata.gz: 0e181b7fecd3194c9f9ca86dccc6ad5b5999ab3de82e35d19f75acddec3377a6a5301a4358194d88db32e1e352c666840fb8798bb7cf2366c87508a1e32eedce
7
- data.tar.gz: 05738de3acba23639280f986f009cab8c5e8c6255bfd1a9c7fde7468a2e9a4bfb05cf91fd371ad949c93116e06fea655b5b5ad0d6685ceebf9392fdcbb6d8a61
6
+ metadata.gz: 2eb41a49b96ba502cdccca48eed86baadf06efbfbbf0316d5fc95c35adeb9c9eb2f0dcbb5187a9d24a316b283fc68d62e53d20a0b426f8c067a7c36216ee8b53
7
+ data.tar.gz: 9909631abab312bacc72f0d94ded75e3370a409b405a04e499cff58dce1e90ecd319c54b93f1ee07cf38b4f85c5a7a38eec7cd7b8dd338c6a90394c05a214014
data/.gitignore CHANGED
@@ -1,3 +1,3 @@
1
1
  app.log
2
- config.json
3
- *.gem
2
+ *.gem
3
+ tmp
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ##0.0.10
2
+ * add tags to datadog
3
+
1
4
  ##0.0.9
2
5
  * fix datadog send data problem
3
6
 
data/config.example.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "processes": [{
3
3
  "name": "unicorn",
4
- "pid": "/Users/ocowchun/projects/github/jobboard/tmp/pids/server.pid"
4
+ "pid": "rails_project/tmp/pids/server.pid"
5
5
  }],
6
6
  "interval": 30,
7
7
  "datadog": false
data/lib/moro/datadog.rb CHANGED
@@ -10,7 +10,9 @@ module Moro
10
10
  def send(process_usages)
11
11
  process_usages.each do |process|
12
12
  name=process[:name]
13
- @statsd.histogram("#{name}.memory", process[:memory])
13
+ tags=process[:tags]
14
+ memory=process[:memory]
15
+ @statsd.histogram("#{name}.memory",memory , :tags =>tags)
14
16
  end
15
17
  end
16
18
 
data/lib/moro/monitor.rb CHANGED
@@ -32,7 +32,7 @@ module Moro
32
32
  def get_processes()
33
33
  processes=[]
34
34
  @config["processes"].each do|p|
35
- processes<<Process.new({name:p["name"],file:p["pid"]})
35
+ processes<<Process.new({name:p["name"],file:p["pid"],tags:p["tags"]})
36
36
  end
37
37
  processes
38
38
  end
data/lib/moro/process.rb CHANGED
@@ -2,12 +2,17 @@ require "get_process_mem"
2
2
 
3
3
  module Moro
4
4
  class Process
5
- attr_reader :name,:pid,:file
5
+ attr_reader :name,:pid,:file,:tags
6
6
 
7
7
  def initialize(options)
8
8
  @logger = Logger.new STDOUT
9
9
  @name=options[:name]
10
10
  @file=options[:file]
11
+ if options[:tags]!=nil
12
+ @tags=options[:tags]
13
+ else
14
+ @tags=[]
15
+ end
11
16
  update_pid
12
17
  end
13
18
 
@@ -20,10 +25,10 @@ module Moro
20
25
  end
21
26
  pm=GetProcessMem.new(pid)
22
27
  mem = pm.mb
23
- {name:name,memory:mem}
28
+ {name:name,memory:mem,tags:tags}
24
29
  else
25
30
  update_pid
26
- {name:name,memory:0.0}
31
+ {name:name,memory:0.0,tags:tags}
27
32
  end
28
33
  end
29
34
 
data/lib/moro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Moro
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - ocowchun