Module: XRay::DTrace::Tracer

Defined in:
lib/xray/dtrace/tracer.rb

Overview

Ruby module to fire application-level Dtrace events (using ruby-probe).

This module provide a convenient and unified API abstracting different tracing implementations in Leopard Ruby VM (by Apple) and in the one provided by Joyent (dev.joyent.com/projects/ruby-dtrace). This module also provides a NOOP implementation for Ruby VMs with no DTrace support: So you can use the exact same code while developing on Linux and deploying on Solaris for instance.

Instance Method Summary collapse

Instance Method Details

#enabled?Boolean

:nodoc: all

Returns:

  • (Boolean)


69
70
71
# File 'lib/xray/dtrace/tracer.rb', line 69

def enabled?
  DTracer.enabled?
end

#fire(name, data = nil) ⇒ Object

No ruby-probe support ###



30
31
32
# File 'lib/xray/dtrace/tracer.rb', line 30

def fire(name, data = nil)
  DTracer.fire(name, data)
end

#firing(name, data = nil) ⇒ Object

:nodoc: all



60
61
62
63
64
65
# File 'lib/xray/dtrace/tracer.rb', line 60

def firing(name, data = nil)
  fire(name + "-start", data)
  result = yield
  fire(name + "-end", data)
  result
end