graphite-metric 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -36,18 +36,24 @@ module GraphiteMetric
36
36
  raw_headers, raw_metrics = raw.split("|")
37
37
 
38
38
  metric_name, from, to, step = raw_headers.split(",")
39
-
39
+
40
40
  current_step = 0
41
41
  raw_metrics.split(",").each do |raw_metric|
42
42
  @metrics << {
43
43
  :key => metric_name,
44
44
  :timestamp => from.to_i + current_step,
45
- :value => Float(raw_metric)
45
+ :value => float(raw_metric)
46
46
  }
47
47
  current_step += step.to_i
48
48
  end
49
49
  end
50
50
  self
51
51
  end
52
+
53
+ def float(raw_metric)
54
+ Float(raw_metric)
55
+ rescue
56
+ 0
57
+ end
52
58
  end
53
59
  end
@@ -1,3 +1,3 @@
1
1
  module GraphiteMetric
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -1,2 +1,2 @@
1
- my.first.metric,1336559725,1336559845,60|10.0,9.21,8.333
1
+ my.first.metric,1336559725,1336559845,60|None,9.21,8.333
2
2
  my.second.metric,1336559725,1336559845,60|1.1,2.999,3.50
@@ -1 +1 @@
1
- my.metric,1336559725,1336559845,60|34.999,35.10,33.0
1
+ my.metric,1336559725,1336559845,60|34.999,35.10,None
data/test/test_helper.rb CHANGED
@@ -27,7 +27,7 @@ module TestHelpers
27
27
  {
28
28
  :key => "my.metric",
29
29
  :timestamp => 1336559845,
30
- :value => 33.0
30
+ :value => 0
31
31
  }
32
32
  ]
33
33
  end
@@ -41,7 +41,7 @@ module TestHelpers
41
41
  {
42
42
  :key => "my.first.metric",
43
43
  :timestamp => 1336559725,
44
- :value => 10.0
44
+ :value => 0
45
45
  },
46
46
  {
47
47
  :key => "my.first.metric",
@@ -76,7 +76,7 @@ module TestHelpers
76
76
  "my.first.metric" => [
77
77
  {
78
78
  :timestamp => 1336559725,
79
- :value => 10.0
79
+ :value => 0
80
80
  },
81
81
  {
82
82
  :timestamp => 1336559785,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphite-metric
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: