-
Notifications
You must be signed in to change notification settings - Fork 601
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
statsd: use pystatsd pipeline to send batches #327
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,8 @@ def _send(self): | |
statsd.Counter(prefix, self.connection).increment( | ||
name, value) | ||
|
||
if hasattr(statsd, 'StatsClient'): | ||
self.connection.send() | ||
self.metrics = [] | ||
|
||
def flush(self): | ||
|
@@ -152,7 +154,7 @@ def _connect(self): | |
self.connection = statsd.StatsClient( | ||
host=self.host, | ||
port=self.port | ||
) | ||
).pipeline() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there documentation for this feature? Does this call need to be conditional for legacy support? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup documented at http://statsd.readthedocs.org/en/v3.2.1/pipeline.html for https://pypi.python.org/pypi/statsd/ and introduced in version 2.0 according to jsocol/pystatsd@51d684e46d afaict this collector supports both the above and https://pypi.python.org/pypi/python-statsd with the former being actively maintained on github but not the latter, hence the conditional There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason to support both versions of the library? Seems like the former offers a superior API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. besides backward compatibility? no idea if there is still a good reason nowadays, possibly not |
||
else: | ||
# Create socket | ||
self.connection = statsd.Connection( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
conditional to support both python-statsd and statsd, see also other comment