travis-metrics 2.0.0.rc1 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +11 -3
- data/lib/travis/metrics/reporter/riemann.rb +47 -0
- data/lib/travis/metrics/version.rb +1 -1
- data/lib/travis/metrics.rb +6 -8
- data/spec/travis/metrics/reporter/riemann_spec.rb +38 -0
- 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: 4bdef9f8c02b1e952172f58ce58e9f877764f658
|
4
|
+
data.tar.gz: 3adb2e6bd4a34cf05b3a75a7b7ab6abbebc219fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b40e9efd5d6387779db058692255c4691a5a412f71fc735da3039c00cd6a8948dbc8e7055e66bb0fd3a6b36c6e79c6f4e23169176582c2877e4ff732e6515405
|
7
|
+
data.tar.gz: c43b0afd47de667cf50b0d13b0c6661b7cef273d4811e96aa4bb17914dae303b206b1c769fda05afdf7f1da6cd80cf72001197b19a2b7b72263d5cdad6801c74
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
travis-metrics (0.0.
|
4
|
+
travis-metrics (2.0.0.rc1)
|
5
5
|
metriks-librato_metrics (~> 1.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,14 +10,20 @@ GEM
|
|
10
10
|
atomic (1.1.99)
|
11
11
|
avl_tree (1.2.1)
|
12
12
|
atomic (~> 1.1)
|
13
|
+
beefcake (1.2.0)
|
13
14
|
diff-lcs (1.2.5)
|
14
|
-
hitimes (1.2.
|
15
|
+
hitimes (1.2.4)
|
15
16
|
metriks (0.9.9.7)
|
16
17
|
atomic (~> 1.0)
|
17
18
|
avl_tree (~> 1.2.0)
|
18
19
|
hitimes (~> 1.1)
|
19
|
-
metriks-librato_metrics (1.0.
|
20
|
+
metriks-librato_metrics (1.0.5)
|
20
21
|
metriks (>= 0.9.9.6)
|
22
|
+
mtrc (0.0.4)
|
23
|
+
riemann-client (0.0.8)
|
24
|
+
beefcake (>= 0.3.5)
|
25
|
+
mtrc (>= 0.0.4)
|
26
|
+
trollop (>= 1.16.2)
|
21
27
|
rspec (3.3.0)
|
22
28
|
rspec-core (~> 3.3.0)
|
23
29
|
rspec-expectations (~> 3.3.0)
|
@@ -31,11 +37,13 @@ GEM
|
|
31
37
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
38
|
rspec-support (~> 3.3.0)
|
33
39
|
rspec-support (3.3.0)
|
40
|
+
trollop (2.1.2)
|
34
41
|
|
35
42
|
PLATFORMS
|
36
43
|
ruby
|
37
44
|
|
38
45
|
DEPENDENCIES
|
46
|
+
riemann-client (~> 0.0.7)
|
39
47
|
rspec
|
40
48
|
travis-metrics!
|
41
49
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
begin
|
2
|
+
require 'metriks/reporter/riemann'
|
3
|
+
rescue LoadError
|
4
|
+
end
|
5
|
+
|
6
|
+
module Travis
|
7
|
+
class Metrics
|
8
|
+
module Reporter
|
9
|
+
class Riemann < Struct.new(:config)
|
10
|
+
#MSGS = {
|
11
|
+
#setup: 'Using Librato metrics reporter (source: %s, account: %s)',
|
12
|
+
#error: 'Librato error: %s (%s)'
|
13
|
+
#}
|
14
|
+
|
15
|
+
def setup
|
16
|
+
#return unless host
|
17
|
+
#logger.info MSGS[:setup] % [source, email]
|
18
|
+
Metriks::Reporter::Riemann.new(client, interval: interval)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def client
|
24
|
+
::Riemann::Client.new(host,port)
|
25
|
+
end
|
26
|
+
|
27
|
+
def host
|
28
|
+
"host"
|
29
|
+
#config[:host]
|
30
|
+
end
|
31
|
+
|
32
|
+
def port
|
33
|
+
"port"
|
34
|
+
#config[:port]
|
35
|
+
end
|
36
|
+
|
37
|
+
def interval
|
38
|
+
config[:interval]
|
39
|
+
end
|
40
|
+
|
41
|
+
#def on_error(e)
|
42
|
+
#logger.error MSGS[:error] % [e.message, e.response.body]
|
43
|
+
#end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/travis/metrics.rb
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'metriks'
|
2
2
|
require 'travis/metrics/reporter/librato'
|
3
3
|
require 'travis/metrics/reporter/graphite'
|
4
|
+
require 'travis/metrics/reporter/riemann'
|
4
5
|
|
5
6
|
module Travis
|
6
7
|
class Metrics
|
7
8
|
class << self
|
8
|
-
attr_reader :reporter
|
9
|
-
|
10
9
|
MSGS = {
|
11
10
|
no_reporter: 'No metrics reporter configured.',
|
12
11
|
error: '"Exception while starting metrics reporter: %s"'
|
13
12
|
}
|
14
13
|
|
14
|
+
attr_reader :reporter
|
15
|
+
|
15
16
|
def setup(config, logger)
|
16
17
|
config[:reporter] ? start(config, logger) : logger.info(MSGS[:no_reporter])
|
17
18
|
new
|
@@ -22,12 +23,9 @@ module Travis
|
|
22
23
|
def start(config, logger)
|
23
24
|
adapter = config[:reporter]
|
24
25
|
config = config[adapter.to_sym] || {}
|
25
|
-
|
26
|
-
reporter.
|
27
|
-
|
28
|
-
|
29
|
-
def started?
|
30
|
-
!!reporter
|
26
|
+
const = Reporter.const_get(adapter.capitalize) rescue nil
|
27
|
+
@reporter = const && const.new(config, logger)
|
28
|
+
reporter.setup if reporter
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
describe Travis::Metrics::Reporter::Riemann do
|
2
|
+
let(:config) { { client: client, host: host, port: 1234 } }
|
3
|
+
let(:host) { 'https://example.com' }
|
4
|
+
let(:client) { ::Riemann::Client.new(config) }
|
5
|
+
let(:reporter) { described_class.new(config) }
|
6
|
+
subject { reporter.setup }
|
7
|
+
|
8
|
+
#def log
|
9
|
+
#reporter.setup
|
10
|
+
#super
|
11
|
+
#end
|
12
|
+
|
13
|
+
#describe 'setup' do
|
14
|
+
#describe 'returns nil if host is missing' do
|
15
|
+
#let(:host) { nil }
|
16
|
+
#it { expect(subject).to be_nil }
|
17
|
+
#end
|
18
|
+
|
19
|
+
describe 'returns a riemann reporter' do
|
20
|
+
xit { expect(subject).to be_kind_of(Metriks::Reporter::Riemann) }
|
21
|
+
#it { expect(log).to include "Using Graphite metrics reporter (host: #{host}, port: 1234)" }
|
22
|
+
end
|
23
|
+
|
24
|
+
#describe 'on_error' do
|
25
|
+
#let(:error) { StandardError.new('message') }
|
26
|
+
#before { allow(error).to receive(:response).and_return(double(body: 'body')) }
|
27
|
+
#before { allow_any_instance_of(Metriks::Reporter::Graphite).to receive(:write).and_raise(error) }
|
28
|
+
|
29
|
+
#before do
|
30
|
+
#subject.start
|
31
|
+
#sleep 0.1 # ugh.
|
32
|
+
#subject.stop
|
33
|
+
#end
|
34
|
+
|
35
|
+
#it { expect(stdout.string).to include 'Graphite error: message (body)' }
|
36
|
+
#end
|
37
|
+
#end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis CI
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metriks-librato_metrics
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/travis/metrics.rb
|
38
38
|
- lib/travis/metrics/reporter/graphite.rb
|
39
39
|
- lib/travis/metrics/reporter/librato.rb
|
40
|
+
- lib/travis/metrics/reporter/riemann.rb
|
40
41
|
- lib/travis/metrics/sidekiq.rb
|
41
42
|
- lib/travis/metrics/version.rb
|
42
43
|
- spec/spec_helper.rb
|
@@ -44,6 +45,7 @@ files:
|
|
44
45
|
- spec/travis/metrics/instrument_spec.rb
|
45
46
|
- spec/travis/metrics/reporter/graphite_spec.rb
|
46
47
|
- spec/travis/metrics/reporter/librato_spec.rb
|
48
|
+
- spec/travis/metrics/reporter/riemann_spec.rb
|
47
49
|
- travis-metrics.gemspec
|
48
50
|
homepage: https://github.com/travis-ci/travis-instrumentation
|
49
51
|
licenses: []
|