Class: InstrumentAllTheThings::Testing::TraceTracker
- Inherits:
-
Datadog::Tracing::Transport::IO::Client
- Object
- Datadog::Tracing::Transport::IO::Client
- InstrumentAllTheThings::Testing::TraceTracker
- Defined in:
- lib/instrument_all_the_things/testing/trace_tracker.rb
Instance Attribute Summary collapse
-
#traces ⇒ Object
readonly
Returns the value of attribute traces.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ TraceTracker
constructor
A new instance of TraceTracker.
- #reset! ⇒ Object
- #write_data(_, val) ⇒ Object
Constructor Details
#initialize ⇒ TraceTracker
Returns a new instance of TraceTracker.
17 18 19 20 |
# File 'lib/instrument_all_the_things/testing/trace_tracker.rb', line 17 def initialize(...) super reset! end |
Instance Attribute Details
#traces ⇒ Object (readonly)
Returns the value of attribute traces.
8 9 10 |
# File 'lib/instrument_all_the_things/testing/trace_tracker.rb', line 8 def traces @traces end |
Class Method Details
.tracker ⇒ Object
10 11 12 13 14 15 |
# File 'lib/instrument_all_the_things/testing/trace_tracker.rb', line 10 def self.tracker @tracker ||= new( StringIO.new, Datadog::Core::Encoding::JSONEncoder, ) end |
Instance Method Details
#reset! ⇒ Object
22 23 24 |
# File 'lib/instrument_all_the_things/testing/trace_tracker.rb', line 22 def reset! @traces = [] end |
#write_data(_, val) ⇒ Object
26 27 28 29 |
# File 'lib/instrument_all_the_things/testing/trace_tracker.rb', line 26 def write_data(_, val) body = JSON.parse(val) @traces.concat(body.fetch('traces', []).flatten) end |