Class: ActiveSupport::Notifications::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/active_support/notifications/instrumenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, start, ending, transaction_id, payload) ⇒ Event

Returns a new instance of Event.



36
37
38
39
40
41
42
43
# File 'lib/active_support/notifications/instrumenter.rb', line 36

def initialize(name, start, ending, transaction_id, payload)
  @name           = name
  @payload        = payload.dup
  @time           = start
  @transaction_id = transaction_id
  @end            = ending
  @duration       = 1000.0 * (@end - @time)
end

Instance Attribute Details

#durationObject (readonly)

Returns the value of attribute duration.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def duration
  @duration
end

#endObject (readonly)

Returns the value of attribute end.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def end
  @end
end

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def name
  @name
end

#payloadObject (readonly)

Returns the value of attribute payload.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def payload
  @payload
end

#timeObject (readonly)

Returns the value of attribute time.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def time
  @time
end

#transaction_idObject (readonly)

Returns the value of attribute transaction_id.



34
35
36
# File 'lib/active_support/notifications/instrumenter.rb', line 34

def transaction_id
  @transaction_id
end

Instance Method Details

#parent_of?(event) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
48
# File 'lib/active_support/notifications/instrumenter.rb', line 45

def parent_of?(event)
  start = (time - event.time) * 1000
  start <= 0 && (start + duration >= event.duration)
end