metriks 0.9.7.3 → 0.9.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -3
- data/lib/metriks/reporter/librato_metrics.rb +2 -0
- data/lib/metriks/reporter/logger.rb +2 -0
- data/lib/metriks/snapshot.rb +44 -43
- data/lib/metriks.rb +1 -1
- data/metriks.gemspec +2 -2
- data/test/riemann_reporter_test.rb +0 -5
- metadata +19 -20
data/Gemfile
CHANGED
data/lib/metriks/snapshot.rb
CHANGED
@@ -1,58 +1,59 @@
|
|
1
|
+
module Metriks
|
2
|
+
class Snapshot
|
3
|
+
MEDIAN_Q = 0.5
|
4
|
+
P75_Q = 0.75
|
5
|
+
P95_Q = 0.95
|
6
|
+
P98_Q = 0.98
|
7
|
+
P99_Q = 0.99
|
8
|
+
P999_Q = 0.999
|
1
9
|
|
2
|
-
|
3
|
-
MEDIAN_Q = 0.5
|
4
|
-
P75_Q = 0.75
|
5
|
-
P95_Q = 0.95
|
6
|
-
P98_Q = 0.98
|
7
|
-
P99_Q = 0.99
|
8
|
-
P999_Q = 0.999
|
10
|
+
attr_reader :values
|
9
11
|
|
10
|
-
|
12
|
+
def initialize(values)
|
13
|
+
@values = values.sort
|
14
|
+
end
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
16
|
+
def value(quantile)
|
17
|
+
raise ArgumentError, "quantile must be between 0.0 and 1.0" if quantile < 0.0 || quantile > 1.0
|
15
18
|
|
16
|
-
|
17
|
-
raise ArgumentError, "quantile must be between 0.0 and 1.0" if quantile < 0.0 || quantile > 1.0
|
19
|
+
return 0.0 if @values.empty?
|
18
20
|
|
19
|
-
|
21
|
+
pos = quantile * (@values.length + 1)
|
20
22
|
|
21
|
-
|
23
|
+
return @values.first if pos < 1
|
24
|
+
return @values.last if pos >= @values.length
|
22
25
|
|
23
|
-
|
24
|
-
|
26
|
+
lower = @values[pos.to_i - 1]
|
27
|
+
upper = @values[pos.to_i]
|
28
|
+
lower + (pos - pos.floor) * (upper - lower)
|
29
|
+
end
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
31
|
+
def size
|
32
|
+
@values.length
|
33
|
+
end
|
30
34
|
|
31
|
-
|
32
|
-
|
33
|
-
|
35
|
+
def median
|
36
|
+
value(MEDIAN_Q)
|
37
|
+
end
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
39
|
+
def get_75th_percentile
|
40
|
+
value(P75_Q)
|
41
|
+
end
|
38
42
|
|
39
|
-
|
40
|
-
|
41
|
-
|
43
|
+
def get_95th_percentile
|
44
|
+
value(P95_Q)
|
45
|
+
end
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
def get_98th_percentile
|
48
|
-
value(P98_Q)
|
49
|
-
end
|
47
|
+
def get_98th_percentile
|
48
|
+
value(P98_Q)
|
49
|
+
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
def get_99th_percentile
|
52
|
+
value(P99_Q)
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
55
|
+
def get_999th_percentile
|
56
|
+
value(P999_Q)
|
57
|
+
end
|
57
58
|
end
|
58
|
-
end
|
59
|
+
end
|
data/lib/metriks.rb
CHANGED
data/metriks.gemspec
CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'metriks'
|
16
|
-
s.version = '0.9.
|
17
|
-
s.date = '2012-
|
16
|
+
s.version = '0.9.8'
|
17
|
+
s.date = '2012-04-25'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
20
20
|
## as you like.
|
@@ -1,9 +1,6 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'thread_error_handling_tests'
|
3
3
|
|
4
|
-
# riemann only works in 1.9
|
5
|
-
if RUBY_VERSION > '1.9'
|
6
|
-
|
7
4
|
require 'metriks/reporter/riemann'
|
8
5
|
|
9
6
|
class RiemannReporterTest < Test::Unit::TestCase
|
@@ -72,5 +69,3 @@ class RiemannReporterTest < Test::Unit::TestCase
|
|
72
69
|
@reporter.write
|
73
70
|
end
|
74
71
|
end
|
75
|
-
|
76
|
-
end
|
metadata
CHANGED
@@ -5,9 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
|
10
|
-
version: 0.9.7.3
|
8
|
+
- 8
|
9
|
+
version: 0.9.8
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Eric Lindvall
|
@@ -15,13 +14,11 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2012-
|
17
|
+
date: 2012-04-25 00:00:00 -07:00
|
19
18
|
default_executable:
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
|
-
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
25
22
|
requirements:
|
26
23
|
- - ~>
|
27
24
|
- !ruby/object:Gem::Version
|
@@ -29,12 +26,12 @@ dependencies:
|
|
29
26
|
- 1
|
30
27
|
- 0
|
31
28
|
version: "1.0"
|
29
|
+
requirement: *id001
|
30
|
+
name: atomic
|
31
|
+
prerelease: false
|
32
32
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
33
|
- !ruby/object:Gem::Dependency
|
35
|
-
|
36
|
-
prerelease: false
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
34
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
38
35
|
requirements:
|
39
36
|
- - ~>
|
40
37
|
- !ruby/object:Gem::Version
|
@@ -42,12 +39,12 @@ dependencies:
|
|
42
39
|
- 1
|
43
40
|
- 1
|
44
41
|
version: "1.1"
|
42
|
+
requirement: *id002
|
43
|
+
name: hitimes
|
44
|
+
prerelease: false
|
45
45
|
type: :runtime
|
46
|
-
version_requirements: *id002
|
47
46
|
- !ruby/object:Gem::Dependency
|
48
|
-
|
49
|
-
prerelease: false
|
50
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
47
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
51
48
|
requirements:
|
52
49
|
- - ~>
|
53
50
|
- !ruby/object:Gem::Version
|
@@ -56,12 +53,12 @@ dependencies:
|
|
56
53
|
- 1
|
57
54
|
- 2
|
58
55
|
version: 1.1.2
|
56
|
+
requirement: *id003
|
57
|
+
name: avl_tree
|
58
|
+
prerelease: false
|
59
59
|
type: :runtime
|
60
|
-
version_requirements: *id003
|
61
60
|
- !ruby/object:Gem::Dependency
|
62
|
-
|
63
|
-
prerelease: false
|
64
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
61
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
65
62
|
requirements:
|
66
63
|
- - ~>
|
67
64
|
- !ruby/object:Gem::Version
|
@@ -69,8 +66,10 @@ dependencies:
|
|
69
66
|
- 0
|
70
67
|
- 10
|
71
68
|
version: "0.10"
|
69
|
+
requirement: *id004
|
70
|
+
name: mocha
|
71
|
+
prerelease: false
|
72
72
|
type: :development
|
73
|
-
version_requirements: *id004
|
74
73
|
description: An experimental metrics client.
|
75
74
|
email: eric@sevenscale.com
|
76
75
|
executables: []
|