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

feat(statsd receiver): enable use of unix domain sockets #16421

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Manbeardo
Copy link
Contributor

@Manbeardo Manbeardo commented Jan 21, 2025

Summary:

The statsd receiver currently only supports UDP and TCP connections, but the TCP code does very little that's actually unique to TCP. This diff adds support for unix domain sockets and other flavors of TCP (tcp4, tcp6) by refactoring the statsd receiver to use net.Listener instead of *net.TCPListener.

Test Plan:

Added unit test coverage for unix domain sockets and the tests pass.

Stack created with Sapling. Best reviewed with ReviewStack.

@telegraf-tiger
Copy link
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@Manbeardo
Copy link
Contributor Author

!signed-cla

James Ribe added 3 commits January 21, 2025 14:27
…ruct

Summary:

Later in this stack of diffs, I add a field named `MaxConnections` to `Statsd` because it controls the max number of connections for all listener types, not just TCP listeners. That creates a naming collision with the existing field named `MaxConnections`, which is an internal stat tracker. This diff eliminates that name collision by encapsulating all of `Statsd`'s internal stat trackers in a struct.

Test Plan:

Existing unit tests pass.
Summary:

Later in this stack of diffs, I rename `TCPlistener` to `Listener` because it becomes a generic listener for all networks supported by `net.Listen`. That makes `UDPlistener`'s naming stand out because:

- It isn't a listener. It's a `*net.UDPConn`.
- It isn't the UDP counterpart to `Listener`.

This diff renames it to `UDPConn` to improve clarity.

Test Plan:

Unit tests pass.
Summary:

The statsd receiver currently only supports UDP and TCP connections, but the TCP code does very little that's actually unique to TCP. This diff adds support for unix domain sockets and other flavors of TCP (`tcp4`, `tcp6`) by refactoring the statsd receiver to use `net.Listener` instead of `*net.TCPListener`.

Test Plan:

Added unit test coverage for unix domain sockets and the tests pass.
@Manbeardo Manbeardo changed the title [statsd receiver] enable use of unix domain sockets feat(statsd receiver): enable use of unix domain sockets Jan 21, 2025
@telegraf-tiger telegraf-tiger bot added the feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin label Jan 21, 2025
@telegraf-tiger
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat Improvement on an existing feature such as adding a new setting/mode to an existing plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant