graphiterb 0.2.7 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/graphiterb.gemspec +2 -2
- data/lib/graphiterb/accumulator.rb +18 -4
- data/lib/graphiterb/monitors.rb +2 -2
- data/lib/graphiterb/monitors/accumulations_consumer.rb +16 -3
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.9
|
data/graphiterb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{graphiterb}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Philip (flip) Kromer (@mrflip)"]
|
12
|
-
s.date = %q{2010-09-
|
12
|
+
s.date = %q{2010-09-20}
|
13
13
|
s.description = %q{Uses http://github.com/mrflip/configliere and http://graphite.wikidot.com}
|
14
14
|
s.email = %q{info@infochimps.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -20,10 +20,14 @@ module Graphiterb
|
|
20
20
|
# The Redis database.
|
21
21
|
attr_accessor :redis
|
22
22
|
|
23
|
-
# The Redis namespace
|
23
|
+
# The name of the Redis namespace (a string) in which
|
24
|
+
# accumulations are stored (defaults to 'graphiterb')
|
25
|
+
attr_accessor :namespace
|
26
|
+
|
27
|
+
# The Redis namespace (an object) used for the accumulators.
|
24
28
|
attr_accessor :accumulators
|
25
29
|
|
26
|
-
# The top-level scope
|
30
|
+
# The top-level Graphite scope inserted for each record.
|
27
31
|
attr_accessor :main_scope
|
28
32
|
|
29
33
|
# Provides methods for finding out about the node this code is
|
@@ -34,14 +38,24 @@ module Graphiterb
|
|
34
38
|
#
|
35
39
|
# Takes the same options as Redis.new.
|
36
40
|
#
|
41
|
+
# Also takes the :namespace option to change where the
|
42
|
+
# accumulations are stored. Different applications can use
|
43
|
+
# different accumulators with different namespaces in a single,
|
44
|
+
# shared Redis.
|
45
|
+
#
|
37
46
|
# @param [String] main_scope
|
38
47
|
# @param [Hash] options
|
39
48
|
def initialize main_scope, options={}
|
40
49
|
require 'redis'
|
41
|
-
|
50
|
+
begin
|
51
|
+
require 'redis-namespace'
|
52
|
+
rescue LoadError
|
53
|
+
require 'redis/namespace'
|
54
|
+
end
|
42
55
|
@main_scope = main_scope
|
43
56
|
@redis = Redis.new(options)
|
44
|
-
@
|
57
|
+
@namespace = options[:namespace] || 'graphiterb'
|
58
|
+
@accumulators = Redis::Namespace.new(namespace, :redis => redis)
|
45
59
|
end
|
46
60
|
|
47
61
|
# Increment the Graphite target +args+ by the given +amount+.
|
data/lib/graphiterb/monitors.rb
CHANGED
@@ -54,7 +54,7 @@ module Graphiterb
|
|
54
54
|
self.current_iter = 0
|
55
55
|
self.options = options
|
56
56
|
self.time_interval = options[:time] || 30
|
57
|
-
self.iter_interval = options[:iters] || 30
|
57
|
+
self.iter_interval = options[:iters] || 30
|
58
58
|
end
|
59
59
|
|
60
60
|
# The Graphiterb::Sender used to communicate with the Graphite
|
@@ -137,7 +137,7 @@ module Graphiterb
|
|
137
137
|
# last ran and insert metrics into the array.")
|
138
138
|
#
|
139
139
|
# @param [Array<String>] metrics
|
140
|
-
# @param [
|
140
|
+
# @param [Float] since the number of seconds since the last time the monitor ran
|
141
141
|
def get_metrics metrics, since
|
142
142
|
raise Graphiterb::NotImplementedError.new("Override the get_metrics method of the #{self.class} class")
|
143
143
|
end
|
@@ -8,6 +8,10 @@ module Graphiterb
|
|
8
8
|
# The Redis database.
|
9
9
|
attr_accessor :redis
|
10
10
|
|
11
|
+
# The name of the Redis namespace (a string) in which
|
12
|
+
# accumulations are stored (defaults to 'graphiterb')
|
13
|
+
attr_accessor :namespace
|
14
|
+
|
11
15
|
# The Redis namespace used for the accumulators.
|
12
16
|
attr_accessor :accumulators
|
13
17
|
|
@@ -20,6 +24,10 @@ module Graphiterb
|
|
20
24
|
# Options are passed to Redis.new as well as
|
21
25
|
# Graphiterb::Monitors::PeriodicMonitor.
|
22
26
|
#
|
27
|
+
# Include the :namespace option to tell this consumer which
|
28
|
+
# Redis namespace to consume keys from (defaults to
|
29
|
+
# 'graphiterb').
|
30
|
+
#
|
23
31
|
# Include the :regexp option if you want this monitor to only
|
24
32
|
# consume keys corresponding to Graphite targets which match the
|
25
33
|
# regexp. This is useful for having multiple
|
@@ -27,11 +35,16 @@ module Graphiterb
|
|
27
35
|
# frequencies tracking different Graphite target families.
|
28
36
|
def initialize options={}
|
29
37
|
require 'redis'
|
30
|
-
|
38
|
+
begin
|
39
|
+
require 'redis-namespace'
|
40
|
+
rescue LoadError
|
41
|
+
require 'redis/namespace'
|
42
|
+
end
|
31
43
|
@redis = Redis.new(options)
|
32
|
-
@
|
44
|
+
@namespace = options[:namespace] || 'graphiterb'
|
45
|
+
@accumulators = Redis::Namespace.new(namespace, :redis => @redis)
|
33
46
|
@regexp = options[:regexp] || /.*/
|
34
|
-
super('fake_scope', options)
|
47
|
+
super('fake_scope', options) # FIXME shouldn't have to use a fake scope
|
35
48
|
end
|
36
49
|
|
37
50
|
# Uses Redis' +getset+ call to retrieve total accumulated counts
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: graphiterb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 9
|
10
|
+
version: 0.2.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Philip (flip) Kromer (@mrflip)
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-09-
|
18
|
+
date: 2010-09-20 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|