active_metric 2.5.2 → 2.5.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -85,8 +85,11 @@ module ActiveMetric
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def current_sample
|
88
|
-
@current_sample ||= self.class.sample_type.new(:samplable => self,
|
89
|
-
|
88
|
+
@current_sample ||= self.class.sample_type.new({:samplable => self,
|
89
|
+
:interval => self.class.interval_length},
|
90
|
+
{},
|
91
|
+
nil,
|
92
|
+
graph_view_model.size)
|
90
93
|
end
|
91
94
|
|
92
95
|
def self.sample_type
|
@@ -62,7 +62,30 @@ module ActiveMetric
|
|
62
62
|
assert_equal [[2,4],[7,9]], gvm.series_for("max_value").data
|
63
63
|
end
|
64
64
|
|
65
|
+
test "retrieving existing subject allows series data to be updated where it left off" do
|
66
|
+
report = Report.create
|
67
|
+
subject = TestSubject.create :report => report
|
68
|
+
|
69
|
+
14.times do |value|
|
70
|
+
subject.calculate TestMeasurement.new(:value => value, :timestamp => value)
|
71
|
+
end
|
72
|
+
|
73
|
+
subject.complete
|
65
74
|
|
75
|
+
gvm = subject.graph_view_model
|
76
|
+
|
77
|
+
assert_equal [[2,4],[7,9],[11,13]], gvm.series_for("max_value").data
|
78
|
+
|
79
|
+
same_subject = TestSubject.where(:report => report).first
|
80
|
+
|
81
|
+
same_subject.calculate TestMeasurement.new(:value => 14, :timestamp => 14)
|
82
|
+
same_subject.complete
|
83
|
+
|
84
|
+
same_gvm = same_subject.graph_view_model
|
85
|
+
|
86
|
+
same_subject.update_series_data
|
87
|
+
assert_equal [[2,4],[7,9],[11,13],[14,14]], same_gvm.series_for("max_value").data
|
88
|
+
end
|
66
89
|
|
67
90
|
end
|
68
91
|
end
|
data/test/stat_test.rb
CHANGED
@@ -185,6 +185,16 @@ module ActiveMetric
|
|
185
185
|
assert_equal 25, stat.value
|
186
186
|
end
|
187
187
|
|
188
|
+
test "can calculate 80th percentile" do
|
189
|
+
stat = Eightieth.new(:value, :calculable => @sample)
|
190
|
+
values = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
191
|
+
values.each_with_index do |value, index|
|
192
|
+
@subject.update_subject_calculators TestMeasurement.new(:value => value, :timesteamp => values[index])
|
193
|
+
end
|
194
|
+
stat.complete
|
195
|
+
assert_equal 11, stat.value
|
196
|
+
end
|
197
|
+
|
188
198
|
|
189
199
|
#this test is here for the user, not for automated tests
|
190
200
|
#test "random distributions are good too" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_metric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2013-
|
17
|
+
date: 2013-12-16 00:00:00.000000000 Z
|
18
18
|
dependencies: []
|
19
19
|
description: ActiveMetric is a mongo based statistics calculator and persistance layer
|
20
20
|
email:
|
@@ -84,9 +84,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
- - ! '>='
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
|
-
segments:
|
88
|
-
- 0
|
89
|
-
hash: 881746595493551969
|
90
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
88
|
none: false
|
92
89
|
requirements:
|