riemann-client 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -20,8 +20,8 @@ c << {
20
20
  host: 'web3',
21
21
  service: 'api latency',
22
22
  state: 'warn',
23
- metric: 63.5
24
- description: "63.5 milliseconds per request"
23
+ metric: 63.5,
24
+ description: "63.5 milliseconds per request",
25
25
  time: Time.now.to_i - 10
26
26
  }
27
27
 
data/lib/riemann/event.rb CHANGED
@@ -9,6 +9,9 @@ module Riemann
9
9
  optional :description, :string, 5
10
10
  repeated :tags, :string, 7
11
11
  optional :ttl, :float, 8
12
+
13
+ optional :metric_sint64, :sint64, 13
14
+ optional :metric_d, :double, 14
12
15
  optional :metric_f, :float, 15
13
16
 
14
17
  # Average a set of states together. Chooses the mean metric, the mode
@@ -93,8 +96,8 @@ module Riemann
93
96
  init.metric_f ||= states.inject(0.0) { |a, state|
94
97
  a + (state.metric || 0)
95
98
  }
96
- if init.metric_f.nan?
97
- init.metric_f = 0.0
99
+ if init.metric.nan?
100
+ init.metric = 0.0
98
101
  end
99
102
 
100
103
  # Event
@@ -152,7 +155,8 @@ module Riemann
152
155
  def initialize(hash = nil)
153
156
  if hash
154
157
  if hash[:metric]
155
- super hash.merge(:metric_f => hash[:metric])
158
+ super hash
159
+ self.metric = hash[:metric]
156
160
  else
157
161
  super hash
158
162
  end
@@ -164,11 +168,20 @@ module Riemann
164
168
  end
165
169
 
166
170
  def metric
167
- metric_f
171
+ metric_d ||
172
+ metric_sint64 ||
173
+ metric_f
168
174
  end
169
175
 
170
176
  def metric=(m)
171
- self.metric_f = m
177
+ if Integer === m and (-(2**63)...2**63) === m
178
+ # Long
179
+ self.metric_sint64 = m
180
+ self.metric_f = m.to_f
181
+ else
182
+ self.metric_d = m.to_f
183
+ self.metric_f = m.to_f
184
+ end
172
185
  end
173
186
  end
174
187
  end
@@ -0,0 +1 @@
1
+ 56061
@@ -1,3 +1,3 @@
1
1
  module Riemann
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riemann-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-16 00:00:00.000000000 Z
12
+ date: 2012-12-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: beefcake
16
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &5515060 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,15 +21,10 @@ dependencies:
21
21
  version: 0.3.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 0.3.5
24
+ version_requirements: *5515060
30
25
  - !ruby/object:Gem::Dependency
31
26
  name: trollop
32
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &5514260 !ruby/object:Gem::Requirement
33
28
  none: false
34
29
  requirements:
35
30
  - - ! '>='
@@ -37,15 +32,10 @@ dependencies:
37
32
  version: 1.16.2
38
33
  type: :runtime
39
34
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: 1.16.2
35
+ version_requirements: *5514260
46
36
  - !ruby/object:Gem::Dependency
47
37
  name: mtrc
48
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &5513580 !ruby/object:Gem::Requirement
49
39
  none: false
50
40
  requirements:
51
41
  - - ! '>='
@@ -53,12 +43,7 @@ dependencies:
53
43
  version: 0.0.4
54
44
  type: :runtime
55
45
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: 0.0.4
46
+ version_requirements: *5513580
62
47
  description:
63
48
  email: aphyr@aphyr.com
64
49
  executables: []
@@ -66,14 +51,15 @@ extensions: []
66
51
  extra_rdoc_files: []
67
52
  files:
68
53
  - lib/riemann/version.rb
69
- - lib/riemann/event.rb
54
+ - lib/riemann/state.rb
55
+ - lib/riemann/repl-port
70
56
  - lib/riemann/auto_state.rb
71
- - lib/riemann/query.rb
72
- - lib/riemann/client/udp.rb
57
+ - lib/riemann/client.rb
73
58
  - lib/riemann/client/tcp.rb
59
+ - lib/riemann/client/udp.rb
60
+ - lib/riemann/event.rb
61
+ - lib/riemann/query.rb
74
62
  - lib/riemann/metric_thread.rb
75
- - lib/riemann/client.rb
76
- - lib/riemann/state.rb
77
63
  - lib/riemann/message.rb
78
64
  - lib/riemann.rb
79
65
  - LICENSE
@@ -98,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
84
  version: '0'
99
85
  requirements: []
100
86
  rubyforge_project: riemann-client
101
- rubygems_version: 1.8.22
87
+ rubygems_version: 1.8.10
102
88
  signing_key:
103
89
  specification_version: 3
104
90
  summary: Client for the distributed event system Riemann.