Class: ElasticAPM::Spies::MongoSpy::Subscriber Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/spies/mongo.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

TYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'db'
SUBTYPE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'mongodb'
ACTION =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'query'
EVENT_KEY =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

:__elastic_instrumenter_mongo_events_key

Instance Method Summary collapse

Instance Method Details

#eventsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
# File 'lib/elastic_apm/spies/mongo.rb', line 40

def events
  Thread.current[EVENT_KEY] ||= []
end

#failed(event) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



48
49
50
51
52
53
54
# File 'lib/elastic_apm/spies/mongo.rb', line 48

def failed(event)
  if (span = pop_event(event))
    span.outcome = Span::Outcome::FAILURE
  end

  span
end

#started(event) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



44
45
46
# File 'lib/elastic_apm/spies/mongo.rb', line 44

def started(event)
  push_event(event)
end

#succeeded(event) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



56
57
58
59
60
61
62
# File 'lib/elastic_apm/spies/mongo.rb', line 56

def succeeded(event)
  if span = pop_event(event)
    span.outcome = Span::Outcome::SUCCESS
  end

  span
end