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

Thread safety and debugging options #17

Closed
wants to merge 1 commit into from
Closed

Conversation

jlopez
Copy link

@jlopez jlopez commented Jan 9, 2013

  • thread_safe constructor argument enables _stats
    single-threaded access to support use of single instance by
    multiple threads
  • debug constructor argument enables stdout printing of every
    metric sent to statsd
  • host may be None in which case network access is turned off

* thread_safe constructor argument enables _stats
  single-threaded access to support use of single instance by
  multiple threads
* debug constructor argument enables stdout printing of every
  metric sent to statsd
* host may be None in which case network access is turned off
@jsocol
Copy link
Owner

jsocol commented Mar 1, 2013

@jlopez I've gone a bit of a different way here by adding a pipeline concept. It looks something like:

pipe = StatsClient().pipeline()
pipe.incr('foo')
pipe.send()

The StatsClient itself should still be threadsafe, but Pipeline objects are not. This is similar to how redis-py works, and I think it simplifies things and makes sense.

The debugging options would be nice, but it might make more sense to implement a DebugClient as a subclass, overriding _send to just print, rather than adding a kwarg. Either option requires changes at the client init site. Any thoughts?

@jsocol
Copy link
Owner

jsocol commented Mar 6, 2013

Closing this in favor of the pipeline method. See #20.

@jsocol jsocol closed this Mar 6, 2013
csestelo pushed a commit to Destygo/pystatsd that referenced this pull request Jul 18, 2022
* acknowledge every messages

* PR review

Co-authored-by: Maxime FENDER <maxime.fender@mindsay.com>
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

Successfully merging this pull request may close these issues.

2 participants