Couchbase in NewRelic
All the credits really goes to http://ssutch.org/pycassa-newrelic-tracing/
import newrelic.api.function_trace
def instrument_couchbase_connection(module):
newrelic.api.function_trace.wrap_function_trace(module, 'Connection.__init__')
_patch_methods = ['set', 'add', 'replace', 'append', 'prepend',
'get', 'delete', 'incr', 'decr', 'stats',
'set_multi', 'add_multi', 'replace_multi', 'append_multi', 'prepend_multi', 'get_multi']
def instrument_couchbase_methods(module):
for meth in _patch_methods:
try:
newrelic.api.function_trace.wrap_function_trace(module, 'Connection.{}'.format(meth))
except AttributeError:
print 'not tracing Connection.{}'.format(meth)
def instrument_couchbase():
instrument_couchbase_connection('couchbase.libcouchbase')
instrument_couchbase_methods('couchbase.libcouchbase')
Written by Gilles Devaux
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Couchbase
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#