falcore 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +37 -0
- data/bin/falcore +4 -0
- data/falcore.gemspec +1 -1
- data/lib/falcore.rb +3 -2
- data/lib/falcore/dumpers/dogstatsd.rb +80 -0
- data/lib/falcore/version.rb +1 -1
- data/spec/functional/dumpers/dogstatsd_spec.rb +37 -0
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebc83f332274914a6d13586077516e385a0699cf
|
4
|
+
data.tar.gz: 0bf7525e7a91aaa74a40cfc086abd2ef8db434e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8c761b694a8207112f06e86a4511666b3bc3b155a0ebb5a2ff41c93b3ef7b31caff66110792c4073a686753db9bd02b53b066458d625921b82e295544dd938b
|
7
|
+
data.tar.gz: cc5304c2238066debecc98685e7e316e1983f8413ed6cc16765ff1ba8a613a00af30d03e574c4d3e9925076f27af5ca410d80a562ccc9e39119961214957ef67
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -76,6 +76,43 @@ varies by dumper, so consult the documentation accordingly:
|
|
76
76
|
falcore --config /path/to/your/config.falcore --daemon
|
77
77
|
```
|
78
78
|
|
79
|
+
Dumpers
|
80
|
+
-------
|
81
|
+
### Statsd
|
82
|
+
The Statsd dumper is a generic Statsd dumper that namespaces data by hostname.
|
83
|
+
|
84
|
+
```text
|
85
|
+
[statsd]
|
86
|
+
host = 127.0.0.1
|
87
|
+
port = 8125
|
88
|
+
```
|
89
|
+
|
90
|
+
This will dump information to a local Statsd on port 8125. The information is
|
91
|
+
namespaced by the Jenkins master, and slaves are nested under their appropiate
|
92
|
+
master. For example:
|
93
|
+
|
94
|
+
```text
|
95
|
+
jenkins.master.disk_space
|
96
|
+
jenkins.master.slave-12345.disk_space
|
97
|
+
```
|
98
|
+
|
99
|
+
### DogStatsd
|
100
|
+
The DogStatsd dumper is a [DataDog](http://datadoghq.com)-specific dumper that
|
101
|
+
adds additional sugar when pushing the data to DataDog. The format for the
|
102
|
+
configuration is almost identical to Statsd, but with a different config header.
|
103
|
+
|
104
|
+
```text
|
105
|
+
[dogstatsd]
|
106
|
+
host = 127.0.0.1
|
107
|
+
port = 8125
|
108
|
+
```
|
109
|
+
|
110
|
+
This will dump information to a local DogStatsd server running on port 8125.
|
111
|
+
Unlike the Statsd dumper, the information is **not** namespaced. Instead, each
|
112
|
+
node (master or slave) is tagged with a `name` that corresponds to the Jenkins
|
113
|
+
`displayName` attribute. You can then filter or aggregate by `name` to separate
|
114
|
+
information on the graphs.
|
115
|
+
|
79
116
|
|
80
117
|
License & Authors
|
81
118
|
-----------------
|
data/bin/falcore
CHANGED
data/falcore.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
|
-
spec.add_runtime_dependency '
|
27
|
+
spec.add_runtime_dependency 'dogstatsd-ruby', '~> 1.3'
|
28
28
|
|
29
29
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 2.14'
|
data/lib/falcore.rb
CHANGED
@@ -26,8 +26,9 @@ module Falcore
|
|
26
26
|
autoload :Util, 'falcore/util'
|
27
27
|
|
28
28
|
module Dumper
|
29
|
-
autoload :Base,
|
30
|
-
autoload :
|
29
|
+
autoload :Base, 'falcore/dumpers/base'
|
30
|
+
autoload :DogStatsd, 'falcore/dumpers/dogstatsd'
|
31
|
+
autoload :Statsd, 'falcore/dumpers/statsd'
|
31
32
|
end
|
32
33
|
|
33
34
|
module Node
|
@@ -0,0 +1,80 @@
|
|
1
|
+
#
|
2
|
+
# Author: Seth Vargo <sethvargo@gmail.com>
|
3
|
+
#
|
4
|
+
# Copyright 2014 Chef Software, Inc.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'statsd'
|
20
|
+
|
21
|
+
module Falcore
|
22
|
+
class Dumper::DogStatsd < Dumper::Base
|
23
|
+
validate do
|
24
|
+
presence!('DogStatsd host') { config.dogstatsd.host }
|
25
|
+
presence!('DogStatsd port') { config.dogstatsd.port }
|
26
|
+
end
|
27
|
+
|
28
|
+
run do
|
29
|
+
stat(master)
|
30
|
+
master.slaves.each(&method(:stat))
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def statsd
|
36
|
+
@statsd ||= Statsd.new(config.dogstatsd.host, config.dogstatsd.port)
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# @private
|
41
|
+
#
|
42
|
+
# Push stats to statsd for this particular +node+.
|
43
|
+
#
|
44
|
+
# @param [Node::Base] node
|
45
|
+
# the node to examine
|
46
|
+
#
|
47
|
+
def stat(node)
|
48
|
+
options = {
|
49
|
+
tags: ["name:#{node.display_name}"]
|
50
|
+
}
|
51
|
+
|
52
|
+
# Up/down
|
53
|
+
statsd.gauge('jenkins.node.offline', node.offline? ? 1 : 0, options)
|
54
|
+
|
55
|
+
# Idle
|
56
|
+
statsd.gauge('jenkins.node.idle', node.idle? ? 1 : 0, options)
|
57
|
+
|
58
|
+
# Response time
|
59
|
+
statsd.timing('jenkins.node.response_time', node.response_time, options)
|
60
|
+
|
61
|
+
# Temporary space
|
62
|
+
statsd.gauge('jenkins.node.temporary_space', node.temporary_space, options)
|
63
|
+
|
64
|
+
# Disk space
|
65
|
+
statsd.gauge('jenkins.node.disk_space', node.disk_space, options)
|
66
|
+
|
67
|
+
# Free memory
|
68
|
+
statsd.gauge('jenkins.node.free_memory', node.free_memory, options)
|
69
|
+
|
70
|
+
# Total memory
|
71
|
+
statsd.gauge('jenkins.node.total_memory', node.total_memory, options)
|
72
|
+
|
73
|
+
# Free swap
|
74
|
+
statsd.gauge('jenkins.node.free_swap', node.free_swap, options)
|
75
|
+
|
76
|
+
# Total swap
|
77
|
+
statsd.gauge('jenkins.node.total_swap', node.total_swap, options)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/falcore/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Falcore
|
4
|
+
describe Dumper::DogStatsd, :integration do
|
5
|
+
let(:config) do
|
6
|
+
Config.parse <<-EOH.gsub(/^ {8}/, '')
|
7
|
+
[jenkins]
|
8
|
+
endpoint = http://master.jenkins.example.com
|
9
|
+
|
10
|
+
[dogstatsd]
|
11
|
+
host = 127.0.0.1
|
12
|
+
port = 12345
|
13
|
+
EOH
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:aggregator) { Aggregator.new(config) }
|
17
|
+
let(:master) { aggregator.run }
|
18
|
+
|
19
|
+
subject { Dumper::DogStatsd.new(config, master) }
|
20
|
+
|
21
|
+
it 'validates config.dogstatsd.host is present' do
|
22
|
+
config.dogstatsd.host = nil
|
23
|
+
|
24
|
+
expect {
|
25
|
+
subject.run
|
26
|
+
}.to raise_error(RuntimeError, "Expected 'DogStatsd host' to be set!")
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'validates config.dogstatsd.port is present' do
|
30
|
+
config.dogstatsd.port = nil
|
31
|
+
|
32
|
+
expect {
|
33
|
+
subject.run
|
34
|
+
}.to raise_error(RuntimeError, "Expected 'DogStatsd port' to be set!")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: falcore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: dogstatsd-ruby
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- lib/falcore/aggregator.rb
|
118
118
|
- lib/falcore/config.rb
|
119
119
|
- lib/falcore/dumpers/base.rb
|
120
|
+
- lib/falcore/dumpers/dogstatsd.rb
|
120
121
|
- lib/falcore/dumpers/statsd.rb
|
121
122
|
- lib/falcore/fetcher.rb
|
122
123
|
- lib/falcore/nodes/base.rb
|
@@ -126,6 +127,7 @@ files:
|
|
126
127
|
- lib/falcore/util.rb
|
127
128
|
- lib/falcore/version.rb
|
128
129
|
- spec/fixtures/computer.json
|
130
|
+
- spec/functional/dumpers/dogstatsd_spec.rb
|
129
131
|
- spec/functional/dumpers/statsd_spec.rb
|
130
132
|
- spec/functional/fetcher_spec.rb
|
131
133
|
- spec/spec_helper.rb
|
@@ -164,6 +166,7 @@ summary: A Ruby application for collecting Jenkins node slave status and aggrega
|
|
164
166
|
to multiple output formats.
|
165
167
|
test_files:
|
166
168
|
- spec/fixtures/computer.json
|
169
|
+
- spec/functional/dumpers/dogstatsd_spec.rb
|
167
170
|
- spec/functional/dumpers/statsd_spec.rb
|
168
171
|
- spec/functional/fetcher_spec.rb
|
169
172
|
- spec/spec_helper.rb
|