Class: Judoscale::Report
- Inherits:
-
Object
- Object
- Judoscale::Report
- Defined in:
- lib/judoscale/report.rb
Instance Attribute Summary collapse
-
#adapters ⇒ Object
readonly
Returns the value of attribute adapters.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#initialize(adapters, config, metrics = []) ⇒ Report
constructor
A new instance of Report.
Constructor Details
#initialize(adapters, config, metrics = []) ⇒ Report
Returns a new instance of Report.
7 8 9 10 11 |
# File 'lib/judoscale/report.rb', line 7 def initialize(adapters, config, metrics = []) @adapters = adapters @config = config @metrics = metrics end |
Instance Attribute Details
#adapters ⇒ Object (readonly)
Returns the value of attribute adapters.
5 6 7 |
# File 'lib/judoscale/report.rb', line 5 def adapters @adapters end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/judoscale/report.rb', line 5 def config @config end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
5 6 7 |
# File 'lib/judoscale/report.rb', line 5 def metrics @metrics end |
Instance Method Details
#as_json ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/judoscale/report.rb', line 13 def as_json { container: config.current_runtime_container, pid: Process.pid, config: config.as_json, adapters: adapters.reduce({}) { |hash, adapter| hash.merge!(adapter.as_json) }, metrics: metrics.map { |metric| [ metric.time.to_i, metric.value, metric.identifier, metric.queue_name ] } } end |