Class: ClearSkies::Redis::Report
- Inherits:
-
Object
- Object
- ClearSkies::Redis::Report
- Defined in:
- lib/clear_skies/redis/report.rb
Instance Attribute Summary collapse
-
#extra_labels ⇒ Object
readonly
Returns the value of attribute extra_labels.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
- #dimensions ⇒ Object
-
#initialize(host, port, extra_labels) ⇒ Report
constructor
A new instance of Report.
- #items ⇒ Object
- #report_dimensions ⇒ Object
Constructor Details
#initialize(host, port, extra_labels) ⇒ Report
Returns a new instance of Report.
17 18 19 20 21 |
# File 'lib/clear_skies/redis/report.rb', line 17 def initialize(host, port, extra_labels) @host = host @port = port @extra_labels = {host: host, port: port}.merge extra_labels end |
Instance Attribute Details
#extra_labels ⇒ Object (readonly)
Returns the value of attribute extra_labels.
16 17 18 |
# File 'lib/clear_skies/redis/report.rb', line 16 def extra_labels @extra_labels end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
16 17 18 |
# File 'lib/clear_skies/redis/report.rb', line 16 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
16 17 18 |
# File 'lib/clear_skies/redis/report.rb', line 16 def port @port end |
Class Method Details
.register(host, port, extra_labels = nil) ⇒ Object
8 9 10 |
# File 'lib/clear_skies/redis/report.rb', line 8 def self.register(host, port, extra_labels=nil) reports << ClearSkies::Redis::Report.new(host, port, extra_labels || Hash.new) end |
.reports ⇒ Object
12 13 14 |
# File 'lib/clear_skies/redis/report.rb', line 12 def self.reports @reports ||= [] end |
Instance Method Details
#dimensions ⇒ Object
23 24 25 |
# File 'lib/clear_skies/redis/report.rb', line 23 def dimensions ::Redis.new(:host => @host, :port => @port).info.keys.map {|k| k =~ /^db/ && k.sub("db", "")}.compact end |
#items ⇒ Object
33 34 35 |
# File 'lib/clear_skies/redis/report.rb', line 33 def items report_dimensions.map end |
#report_dimensions ⇒ Object
27 28 29 30 31 |
# File 'lib/clear_skies/redis/report.rb', line 27 def report_dimensions dimensions.map do |dimension| ReportDimension.new(self, dimension) end end |