Class: HttpLoader::Harness::Telemetry
- Inherits:
-
Object
- Object
- HttpLoader::Harness::Telemetry
- Extended by:
- T::Sig
- Defined in:
- lib/http_loader/harness/telemetry.rb
Overview
Exports telemetry and logs bottlenecks asynchronously and synchronously at termination.
Instance Method Summary collapse
- #check_bottlenecks! ⇒ Object
- #export!(peak_connections, start_time) ⇒ Object
-
#initialize(log_dir, export_json) ⇒ Telemetry
constructor
A new instance of Telemetry.
Constructor Details
#initialize(log_dir, export_json) ⇒ Telemetry
Returns a new instance of Telemetry.
14 15 16 17 |
# File 'lib/http_loader/harness/telemetry.rb', line 14 def initialize(log_dir, export_json) @log_dir = log_dir @export_json = export_json end |
Instance Method Details
#check_bottlenecks! ⇒ Object
29 30 31 32 33 34 |
# File 'lib/http_loader/harness/telemetry.rb', line 29 def check_bottlenecks! errors = (count_bottlenecks(read_logs)) puts format(' => BOTTLENECK ACTIVE: %s', errors.join(' | ')) if errors.any? rescue StandardError nil end |
#export!(peak_connections, start_time) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/http_loader/harness/telemetry.rb', line 20 def export!(peak_connections, start_time) return unless @export_json payload = generate_payload(peak_connections, start_time, count_bottlenecks(read_logs)) File.write(@export_json, JSON.generate(payload)) puts "[Harness] Telemetry JSON securely sinked to #{@export_json}." end |