Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sending data in pickle format #1

Open
benhoyt opened this issue Nov 23, 2016 · 2 comments
Open

Add support for sending data in pickle format #1

benhoyt opened this issue Nov 23, 2016 · 2 comments

Comments

@benhoyt
Copy link
Owner

benhoyt commented Nov 23, 2016

The pickle protocol is somewhat more efficient, especially when sending a bunch of metrics at once. Would be nice to add an option to send data using the pickle format, as per http://graphite.readthedocs.io/en/latest/feeding-carbon.html:

list_of_metric_tuples = [(path, (timestamp, value)), ...]
payload = pickle.dumps(list_of_metric_tuples, protocol=2)
header = struct.pack("!L", len(payload))
message = header + payload

Perhaps add a protocol='pickle' option to Sender.__init__ (defaults to plaintext). It'd be nice if the port argument defaulted to None, and then if None we'd select the default port based on protocol (plaintext=2003, pickle=2004).

If it just sent one at a time in foreground (interval=None) mode, I think that's fine, and the benefits would only kick in if you were in background (interval) mode. But I think that's fine.

@benmoran56
Copy link

I like this idea. It would be quite useful.

@naphthalene
Copy link

I'll put up a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants