module OpticsAgent::Reporting
Public Instance Methods
add_latency(counts, duration_in_seconds)
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 35 def add_latency(counts, duration_in_seconds) counts[latency_bucket_for_duration(duration_in_seconds)] += 1 end
client_info(rack_env)
click to toggle source
XXX: implement
# File lib/optics-agent/reporting/helpers.rb, line 27 def client_info(rack_env) { client_name: 'none', client_version: 'none', client_address: '::1' } end
duration_micros(duration_in_seconds)
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 22 def duration_micros(duration_in_seconds) (duration_in_seconds * 1e6).to_i end
duration_nanos(duration_in_seconds)
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 18 def duration_nanos(duration_in_seconds) (duration_in_seconds * 1e9).to_i end
generate_report_header()
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 4 def generate_report_header # XXX: fill out Apollo::Optics::Proto::ReportHeader.new({ agent_version: '0' }) end
generate_timestamp(time)
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 11 def generate_timestamp(time) Apollo::Optics::Proto::Timestamp.new({ seconds: time.to_i, nanos: duration_nanos(time.to_i % 1) }); end
latency_bucket_for_duration(duration_in_seconds)
click to toggle source
# File lib/optics-agent/reporting/helpers.rb, line 39 def latency_bucket_for_duration(duration_in_seconds) latency_bucket(duration_micros(duration_in_seconds)) end