Class: Mnemosyne::Trace
Instance Attribute Summary collapse
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
-
#span ⇒ Object
readonly
Returns the value of attribute span.
-
#transaction ⇒ Object
readonly
Returns the value of attribute transaction.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Attributes inherited from Span
#finish, #meta, #name, #start, #type
Instance Method Summary collapse
- #<<(span) ⇒ Object
-
#initialize(instrumenter, name, transaction: nil, origin: nil, **kwargs) ⇒ Trace
constructor
A new instance of Trace.
- #release ⇒ Object
- #serialize ⇒ Object
- #submit ⇒ Object
Methods inherited from Span
Constructor Details
#initialize(instrumenter, name, transaction: nil, origin: nil, **kwargs) ⇒ Trace
Returns a new instance of Trace.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mnemosyne/trace.rb', line 7 def initialize(instrumenter, name, transaction: nil, origin: nil, **kwargs) super(name, **kwargs) @uuid = ::SecureRandom.uuid @span = [] @origin = origin @transaction = transaction @instrumenter = instrumenter end |
Instance Attribute Details
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
5 6 7 |
# File 'lib/mnemosyne/trace.rb', line 5 def origin @origin end |
#span ⇒ Object (readonly)
Returns the value of attribute span.
5 6 7 |
# File 'lib/mnemosyne/trace.rb', line 5 def span @span end |
#transaction ⇒ Object (readonly)
Returns the value of attribute transaction.
5 6 7 |
# File 'lib/mnemosyne/trace.rb', line 5 def transaction @transaction end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/mnemosyne/trace.rb', line 5 def uuid @uuid end |
Instance Method Details
#<<(span) ⇒ Object
19 20 21 |
# File 'lib/mnemosyne/trace.rb', line 19 def <<(span) @span << span end |
#release ⇒ Object
29 30 31 |
# File 'lib/mnemosyne/trace.rb', line 29 def release @instrumenter.release self end |
#serialize ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/mnemosyne/trace.rb', line 33 def serialize { uuid: uuid, origin: origin, transaction: transaction, name: name, start: start, stop: finish, meta: , span: @span.map(&:serialize) } end |
#submit ⇒ Object
23 24 25 26 27 |
# File 'lib/mnemosyne/trace.rb', line 23 def submit finish! unless finish @instrumenter.submit self end |