Module: Bitfab::TraceState
- Defined in:
- lib/bitfab/span_context.rb
Overview
Global storage for trace states (trace_id -> state hash)
Class Method Summary collapse
- .clear_all ⇒ Object
- .create(trace_id, test_run_id: nil) ⇒ Object
- .delete(trace_id) ⇒ Object
- .get(trace_id) ⇒ Object
Class Method Details
.clear_all ⇒ Object
148 149 150 |
# File 'lib/bitfab/span_context.rb', line 148 def clear_all @states_mutex.synchronize { @states.clear } end |
.create(trace_id, test_run_id: nil) ⇒ Object
134 135 136 137 138 139 140 141 142 |
# File 'lib/bitfab/span_context.rb', line 134 def create(trace_id, test_run_id: nil) @states_mutex.synchronize do @states[trace_id] ||= { trace_id:, started_at: Time.now.utc.strftime("%Y-%m-%dT%H:%M:%S.%3NZ"), test_run_id: }.compact end end |
.delete(trace_id) ⇒ Object
144 145 146 |
# File 'lib/bitfab/span_context.rb', line 144 def delete(trace_id) @states_mutex.synchronize { @states.delete(trace_id) } end |
.get(trace_id) ⇒ Object
130 131 132 |
# File 'lib/bitfab/span_context.rb', line 130 def get(trace_id) @states_mutex.synchronize { @states[trace_id] } end |