Skip to content

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

Merged
ktff merged 4 commits intovectordotdev:masterfrom
ktff:udp-source
Aug 14, 2019
Merged

feat(new source): Initial udp source implementation#738
ktff merged 4 commits intovectordotdev:masterfrom
ktff:udp-source

Conversation

@ktff
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

ktff commented Aug 11, 2019

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

@binarylogic
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 😄

Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs Outdated
Comment thread src/sources/udp.rs
@binarylogic binarylogic requested review from LucioFranco and removed request for lukesteensen August 11, 2019 18:27
Copy link
Copy Markdown
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 😄

Comment thread src/sources/udp.rs
Comment thread src/sources/udp.rs Outdated
.flatten()
.map_err(|e: io::Error| error!("error reading datagram: {:?}", e))
.forward(out)
.map(|_| info!("finished sending"))
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread src/sources/udp.rs
Comment thread src/sources/udp.rs Outdated
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

ktff commented Aug 14, 2019

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

Copy link
Copy Markdown
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
Copy Markdown
Contributor

Nice work @ktff, looks great.

@LucioFranco
Copy link
Copy Markdown
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