class Quilt::Performance::Event
Constants
- TYPE
Attributes
connection[RW]
duration[RW]
metadata[RW]
start[RW]
type[RW]
Public Class Methods
from_params(params)
click to toggle source
# File lib/quilt_rails/performance/event.rb, line 26 def self.from_params(params) params.require([:type, :start, :duration]) attributes = { type: params[:type], start: params[:start], duration: params[:duration], metadata: nil, } if params[:metadata] attributes[:metadata] = EventMetadata.from_params(params[:metadata]) end Event.new(**attributes) end
new(type:, start:, duration:, metadata:)
click to toggle source
# File lib/quilt_rails/performance/event.rb, line 43 def initialize(type:, start:, duration:, metadata:) @type = type @start = start @duration = duration @metadata = metadata end
Public Instance Methods
has_metadata?()
click to toggle source
# File lib/quilt_rails/performance/event.rb, line 69 def has_metadata? !metadata.nil? end
metric_name()
click to toggle source
# File lib/quilt_rails/performance/event.rb, line 60 def metric_name type_name = TYPE.key(type) if LIFECYCLE[type_name].nil? type else LIFECYCLE[type_name] end end
value()
click to toggle source
# File lib/quilt_rails/performance/event.rb, line 50 def value raw_value = if type == TYPE[:first_input_delay] duration else start end raw_value.round end