Class: RailsPerformance::Models::TraceRecord

Inherits:
BaseRecord
  • Object
show all
Defined in:
lib/rails_performance/models/trace_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseRecord

#duration, from_db, #record_hash

Constructor Details

#initialize(request_id:, value:) ⇒ TraceRecord

Returns a new instance of TraceRecord.



6
7
8
9
# File 'lib/rails_performance/models/trace_record.rb', line 6

def initialize(request_id:, value:)
  @request_id = request_id
  @value      = value
end

Instance Attribute Details

#request_idObject

Returns the value of attribute request_id.



4
5
6
# File 'lib/rails_performance/models/trace_record.rb', line 4

def request_id
  @request_id
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/rails_performance/models/trace_record.rb', line 4

def value
  @value
end

Instance Method Details

#saveObject



11
12
13
14
15
# File 'lib/rails_performance/models/trace_record.rb', line 11

def save
  return if value.empty?

  Utils.save_to_redis("trace|#{request_id}|END|#{RailsPerformance::SCHEMA}", value, RailsPerformance.recent_requests_time_window.to_i)
end