A StatsD middleware to track requests and response times of ZeroRPC Services
import zerorpc
import statsd
from zerorpc_statsd import StatsdMiddleware
# Create a statsd client
client = statsd.StatsClient()
# Register the middleware
zerorpc.Context.get_instance().register_middleware(StatsdMiddleware(client))
# Create a server as usual, it will be automatically tracked by the middleware
class Service(object):
def do_something(self):
pass
server = zerorpc.Server(Service())
server.bind('tcp://*:1234')
server.run()
- ZeroRPC-Python < 0.4.0 is compatible with zerorpc-statsd < 0.2.0;
- ZeroRPC-Python >= 0.4.0 requires zerorpc_statsd > 0.2.0.