Class: RailsTracepointStack::Tracer

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
TraceFilter
Defined in:
lib/rails_tracepoint_stack/tracer.rb

Constant Summary collapse

DEFAULT_EVENTS =
[:call].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TraceFilter

#ignore_trace?

Methods included from Filter::TraceToIgnoreFilter

#attends_some_custom_pattern_to_ignore?

Methods included from Filter::TraceFromRubyCodeFilter

#should_ignore_because_is_ruby_trace?

Methods included from Filter::TraceFromDependenciesFilter

#should_ignore_because_is_a_internal_dependency?

Methods included from Filter::CustomTraceSelectorFilter

#is_a_trace_required_to_watch_by_the_custom_configs?

Constructor Details

#initialize(sink: RailsTracepointStack::Sink::Log.new, events: DEFAULT_EVENTS, thread: nil) ⇒ Tracer

A nil thread watches every thread in the process, which is what the global tracer wants. Passing one confines tracing to it, so a capture running inside a threaded server does not pick up other requests.



26
27
28
29
30
31
32
# File 'lib/rails_tracepoint_stack/tracer.rb', line 26

def initialize(sink: RailsTracepointStack::Sink::Log.new, events: DEFAULT_EVENTS, thread: nil)
  @sink = sink
  @events = events
  @thread = thread
  @filtered_count = 0
  generate_tracer
end

Instance Attribute Details

#filtered_countObject (readonly)

How many traces the filters dropped. A capture that keeps nothing is ambiguous on its own: this tells the difference between code that never ran and code that ran entirely inside gems.



21
22
23
# File 'lib/rails_tracepoint_stack/tracer.rb', line 21

def filtered_count
  @filtered_count
end