Class: StaticTracing::Tracers

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-static-tracing/tracers.rb

Overview

Tracers are a layer of abstraction above tracepoints. They are opinionated and contextual ways of applying tracepoints to an application.

Defined Under Namespace

Classes: InvalidTracerError

Class Method Summary collapse

Class Method Details

.add(tracer) ⇒ Object

Raises:



21
22
23
24
25
# File 'lib/ruby-static-tracing/tracers.rb', line 21

def add(tracer)
  raise InvalidTracerError unless tracer < StaticTracing::Tracer::Base

  tracers << tracer
end

.cleanObject

Clears all tracers



39
40
41
42
# File 'lib/ruby-static-tracing/tracers.rb', line 39

def clean
  # FIXME: - actuallly ensure destroyed to avoid memory leaks
  @tracers = []
end

.disable!Object

Disables each tracer, replacing the method definition



34
35
36
# File 'lib/ruby-static-tracing/tracers.rb', line 34

def disable!
  tracers.each(&:disable!)
end

.enable!Object

Enables each tracer, overriding original method definition with traced one



29
30
31
# File 'lib/ruby-static-tracing/tracers.rb', line 29

def enable!
  tracers.each(&:enable!)
end