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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/travis/metrics/reporter/graphite.rb +3 -1
- data/lib/travis/metrics/reporter/librato.rb +3 -1
- data/lib/travis/metrics/version.rb +1 -1
- data/lib/travis/metrics.rb +17 -12
- data/spec/travis/metrics/instrument_spec.rb +1 -1
- data/travis-metrics.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3380d5ee57e2427a63b514dd6b4571fae800217
|
4
|
+
data.tar.gz: 5f27c608e00aa5a891c4bdb174905d874c60854c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbbd4ca2a88f1b72440561ea114514201006480711c24f1e976ded7483b7817d78db6692bf0364acc1b0f2f6dae9bbf2e151aaa60ea1a1f9ee32f2078ffa783a
|
7
|
+
data.tar.gz: 3356bff220359009b532ee3e97f0b97be7be9d143d7e85ace25d2cc1c2fa6403f83ef61eb73416cbe0cc3e123683a5cb99c3e107479863c385fadcd994dfbb60
|
data/Gemfile.lock
CHANGED
@@ -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
|
data/lib/travis/metrics.rb
CHANGED
@@ -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
|
25
|
-
config
|
26
|
-
const
|
27
|
-
|
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
|
data/travis-metrics.gemspec
CHANGED
@@ -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.
|
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-
|
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: []
|