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 +4 -4
- data/lib/jenkins_statsd/jenkins_client.rb +26 -4
- data/lib/jenkins_statsd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf796a8a056eac63755504806f8366587da4a50a
|
4
|
+
data.tar.gz: 0ed8a656638eee903185cb222bb573b968072685
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
9
|
+
%r{^jenkins\.versions}
|
10
10
|
]
|
11
11
|
|
12
12
|
METERS_EXCLUDE = [
|
13
|
-
%r
|
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,
|
57
|
+
data['meters'].each do |key, components|
|
51
58
|
next if ignore?(key, METERS_EXCLUDE)
|
52
|
-
|
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
|