Skip to content

Add UDP as a sink protocol#95

Merged
charlievieth merged 4 commits intomasterfrom
cev/add-upd-option
Apr 16, 2020
Merged

Add UDP as a sink protocol#95
charlievieth merged 4 commits intomasterfrom
cev/add-upd-option

Conversation

@charlievieth
Copy link
Copy Markdown
Contributor

@charlievieth charlievieth commented Apr 15, 2020

This commit adds support for UDP statsd sinks with the STATSD_PROTOCOL
environment variable and the WithStatsdProtocol() SinkOption.

Extends the work initially started with: #47

@charlievieth charlievieth force-pushed the cev/add-upd-option branch 2 times, most recently from ecbad3c to c574241 Compare April 15, 2020 22:15
@charlievieth charlievieth changed the title WIP: add UDP as a sink protocol Add UDP as a sink protocol Apr 15, 2020
@charlievieth charlievieth force-pushed the cev/add-upd-option branch 2 times, most recently from 0fdfe9d to 3f5aabe Compare April 15, 2020 22:19
This commit adds support for UDP statsd sinks with the STATSD_PROTOCOL
environment variable and the WithStatsdProtocol() SinkOption.
twoism
twoism previously approved these changes Apr 15, 2020
Copy link
Copy Markdown

@twoism twoism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor nit

// buffer size that will prevent datagram fragmentation.
var bufSize int
switch s.conf.StatsdProtocol {
case "udp", "udp4", "udp6":
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constantize, please :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I normally would, but I think having something like:

const (
	ProtocolUDP  = "udp"
	ProtocolUDP4 = "udp4"
	ProtocolUDP6 = "udp6"
	ProtocolTCP  = "tcp"
	ProtocolTCP4 = "tcp4"
	ProtocolTCP6 = "tcp6"
)

Would add more noise than it's worth and wouldn't be as clear.

@charlievieth
Copy link
Copy Markdown
Contributor Author

Note: fixing an issue with timing (the test explicitly tests timing so can't/won't mock) on Travis since it is very slow.

Charlie Vieth added 3 commits April 16, 2020 15:32
This test is incredibly fast so doesn't need to run in parallel and I'm
trying to reduce the number of goroutines we have in flight at any time
during out tests.
Due to the nature of UDP the reconnect test is flaky (especially when
ran with the race detector) this "fixes" it by changing it to log
failures instead of failing the test.
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