class ElasticAPM::Spies::MongoSpy::Subscriber
@api private
def build_context(event)
def build_context(event) Span::Context.new( db: { instance: event.database_name, statement: nil, type: 'mongodb', user: nil } ) end
def failed(event)
def failed(event) pop_event(event) end
def initialize
def initialize @events = {} end
def pop_event(event)
def pop_event(event) return unless (curr = ElasticAPM.current_span) span = @events.delete(event.operation_id) curr == span && ElasticAPM.end_span end
def push_event(event)
def push_event(event) return unless ElasticAPM.current_transaction span = ElasticAPM.start_span( event.command_name.to_s, TYPE, context: build_context(event) ) @events[event.operation_id] = span end
def started(event)
def started(event) push_event(event) end
def succeeded(event)
def succeeded(event) pop_event(event) end