Class: Codebeacon::Tracer::TraceMetadata
- Inherits:
-
Object
- Object
- Codebeacon::Tracer::TraceMetadata
- Defined in:
- lib/codebeacon/tracer/src/data/trace_metadata.rb
Instance Attribute Summary collapse
-
#caller_class ⇒ Object
readonly
Returns the value of attribute caller_class.
-
#caller_defined_class ⇒ Object
readonly
Returns the value of attribute caller_defined_class.
-
#caller_file ⇒ Object
readonly
Returns the value of attribute caller_file.
-
#caller_line ⇒ Object
readonly
Returns the value of attribute caller_line.
-
#caller_method ⇒ Object
readonly
Returns the value of attribute caller_method.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#duration_ms ⇒ Object
readonly
Returns the value of attribute duration_ms.
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#trigger_type ⇒ Object
readonly
Returns the value of attribute trigger_type.
Instance Method Summary collapse
- #finish_trace ⇒ Object
-
#initialize(name: nil, description: nil, caller_location: nil, trigger_type: nil) ⇒ TraceMetadata
constructor
A new instance of TraceMetadata.
- #to_hash ⇒ Object
Constructor Details
#initialize(name: nil, description: nil, caller_location: nil, trigger_type: nil) ⇒ TraceMetadata
Returns a new instance of TraceMetadata.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 8 def initialize(name: nil, description: nil, caller_location: nil, trigger_type: nil) @name = name @description = description @start_time = Time.now @end_time = nil @duration_ms = nil @trigger_type = trigger_type @language = "ruby" if caller_location capture_caller_info_from_location(caller_location) end end |
Instance Attribute Details
#caller_class ⇒ Object (readonly)
Returns the value of attribute caller_class.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def caller_class @caller_class end |
#caller_defined_class ⇒ Object (readonly)
Returns the value of attribute caller_defined_class.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def caller_defined_class @caller_defined_class end |
#caller_file ⇒ Object (readonly)
Returns the value of attribute caller_file.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def caller_file @caller_file end |
#caller_line ⇒ Object (readonly)
Returns the value of attribute caller_line.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def caller_line @caller_line end |
#caller_method ⇒ Object (readonly)
Returns the value of attribute caller_method.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def caller_method @caller_method end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def description @description end |
#duration_ms ⇒ Object (readonly)
Returns the value of attribute duration_ms.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def duration_ms @duration_ms end |
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def end_time @end_time end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def name @name end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def start_time @start_time end |
#trigger_type ⇒ Object (readonly)
Returns the value of attribute trigger_type.
4 5 6 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 4 def trigger_type @trigger_type end |
Instance Method Details
#finish_trace ⇒ Object
22 23 24 25 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 22 def finish_trace @end_time = Time.now @duration_ms = ((@end_time - @start_time) * 1000).round(2) end |
#to_hash ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/codebeacon/tracer/src/data/trace_metadata.rb', line 27 def to_hash { name: @name, description: @description, caller_file: @caller_file, caller_method: @caller_method, caller_line: @caller_line, caller_class: @caller_class, caller_defined_class: @caller_defined_class, start_time: @start_time, end_time: @end_time, duration_ms: @duration_ms, trigger_type: @trigger_type, language: @language } end |