Class: Sleuth::Transaction
- Inherits:
-
Struct
- Object
- Struct
- Sleuth::Transaction
- Defined in:
- lib/sleuth/transaction.rb
Constant Summary collapse
- @@running =
{}
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#pid ⇒ Object
Returns the value of attribute pid.
-
#stamp ⇒ Object
Returns the value of attribute stamp.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
12 13 14 |
# File 'lib/sleuth/transaction.rb', line 12 def id @id end |
#name ⇒ Object
Returns the value of attribute name
12 13 14 |
# File 'lib/sleuth/transaction.rb', line 12 def name @name end |
#parent ⇒ Object
Returns the value of attribute parent
12 13 14 |
# File 'lib/sleuth/transaction.rb', line 12 def parent @parent end |
#pid ⇒ Object
Returns the value of attribute pid
12 13 14 |
# File 'lib/sleuth/transaction.rb', line 12 def pid @pid end |
#stamp ⇒ Object
Returns the value of attribute stamp
12 13 14 |
# File 'lib/sleuth/transaction.rb', line 12 def stamp @stamp end |
Class Method Details
.create(name, parent) ⇒ Object
16 17 18 19 |
# File 'lib/sleuth/transaction.rb', line 16 def self.create(name, parent) id = Sleuth.current_id running[id] = new(name, id, Time.now.to_i, Process.pid, parent) end |
.message_for(event) ⇒ Object
21 22 23 24 |
# File 'lib/sleuth/transaction.rb', line 21 def self.(event) transaction = running[event.transaction_id] transaction.(event) end |
Instance Method Details
#full_name ⇒ Object
32 33 34 |
# File 'lib/sleuth/transaction.rb', line 32 def full_name "#{name}-#{id}-#{stamp}-#{pid}" end |
#message_for(event) ⇒ Object
26 27 28 29 30 |
# File 'lib/sleuth/transaction.rb', line 26 def (event) parts = [event.formatted_time, event.formatted_end, full_name, parent || '-', event.duration, event.payload.inspect] "%s %s %s %s %0.4f -- %s" % parts end |