Cue / scales

scales - Metrics for Python
Apache License 2.0
920 stars 73 forks source link

move graphite pushing into its own class #3

Closed joeshaw closed 12 years ago

joeshaw commented 12 years ago

This lets us do on-demand pushing of data to graphite in the new GraphitePusher class. The GraphitePeriodicPusher class inherits from it with threading.Thread as a mix-in.

To use it, you end up doing something like:

pusher = GraphitePusher(host, port, prefix)
pusher.graphite.start()
pusher.push()
pusher.graphite.flush()

Which is not a great API since you are poking at the pusher's internals, but I didn't want to end up proxying most of the util.GraphiteReporter API on top of it. Maybe the pusher class and the reporter class should be unified, maybe the walking of the tree inside of the pusher could be made generic in some way.

PeterScott commented 12 years ago

Nice, this is a pretty clear improvement to the API.