Class: Statsig::Diagnostics
- Inherits:
-
Object
- Object
- Statsig::Diagnostics
- Extended by:
- T::Sig
- Defined in:
- lib/diagnostics.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#markers ⇒ Object
readonly
Returns the value of attribute markers.
Instance Method Summary collapse
-
#initialize(context) ⇒ Diagnostics
constructor
A new instance of Diagnostics.
- #mark(key, action, step = nil, value = nil) ⇒ Object
- #serialize ⇒ Object
Constructor Details
#initialize(context) ⇒ Diagnostics
Returns a new instance of Diagnostics.
17 18 19 20 |
# File 'lib/diagnostics.rb', line 17 def initialize(context) @context = context @markers = [] end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
10 11 12 |
# File 'lib/diagnostics.rb', line 10 def context @context end |
#markers ⇒ Object (readonly)
Returns the value of attribute markers.
13 14 15 |
# File 'lib/diagnostics.rb', line 13 def markers @markers end |
Instance Method Details
#mark(key, action, step = nil, value = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/diagnostics.rb', line 24 def mark(key, action, step = nil, value = nil) @markers.push({ key: key, step: step, action: action, value: value, timestamp: (Time.now.to_f * 1000).to_i }) end |
#serialize ⇒ Object
36 37 38 39 40 41 |
# File 'lib/diagnostics.rb', line 36 def serialize { context: @context, markers: @markers } end |