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

BatchedDogStatsd static variables #67

Open
SamMousa opened this issue Jul 27, 2018 · 3 comments
Open

BatchedDogStatsd static variables #67

SamMousa opened this issue Jul 27, 2018 · 3 comments

Comments

@SamMousa
Copy link

Because the BatchedDogStatsd class uses static variables instead it is essentially a singleton.

It is not possible to have multiple instances which target different daemons or have different buffer sizes.

All variables in this class should be non-static.

@timrourke
Copy link
Contributor

@SamMousa just curious - do you get any use out of BatchedDogStatsd? It's not a terrible idea in principle to give users a way to batch sends, but given the nature of PHP (not generally a long-running process), and the tiny size of this class, I wonder how much value it actually provides to users?

One could write a cleaner implementation of this "batching" behavior to suit their specific use case without a ton of trouble. Does BatchedDogStatsd earn its keep?

@SamMousa
Copy link
Author

SamMousa commented Sep 1, 2018

In the end I have written my own class that doesn't user the daemon, but instead uses the TCP endpoint directly.

Batch sending is definitely needed if you log a lot of informational messages.

@timrourke
Copy link
Contributor

@SamMousa yeah I take your point, especially after writing these tests: https://github.com/DataDog/php-datadogstatsd/pull/70/files#diff-d0bbee088a9ac139cc0ce4ae6f91921bR7

Boo to static variables, they must go.

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

2 participants