jenkins_statsd 0.2.0 → 0.3.0

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: 3bba0435e463911efbea5abc1fae0c85aabf7142
4
- data.tar.gz: 5387e77c0fafc1eed91eec7d5073d67f368e8a95
3
+ metadata.gz: cf796a8a056eac63755504806f8366587da4a50a
4
+ data.tar.gz: 0ed8a656638eee903185cb222bb573b968072685
5
5
  SHA512:
6
- metadata.gz: 54e82f30945f30dea148cdb3790f80effbf25ea574293bb4911c7a6fbdcbb1e67ff213207fa7ff508dc41218b221b85f8e95171dbddedb2114d69e1bb312791b
7
- data.tar.gz: 5343b5028a93830bba8172bf4ec2571307bdfd722ea901cb063445815500a90109fd95fb29e0f2f1279494ecf1f53e049eb5199667bc3d7756e469821784d45b
6
+ metadata.gz: 309b0a99a68c38283e2564123b029e9bb450f472c3728488d78614ac381e52bc0de15603fd8b3a340db3d32cc4b89f46261cf6f69bb4b61d2cbc5261240e2f96
7
+ data.tar.gz: 0a57de2b66b701dca9f9ece253072b9264eab5206e2debdd18666f0657dce103b6d21b19d5b91ee16889e60844105c26b3e7d69539daea744768c18cdab78512
@@ -6,11 +6,17 @@ module JenkinsStatsd
6
6
  attr_reader :metrics_url
7
7
 
8
8
  GAUGES_EXCLUDE = [
9
- %r(^jenkins\.versions)
9
+ %r{^jenkins\.versions}
10
10
  ]
11
11
 
12
12
  METERS_EXCLUDE = [
13
- %r(^http)
13
+ %r{^http}
14
+ ]
15
+
16
+ TIMERS_EXCLUDE = [
17
+ %r{^http},
18
+ %r{^jenkins\.health},
19
+ %r{^jenkins\.node}
14
20
  ]
15
21
 
16
22
  def initialize(host, api_token)
@@ -23,6 +29,7 @@ module JenkinsStatsd
23
29
  parsed = JSON.parse(response.body)
24
30
  metrics[:gauges] = extract_gauges(parsed)
25
31
  metrics[:meters] = extract_meters(parsed)
32
+ metrics[:timers] = extract_timers(parsed)
26
33
  metrics
27
34
  end
28
35
 
@@ -47,11 +54,26 @@ module JenkinsStatsd
47
54
 
48
55
  def extract_meters(data)
49
56
  meters = {}
50
- data['meters'].each do |key, value|
57
+ data['meters'].each do |key, components|
51
58
  next if ignore?(key, METERS_EXCLUDE)
52
- meters["#{key}.m1_rate"] = value['m1_rate']
59
+ components.each do |component, value|
60
+ next if component.match(%r{count|units})
61
+ meters["#{key}.#{component}"] = value
62
+ end
53
63
  end
54
64
  meters
55
65
  end
66
+
67
+ def extract_timers(data)
68
+ timers = {}
69
+ data['timers'].each do |key, components|
70
+ next if ignore?(key, TIMERS_EXCLUDE)
71
+ components.each do |component, value|
72
+ next unless component.match(%r{max|min|mean})
73
+ timers["#{key}.#{component}"] = value
74
+ end
75
+ end
76
+ timers
77
+ end
56
78
  end
57
79
  end
@@ -1,3 +1,3 @@
1
1
  module JenkinsStatsd
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jenkins_statsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Chun-Lum