Class: Deimos::Tracing::Mock
- Defined in:
- lib/deimos/tracing/mock.rb
Overview
Class that mocks out tracing functionality
Instance Method Summary collapse
-
#active_span ⇒ Object
:nodoc:.
-
#finish(span) ⇒ Object
:nodoc:.
-
#initialize(logger = nil) ⇒ Mock
constructor
A new instance of Mock.
-
#set_error(span, exception) ⇒ Object
:nodoc:.
-
#set_tag(tag, value, span = nil) ⇒ Object
:nodoc:.
- #start(span_name, _options = {}) ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ Mock
Returns a new instance of Mock.
10 11 12 13 |
# File 'lib/deimos/tracing/mock.rb', line 10 def initialize(logger=nil) @logger = logger || Logger.new(STDOUT) @logger.info('MockTracingProvider initialized') end |
Instance Method Details
#active_span ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/deimos/tracing/mock.rb', line 34 def active_span nil end |
#finish(span) ⇒ Object
:nodoc:
26 27 28 29 30 31 |
# File 'lib/deimos/tracing/mock.rb', line 26 def finish(span) name = span[:name] start = span[:started_at] finish = Time.zone.now @logger.info("Mock span '#{name}' finished: #{start} to #{finish}") end |
#set_error(span, exception) ⇒ Object
:nodoc:
44 45 46 47 48 |
# File 'lib/deimos/tracing/mock.rb', line 44 def set_error(span, exception) span[:exception] = exception name = span[:name] @logger.info("Mock span '#{name}' set an error: #{exception}") end |
#set_tag(tag, value, span = nil) ⇒ Object
:nodoc:
39 40 41 |
# File 'lib/deimos/tracing/mock.rb', line 39 def set_tag(tag, value, span=nil) nil end |
#start(span_name, _options = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/deimos/tracing/mock.rb', line 17 def start(span_name, ={}) @logger.info("Mock span '#{span_name}' started") { name: span_name, started_at: Time.zone.now } end |