No description or website provided.
Pull request Compare This branch is 22 commits ahead, 2 commits behind klmitch:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
etc whoops Apr 10, 2012


Example instrumentation:

For the NovaAPI, using the OpenstackAPI, created in tach-api.conf

# also accepts a full path to the file, instead of a python module path
app_helper = tach_helper

driver = tach.notifiers.StatsDNotifier
host = <Your statsd host>
port = <Your statsd port, probably 8125>

module = nova.api.openstack.wsgi.Resource
method = _process_stack
metric = tach.metrics.ExecTime
notifier = statsd
app_path = tach_helper
app = process_stack

Set up the helper script, created in

This is where things get a little messy, but that's the catch with trying to instrument something you don't want to modify directly...

# create this in a file called in the same directory as the conf
def queue_receive(*args, **kwargs):
    method = args[2]
    return args, kwargs, "nova.compute.%s" % method

def network_queue_receive(*args, **kwargs):
    method = args[2]
    return args, kwargs, "" % method

def scheduler_queue_receive(*args, **kwargs):
    method = args[2]
    return args, kwargs, "nova.scheduler.%s" % method

def process_stack(*args, **kwargs):
    resource = args[0]
    req = args[1].__dict__
    method = ".%s" % req['environ']['REQUEST_METHOD']
    path = '.%s' % req['environ']['PATH_INFO'].split('/')[2]
    action = ".%s" % req['environ']['wsgiorg.routing_args'][1]['action']
    if action:
        key = 'nova.api%s%s%s' % (path, action, method)
        key = 'nova.api%s%s%s' % (path, method)
    return args, kwargs, key

Finally, launch the above

# Assumes you're in the nova dir already
tach tach-api.conf ./bin/nova-api
tach tach-compute.conf ./bin/nova-compute
tach tach-scheduler.conf ./bin/nova-scheduler
tach tach-network.conf ./bin/nova-network