A simple Twisted client for reporting metrics to Carbon.
Switch branches/tags
Nothing to show
Clone or download
Latest commit c342eff Oct 14, 2013



A simple Twisted client for reporting metrics to Carbon.


pip install txCarbonClient

Or get the latest development version.

pip install git+git://github.com/fdChasm/txCarbonClient.git


Simply add create an instance of the CarbonClientService and add it to your Twisted application service hierarchy.

from twisted.application import service
from twisted.internet import reactor

from txCarbonClient import CarbonClientService

carbon_client_service = CarbonClientService(reactor, 'localhost', 2004)

application = service.Application("Testing")


Then you can record metric hits easily in your application.

carbon_client_service.publish_metric('metric.test.irregular', .75)

carbon_client_service.publish_metric('metric.test.irregular', .75, epoch_seconds=time.time())

You can also setup a metric to record the result of a getter on a regular basis.

value = 0

def test_metric_sin_getter():
    global value
    value += 0.1
    return (math.sin(value) * 0.5) + 0.5

carbon_client_service.register_repeating_metric('metric.test.sin', 1, test_metric_sin_getter)