lib/agent/handler/sequence_book.rb in site24x7_apminsight-1.9.2 vs lib/agent/handler/sequence_book.rb in site24x7_apminsight-1.9.3

- old
+ new

@@ -1,15 +1,15 @@ require 'agent/metrics/exception_record' module APMInsight module Agent class SequenceBook - attr_reader :openTracker, :closedTracker, :rootTracker, :trackerCount, :closedTrackerCount, :exceptionBag, :listenFlag + attr_reader :openTracker, :rootTracker, :trackerCount, :exceptionBag, :listenFlag def initialize - @rootTracker = createDummyTracker() - @closedTracker = @rootTracker + @rootTracker = nil + #@closedTracker = @rootTracker @openTracker = nil @trackerCount = 0 @closedTrackerCount = 0 @listenFlag = -1 @@ -20,60 +20,64 @@ if tracker == nil return nil end # If RootTracker is not set, check type and set - if @rootTracker == @closedTracker + if @rootTracker == nil if !tracker.is_a?(ManageEngine::Tracker::RootTracker) closeSequence() return nil end @rootTracker = tracker - updateListenFlag() end + tracker.setParent(openTracker) + @openTracker = tracker + # Attach tracker as Sibling or Child and set nominee - if @closedTracker != nil - tracker.sibling = @closedTracker - @closedTracker.sibling = tracker # Nominee - if dropped/corrupted, defaults to this tracker - @openTracker = tracker - @closedTracker = nil - else - if tracker.equal?(@openTracker) - return nil - end - - @openTracker.child = tracker - tracker.sibling = @openTracker - @openTracker = tracker - end +# if @closedTracker != nil +# tracker.sibling = @closedTracker +# @closedTracker.sibling = tracker # Nominee - if dropped/corrupted, defaults to this tracker +# @openTracker = tracker +# @closedTracker = nil +# else +# if tracker.equal?(@openTracker) +# return nil +# end +# +# @openTracker.child = tracker +# tracker.sibling = @openTracker +# @openTracker = tracker +# end checkAndArrestSequence() return tracker end def closeTracker tracker - @closedTrackerCount += 1 - @closedTracker = tracker - tracker.sibling = nil - @openTracker = nil +# @closedTrackerCount += 1 +# @closedTracker = tracker +# tracker.sibling = nil +# @openTracker = nil + @openTracker = tracker.parent; # Marks end of transaction - if @rootTracker == tracker +# if @rootTracker == tracker + if @openTracker == nil if @listenFlag < 1 || (@listenFlag >= 1 && @trackerCount > 0) # if some trackers are not closed, while processing the metrics, it may go into infinite loop - if (@closedTrackerCount - @trackerCount) == 0 +# if (@closedTrackerCount - @trackerCount) == 0 sequenceBag = Hash.new sequenceBag["roottracker"] = @rootTracker sequenceBag["exceptions"] = @exceptionBag ManageEngine::APMObjectHolder.instance.collector.updateTransaction(@rootTracker.url, sequenceBag) - else - ManageEngine::APMObjectHolder.instance.log.warn "Some trackers are not closed, dropping the metrics for #{@rootTracker.url}" - end +# else +# ManageEngine::APMObjectHolder.instance.log.warn "Some trackers are not closed, dropping the metrics for #{@rootTracker.url}" +# end end closeSequence() end end \ No newline at end of file