dtracy
dtracy copied to clipboard
Middleware for measuring Rack-based web applications. Part of the Rails Google Summer of Code '09 quartet.
Dtracy, or How To Soon Spot Trends in your Web Application and Server
status
Dtracy is part of the Ruby on Rail's Google Summer of Code '09 Quartet, with development updates and entertainment available at http://ecin.tumblr.com
Welcome! Sit down, grab a sugary drink, and enjoy the smell of freshly baked code right out of the oven.
requirements
An operating system with support for Dtrace (http://www.sun.com/bigadmin/content/dtrace/) is a must. Mac OS X, Solaris/OpenSolaris and FreeBSD are all acceptable choices, though you're hardcore if you get Dtrace running properly on FreeBSD.
A courageous heart will also come in handy: this is still alpha software.
gem dependencies
- rack
- rack-contrib ( for Rack::JSONP )
- sinatra
- ruby-dtrace ( I suggest grabbing the latest from http://github.com/chrisa/ruby-dtrace/ )
running locally
The running process will require root privileges in order to access the Dtrace probes. As such, sudo bin/server
will run rackup
with examples/dtracy.ru
as a rackup file on port 3000.
hello world - a brief overview
Actually, I don't mean to be pretentious. "hello 4 or 5 curious developers" is a better name for this section.
Digression aside, Dtracy is divided into two areas: Rack::Probe
and Dtracy::App
. They're both written as Rack middleware to allow easy dropping into other apps, with Rack::Probe
handling the definition and consumption of Dtrace probes while Dtracy::App
is meant to provide visualizations to the data generated from the aforementioned probes.
When running bin/server
, the Dtracy::App
app gets loaded, providing a list of activated probes and an inconspicuous ring at /__dtracy__/
. Requests made to the server will fire the rack*:ruby:path:path
probe setup in examples/dtracy.ru
. In short:
- Point a browser at
localhost:3000/__dtracy__/
- Drag and drop the
rack*:ruby:path:path
div/string onto the ring; it should start spinning -
curl localhost:3000/[any path]
several times - Watch the ring spin faster; this is due to the probe firing for each request made
-
ab -n100 http://127.0.0.1:3000/[any path]
if you feel like hosing the application
Feel free to visit /__dtracy__/updates
to see what kind of JSON data gets generated by the active probes.