Class: ManageEngine::Agent::TrackerHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/agent/handler/tracker_handler.rb

Class Method Summary collapse

Class Method Details

.exitTracker(tracker) ⇒ Object

Closes tracker properly and set everything ready to process next tracker If roottracker closes, sequence book is cleaned and data are push to store



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/agent/handler/tracker_handler.rb', line 40

def self.exitTracker tracker
  begin
    if tracker != nil
      seqBook = Thread.current[:apminsight]
      if seqBook != nil
        seqBook.closeTracker tracker
      end
    end
  rescue Exception=>ex
    if (@obj != nil)
      @obj.log.logException "[TrackerHandler] Exception occurred at exittracker.", ex
    end
  end
end

.invokeTracker(tracker) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/agent/handler/tracker_handler.rb', line 7

def self.invokeTracker tracker
  begin
    @obj = ManageEngine::APMObjectHolder.instance
    
    if !@obj.config.agent_enabled || tracker == nil
      return nil
    end
    
    seqBook = Thread.current[:apminsight]
    if seqBook != nil
      if seqBook.listenFlag == 1
        return nil
      end
    else
      seqBook = ::APMInsight::Agent::SequenceBook.new
      Thread.current[:apminsight] = seqBook
    end
    
    tracker = seqBook.attachTracker(tracker)
    
    return tracker
  rescue Exception=>ex
    # Logging to be done here, Not sure whether its safe to do
    if (@obj != nil)
      @obj.log.logException "[TrackerHandler] Exception occurred at invoketracker.", ex
    end
    return nil
  end
end