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(new source): Initial udp source implementation #738

Merged
merged 4 commits into from
Aug 14, 2019
Merged

feat(new source): Initial udp source implementation #738

merged 4 commits into from
Aug 14, 2019

Conversation

ktff
Copy link
Contributor

@ktff ktff commented Aug 11, 2019

Initial implementation of #338 plus tests.

Signed-off-by: Kruno Tomola Fabro <krunotf@gmail.com>
@ktff ktff changed the title feat: Udp source (#338) feat: Udp source Aug 11, 2019
@binarylogic binarylogic changed the title feat: Udp source feat(new source): Initial udp source implementation Aug 11, 2019
@ktff
Copy link
Contributor Author

ktff commented Aug 11, 2019

Test "topology::tests::topology_replace_source_transform_and_sink" is failing for some reason.

@binarylogic
Copy link
Contributor

binarylogic commented Aug 11, 2019

@ktff that's a known intermittent failure that we're working to address (#694). If you re-run the tests it will most likely pass.

cc/ @LucioFranco

@LucioFranco
Copy link
Contributor

I've opened #740 in hopes that this will be fixed with our topology test updates. We also want to probably start limitnig more tests to use our test_util::runtime instead of tokio::runtime::Runtime directly.

Copy link
Contributor

@LucioFranco LucioFranco left a comment

Choose a reason for hiding this comment

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

Looking pretty good! Just a few comments in line, let me know if you have any questions 😄

src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
src/sources/udp.rs Show resolved Hide resolved
@binarylogic binarylogic requested review from LucioFranco and removed request for lukesteensen August 11, 2019 18:27
Copy link
Member

@lukesteensen lukesteensen left a comment

Choose a reason for hiding this comment

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

Nice! I agree with @LucioFranco's cleanups and that we can use the decoder and UdpFramed better. Then this should be good to go 😄

src/sources/udp.rs Show resolved Hide resolved
.flatten()
.map_err(|e: io::Error| error!("error reading datagram: {:?}", e))
.forward(out)
.map(|_| info!("finished sending"))
Copy link
Member

Choose a reason for hiding this comment

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

Will this be triggered when we shut down the listening socket? I know we have something similar that gets hit when incoming tcp connections close. Not a big deal, but might be nice to be a little more specific with the message or just omit it if it's not really telling us something valuable (e.g. only happening on shutdown, which other log lines will be telling us about already).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those are errors from decoder. UdpFrame it self throws no errors. So actually yes, I could be more specific about it.

Copy link
Member

Choose a reason for hiding this comment

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

The finished sending line? It looks like it will get triggered upon successful completion of the forward future, which I think only happens once we stop listening on the socket.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You were right in both occasions.

The first errors come from mio::UdpSocket. They come from different methods, maybe even from OS, so message "error reading datagram: {:?}" seems sensible to me.

The finished sending is indeed called only once, if even that since I am not sure that there is any other way of stop listening on udp socket besides droping the future.

Following commit will address this issues.

src/sources/udp.rs Show resolved Hide resolved
src/sources/udp.rs Outdated Show resolved Hide resolved
ktff and others added 2 commits August 13, 2019 13:41
Co-Authored-By: Lucio Franco <luciofranco14@gmail.com>
Signed-off-by: Kruno Tomola Fabro <krunotf@gmail.com>
Signed-off-by: Kruno Tomola Fabro <krunotf@gmail.com>
@ktff
Copy link
Contributor Author

ktff commented Aug 13, 2019

@ktff that's a known intermittent failure that we're working to address (#694). If you re-run the tests it will most likely pass.

cc/ @LucioFranco

I don't have write permission to rerun testing.
Or is there some other way, besides pushing new commit?

Copy link
Member

@lukesteensen lukesteensen left a comment

Choose a reason for hiding this comment

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

I just reran the tests, but yes it'd be nice to figure out how to grant contributors access to that.

Unless the tests fail for some other reason or @LucioFranco has anything else, this looks good to me!

@LucioFranco
Copy link
Contributor

I took a look at UdpFramed and I see the issue...a bit annoying. I say we can merge this just fine and then introduce a fix to udpframed in 0.1 and get that published. Once that is done we can simplify this sink.

Signed-off-by: Kruno Tomola Fabro <krunotf@gmail.com>
@ktff
Copy link
Contributor Author

ktff commented Aug 14, 2019

@lukesteensen do check latest commit that fixes the logging issue, after that I'll merge.

Copy link
Member

@lukesteensen lukesteensen left a comment

Choose a reason for hiding this comment

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

Looks perfect, thanks!

@binarylogic
Copy link
Contributor

Nice work @ktff, looks great.

@LucioFranco
Copy link
Contributor

I've opened an issue around UdpFramed that we should follow up with once it is done. ref tokio-rs/tokio#1443

@ktff ktff merged commit 756b115 into vectordotdev:master Aug 14, 2019
@ktff ktff deleted the udp-source branch August 14, 2019 20:19
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.

4 participants