-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Implement a UDP client #4648
Implement a UDP client #4648
Conversation
Looks good to me. Should |
fcb4066
to
9430117
Compare
@corylanou @jwilder @otoolep My 1st precision implementation wasn't working right, so I've added a function to models.Point, |
@otoolep That's a good question, maybe I could have |
@sparrc -- have we made any promises re V2 yet? |
@otoolep I'm not sure what you mean by promises, but we do have this note telling people to use it already: https://github.com/influxdb/influxdb/tree/master/client#description |
OK, that is what I mean. OK, I would scrap the idea of renaming and leave |
b744f8f
to
0552ba6
Compare
@otoolep I made some significant changes based on what we were talking about in Slack. Now the UDP client will write a UDP packet before we hit the maximum size (64kb) and then reset the buffer |
} | ||
|
||
// Write and reset the buffer if we reach the max size | ||
if b.Len() > UDPMaxSendSize { |
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.
While this will probably work in practise, this is not watertight. Instead the logic should be checking that if adding the new point to the existing buffer will send the buffer over the limit, then call con.Write()
before adding the new point.
Make sense?
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.
Unless you can be sure that a point coming in will not be greater than ~1K, but still, this logic shouldn't care if it's watertight.
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.
It's a better idea, I was worried about the extra processing, but I'll benchmark it and see
10d2525
to
ddcebcd
Compare
@otoolep I've pushed the changes you suggested about the buffer size before writing, and I also made changes to make the godoc examples look better, as well as an update to the README |
Don't forget the CHANGELOG. |
} | ||
} | ||
|
||
_, err = con.Write(b.Bytes()) |
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.
I presume it's OK to write b
if len(b)
is 0.
I think this looks fine. I do think you need to actually test that packets sent using this code actually works -- code a throwaway client that uses UDP and sends data to an InfluxDB service, and check that the data is in InfluxDB. Since it's UDP, this unit testing doesn't guarantee it is working. Just to be sure. Once you do that, +1 |
3f53c5d
to
51b1a42
Compare
closes #4647
closes #4647