Class: ScoutApm::StackprofTreeCollapser

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/stackprof_tree_collapser.rb

Defined Under Namespace

Classes: TreeNode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_stackprof) ⇒ StackprofTreeCollapser

Returns a new instance of StackprofTreeCollapser.



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/scout_apm/stackprof_tree_collapser.rb', line 6

def initialize(raw_stackprof)
  @raw_stackprof = raw_stackprof

  # Log the raw stackprof info
  unless StackProf.respond_to?(:fake?) && StackProf.fake?
    begin
      ScoutApm::Agent.instance.logger.debug("StackProf - Samples: #{raw_stackprof[:samples]}, GC: #{raw_stackprof[:gc_samples]}, missed: #{raw_stackprof[:missed_samples]}, Interval: #{raw_stackprof[:interval]}")
    rescue
      # Not a useful log message, currently stackprof is disabled
      # ScoutApm::Agent.instance.logger.debug("StackProf Raw - #{raw_stackprof.inspect}")
    end
  end
end

Instance Attribute Details

#nodesObject (readonly)

Returns the value of attribute nodes.



4
5
6
# File 'lib/scout_apm/stackprof_tree_collapser.rb', line 4

def nodes
  @nodes
end

#raw_stackprofObject (readonly)

Returns the value of attribute raw_stackprof.



3
4
5
# File 'lib/scout_apm/stackprof_tree_collapser.rb', line 3

def raw_stackprof
  @raw_stackprof
end

Instance Method Details

#callObject



20
21
22
23
24
25
26
# File 'lib/scout_apm/stackprof_tree_collapser.rb', line 20

def call
  build_tree
  connect_children
  total_samples_of_app_nodes
rescue
  []
end