Module: XRay::DTrace::Tracer
- Defined in:
- lib/xray/dtrace/tracer.rb,
lib/xray/dtrace/tracer/joyent.rb,
lib/xray/dtrace/tracer/leopard.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.
Defined Under Namespace
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Returns true if ruby-probe probes are enabled.
-
#fire(name, data = nil) ⇒ Object
Fire an application-level probe using ruby-probe.
-
#firing(name, data = nil) ⇒ Object
Use ruby-probe to fire 2 application-level probes before and after evaling a block .
Instance Method Details
#enabled? ⇒ Boolean
Returns true if ruby-probe probes are enabled. (application-level probes for Ruby).
66 67 68 |
# File 'lib/xray/dtrace/tracer.rb', line 66 def enabled? false end |
#fire(name, data = nil) ⇒ Object
Fire an application-level probe using ruby-probe.
The first argument passed will be passed to the D script as arg0 for the ruby-probe probe. This is conventionally a probe name.
The second argument is optional and can be used to pass additional data into the D script as arg1.
Example:
XRay::DTrace::Tracer.fire(‘service-start’, “order processing”)
XRay::DTrace::Tracer.fire(‘service-stop’)
31 32 |
# File 'lib/xray/dtrace/tracer.rb', line 31 def fire(name, data = nil) end |
#firing(name, data = nil) ⇒ Object
Use ruby-probe to fire 2 application-level probes before and after evaling a block .
The first argument passed will be passed to the D script as arg0 for the ruby-probe probe. The first argument is conventionally a probe base name. The probes which fire before and after the block runs will have “-start” and “-end” appended to the probe base name, respectively.
The second argument is optional and can be used to pass additional data into the D script as arg1.
Example:
XRay::DTrace::Tracer.firing(‘db-query’, “select * from dual;”) do
ActiveRecord::Base.execute("select * from dual;")
end
Will:
-
Fire a probe with arg0 set to “db-query-start”, and arg1 set to the sql query.
-
Run the block and execute the SQL.
-
Fire a probe with arg0 set to “db-query-start”.
60 61 62 |
# File 'lib/xray/dtrace/tracer.rb', line 60 def firing(name, data = nil) yield end |