Class: TraceViz::Collectors::BaseCollector

Inherits:
Object
  • Object
show all
Includes:
Helpers::ConfigHelper, Helpers::TrackingHelper
Defined in:
lib/trace_viz/collectors/base_collector.rb

Direct Known Subclasses

TracePointCollector

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::TrackingHelper

#active_call_stack, #current_call, #current_depth, #tracker

Methods included from Helpers::ConfigHelper

#config, #fetch_general_config

Constructor Details

#initializeBaseCollector

To implement collect trace data from the given event, you need to enter the ‘config` context to perform the evaluation.



19
20
21
22
23
24
25
26
# File 'lib/trace_viz/collectors/base_collector.rb', line 19

def initialize
  setup_logger
  setup_stats
  setup_pipeline
  setup_hierarchy

  clear
end

Instance Attribute Details

#collectionObject (readonly)

Returns the value of attribute collection.



15
16
17
# File 'lib/trace_viz/collectors/base_collector.rb', line 15

def collection
  @collection
end

#hierarchyObject (readonly)

Returns the value of attribute hierarchy.



15
16
17
# File 'lib/trace_viz/collectors/base_collector.rb', line 15

def hierarchy
  @hierarchy
end

#rendererObject (readonly)

Returns the value of attribute renderer.



15
16
17
# File 'lib/trace_viz/collectors/base_collector.rb', line 15

def renderer
  @renderer
end

#statsObject (readonly)

Returns the value of attribute stats.



15
16
17
# File 'lib/trace_viz/collectors/base_collector.rb', line 15

def stats
  @stats
end

Instance Method Details

#clearObject



40
41
42
# File 'lib/trace_viz/collectors/base_collector.rb', line 40

def clear
  @collection = []
end

#collect(event) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/trace_viz/collectors/base_collector.rb', line 28

def collect(event)
  return unless can_collect?(event)

  trace_data = build_trace(event)
  processed_data = process_trace(trace_data)

  return unless processed_data

  store_trace(processed_data)
  link_to_hierarchy(processed_data)
end