Module: ThreadAdvisor
- Defined in:
- lib/thread_advisor.rb,
lib/thread_advisor/config.rb,
lib/thread_advisor/measure.rb,
lib/thread_advisor/railtie.rb,
lib/thread_advisor/version.rb,
lib/thread_advisor/estimator.rb,
lib/thread_advisor/formatter.rb,
lib/thread_advisor/middleware.rb,
lib/thread_advisor/perfm_adapter.rb
Defined Under Namespace
Modules: Measure Classes: Config, Estimator, Formatter, Middleware, PerfmAdapter, Railtie
Constant Summary collapse
- VERSION =
"0.1.0"
Class Method Summary collapse
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
-
.log_json(hash) ⇒ Object
Log helper for JSON output.
-
.measure(name = nil) ⇒ [result, metrics_hash]
Public API for measurement.
Class Method Details
.config ⇒ Object
20 21 22 |
# File 'lib/thread_advisor.rb', line 20 def config @config ||= ThreadAdvisor::Config.new end |
.configure {|config| ... } ⇒ Object
16 17 18 |
# File 'lib/thread_advisor.rb', line 16 def configure yield(config) end |
.log_json(hash) ⇒ Object
Log helper for JSON output
31 32 33 34 |
# File 'lib/thread_advisor.rb', line 31 def log_json(hash) logger = config.logger || Logger.new($stdout) logger.info(JSON.generate(hash)) end |
.measure(name = nil) ⇒ [result, metrics_hash]
Public API for measurement
26 27 28 |
# File 'lib/thread_advisor.rb', line 26 def measure(name = nil, &) ThreadAdvisor::Measure.call(name, &) end |