travis-metrics 2.0.0.rc2 → 2.0.0.rc3

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: 4bdef9f8c02b1e952172f58ce58e9f877764f658
4
- data.tar.gz: 3adb2e6bd4a34cf05b3a75a7b7ab6abbebc219fc
3
+ metadata.gz: a3380d5ee57e2427a63b514dd6b4571fae800217
4
+ data.tar.gz: 5f27c608e00aa5a891c4bdb174905d874c60854c
5
5
  SHA512:
6
- metadata.gz: b40e9efd5d6387779db058692255c4691a5a412f71fc735da3039c00cd6a8948dbc8e7055e66bb0fd3a6b36c6e79c6f4e23169176582c2877e4ff732e6515405
7
- data.tar.gz: c43b0afd47de667cf50b0d13b0c6661b7cef273d4811e96aa4bb17914dae303b206b1c769fda05afdf7f1da6cd80cf72001197b19a2b7b72263d5cdad6801c74
6
+ metadata.gz: dbbd4ca2a88f1b72440561ea114514201006480711c24f1e976ded7483b7817d78db6692bf0364acc1b0f2f6dae9bbf2e151aaa60ea1a1f9ee32f2078ffa783a
7
+ data.tar.gz: 3356bff220359009b532ee3e97f0b97be7be9d143d7e85ace25d2cc1c2fa6403f83ef61eb73416cbe0cc3e123683a5cb99c3e107479863c385fadcd994dfbb60
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- travis-metrics (2.0.0.rc1)
4
+ travis-metrics (2.0.0.rc2)
5
5
  metriks-librato_metrics (~> 1.0)
6
6
 
7
7
  GEM
@@ -12,7 +12,9 @@ module Travis
12
12
  def setup
13
13
  return unless host
14
14
  logger.info MSGS[:setup] % [host, port]
15
- Metriks::Reporter::Graphite.new(host, port, interval: interval, on_error: method(:on_error))
15
+ reporter = Metriks::Reporter::Graphite.new(host, port, interval: interval, on_error: method(:on_error))
16
+ reporter.start
17
+ reporter
16
18
  end
17
19
 
18
20
  private
@@ -12,7 +12,9 @@ module Travis
12
12
  def setup
13
13
  return unless email && token
14
14
  logger.info MSGS[:setup] % [source, email]
15
- Metriks::LibratoMetricsReporter.new(email, token, source: source, on_error: method(:on_error))
15
+ reporter = Metriks::LibratoMetricsReporter.new(email, token, source: source, on_error: method(:on_error))
16
+ reporter.start
17
+ reporter
16
18
  end
17
19
 
18
20
  private
@@ -1,5 +1,5 @@
1
1
  module Travis
2
2
  class Metrics
3
- VERSION = "2.0.0.rc2"
3
+ VERSION = "2.0.0.rc3"
4
4
  end
5
5
  end
@@ -11,38 +11,43 @@ module Travis
11
11
  error: '"Exception while starting metrics reporter: %s"'
12
12
  }
13
13
 
14
- attr_reader :reporter
15
-
16
14
  def setup(config, logger)
17
- config[:reporter] ? start(config, logger) : logger.info(MSGS[:no_reporter])
18
- new
15
+ reporter = config[:reporter] ? start(config, logger) : logger.info(MSGS[:no_reporter])
16
+ new(reporter)
19
17
  rescue Exception => e
20
18
  logger.error [e.message, e.backtrace].join("\n")
21
19
  end
22
20
 
23
21
  def start(config, logger)
24
- adapter = config[:reporter]
25
- config = config[adapter.to_sym] || {}
26
- const = Reporter.const_get(adapter.capitalize) rescue nil
27
- @reporter = const && const.new(config, logger)
22
+ adapter = config[:reporter]
23
+ config = config[adapter.to_sym] || {}
24
+ const = Reporter.const_get(adapter.capitalize) rescue nil
25
+ reporter = const && const.new(config, logger)
28
26
  reporter.setup if reporter
27
+ reporter
29
28
  end
30
29
  end
31
30
 
31
+ attr_reader :reporter
32
+
33
+ def initialize(reporter)
34
+ @reporter = reporter
35
+ end
36
+
32
37
  def count(key)
33
- Metriks.counter(key).increment
38
+ Metriks.counter(key).increment if reporter
34
39
  end
35
40
 
36
41
  def meter(key)
37
- Metriks.meter(key).mark
42
+ Metriks.meter(key).mark if reporter
38
43
  end
39
44
 
40
45
  def time(key, &block)
41
- Metriks.timer(key).time(&block)
46
+ Metriks.timer(key).time(&block) if reporter
42
47
  end
43
48
 
44
49
  def gauge(key, value)
45
- Metriks.gauge(key).set(value)
50
+ Metriks.gauge(key).set(value) if reporter
46
51
  end
47
52
  end
48
53
  end
@@ -1,5 +1,5 @@
1
1
  describe Travis::Metrics do
2
- let(:metrics) { described_class.new }
2
+ let(:metrics) { described_class.new(double('reporter')) }
3
3
  let(:key) { :foo }
4
4
  let(:obj) { double }
5
5
 
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.homepage = 'https://github.com/travis-ci/travis-instrumentation'
12
12
  s.summary = 'Instrumentation for Travis CI'
13
13
  s.description = "#{s.summary}."
14
+ s.licenses = ['MIT']
14
15
 
15
16
  s.files = Dir['{lib/**/*,spec/**/*,[A-Z]*}']
16
17
  s.platform = Gem::Platform::RUBY
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.rc2
4
+ version: 2.0.0.rc3
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-10 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metriks-librato_metrics
@@ -48,7 +48,8 @@ files:
48
48
  - spec/travis/metrics/reporter/riemann_spec.rb
49
49
  - travis-metrics.gemspec
50
50
  homepage: https://github.com/travis-ci/travis-instrumentation
51
- licenses: []
51
+ licenses:
52
+ - MIT
52
53
  metadata: {}
53
54
  post_install_message:
54
55
  rdoc_options: []