vectordotdev / vector

A high-performance observability data pipeline.
https://vector.dev
Mozilla Public License 2.0
18.04k stars 1.59k forks source link

Remove dependency on tokio 0.1 #2945

Closed lukesteensen closed 4 years ago

lukesteensen commented 4 years ago

This is a prerequisite for removing tokio-compat and using some nice things like the #[tokio::test] macro.

First, we need to upgrade dependencies that rely on tokio 0.1 (some of these are in progress):

$ cargo tree -i -p tokio:0.1.22          
tokio v0.1.22                                                   
├── hyper v0.12.35                                              
│   ├── hyper-openssl v0.7.1                                    
│   │   └── shiplift v0.6.0                                     
│   │       └── vector v0.10.0 (/home/luke/code/vector)         
│   ├── hyper-tls v0.3.2                                        
│   │   └── reqwest v0.9.24                                     
│   │       └── vector v0.10.0 (/home/luke/code/vector)         
│   ├── hyperlocal v0.6.0                                       
│   │   └── shiplift v0.6.0 (*)                                 
│   ├── reqwest v0.9.24 (*)                                     
│   └── shiplift v0.6.0 (*)                                     
├── hyperlocal v0.6.0 (*)                                       
├── pulsar v0.3.0                                               
│   └── vector v0.10.0 (/home/luke/code/vector)                 
├── reqwest v0.9.24 (*)                                         
├── shiplift v0.6.0 (*)                                         
├── trust-dns-resolver v0.12.0                                  
│   └── pulsar v0.3.0 (*)                                       
└── vector v0.10.0 (/home/luke/code/vector)                     

Second, we need to remove tokio 0.1 types from our sources, sinks, and transforms. These consist mostly of timers and IO types like sockets that we should switch to the equivalent tokio 0.2 types. Where relevant and not too invasive, this can also be a good time to do some light updates away from futures 0.1 combinators and towards async/await. The following is a rough list of files that import tokio01:

This work should be very easy to work on in parallel, so feel free to grab a dependency or a specific file and go to work on a PR.

binarylogic commented 4 years ago

@kirillt @ktff would you mind putting your name by each file before you begin work? This will ensure there are no conflicts. I'm happy to split this out into separate issues if you think it'll be easier, but I think it'll add a significant amount of noise.

fanatid commented 4 years ago

New dependency tree (https://github.com/timberio/vector/commit/ae53b889406942dd404578fc84d2675ea2e282ac):

$ cargo tree -i -p tokio:0.1.22
tokio v0.1.22
├── pulsar v0.3.0
│   └── vector v0.10.0 (/home/kirill/projects/vector)
├── trust-dns-resolver v0.12.0
│   └── pulsar v0.3.0 (*)
└── vector v0.10.0 (/home/kirill/projects/vector)

After pulsar update (https://github.com/timberio/vector/pull/2977) only vector will depend from tokio:0.1.22.

Edit: pulsar merged (https://github.com/timberio/vector/tree/ccbb802c010c6109240a14be44b3c30dbae73564):

$ cargo tree -i -p tokio:0.1.22
tokio v0.1.22
└── vector v0.10.0 (/home/kirill/projects/vector)
fanatid commented 4 years ago

@ktff I'll start on updating codec, roughly this files will be affected:

$ grep 'codec::' -rl src/
src/sinks/statsd.rs
src/sinks/util/tcp.rs
src/sinks/util/unix.rs
src/test_util.rs
src/sources/vector.rs
src/sources/statsd/mod.rs
src/sources/http.rs
src/sources/syslog.rs
src/sources/socket/unix.rs
src/sources/socket/mod.rs
src/sources/util/tcp.rs
src/sources/util/unix.rs
ktff commented 4 years ago

@fanatid I'll start with src/shutdown.rs.

ktff commented 4 years ago

@fanatid I'll start with benches/http.rs

fanatid commented 4 years ago

@ktff I'll start work on updating MaybeTlsStream and related things (currently on top of #3095, will rebase when will be merged).

fanatid commented 4 years ago

@ktff I'm going remove https://github.com/timberio/vector/blob/6a6c390b7e7af2b977ff088245e94e31cefb7640/src/stream.rs#L40 and update affected code.

fanatid commented 4 years ago

@ktff looks like not a lot of tokio01 usage left, I do not think that it cost divide files, so I'll take rest.

ktff commented 4 years ago

@fanatid how is this going? Need any extra hands?

fanatid commented 4 years ago

Need only update my previous TLS PR #3188 and we should be able remove tokio:0.1. Should finish soon, no need help right now I think. Thanks!