-
Notifications
You must be signed in to change notification settings - Fork 729
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
chore: correct the MSRV check #934
Conversation
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.
Thanks for adding override: true
, I hadn't realized that this was necessary.
The MSRV bump is not ideal. In general, we have tried to follow the same policy as the rest of the Tokio project, and always support at least the last three stable compiler versions. Therefore, I'd prefer to avoid bumping to 1.44.0 if there's anything else we can do instead.
In this case, it looks like the bump was necessary due to the dependency on the protobuf
crate. I believe we depend on protobuf
only as a transitive dependency of prometheus
, which is itself a dependency of opentelemetry
(which tracing-opentelemetry
depends on). However, we don't currently use the opentelemetry
crate's "metrics" feature.
The tracing-opentelemetry
crate's dependency on opentelemetry
disables the default features and only enables the trace
feature, which shouldn't require protobuf
:
tracing/tracing-opentelemetry/Cargo.toml
Line 25 in 8fd9e76
opentelemetry = { version = "0.8", default-features = false, features = ["trace"] } |
However, it looks like the "metrics" feature is still being enabled because the examples
depend on opentelemetry
without disabling its default features:
Lines 54 to 56 in 8fd9e76
# opentelemetry example | |
opentelemetry = "0.8" | |
opentelemetry-jaeger = "0.7" |
Therefore, I think we should be able to build successfully on 1.39.0, if we just change the opentelemetry
dependency in the examples to
opentelemetry = { version = "0.8", default-features = false, features = ["trace"] }
Then, our build should not include the protobuf
crate.
Can we do that instead? Thanks!
I'm surprised that our builds are pulling
steps: | ||
- uses: actions/checkout@master | ||
- uses: actions/checkout@main |
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 have a slight preference for making the change from master
-> main
in a separate branch so that the git history is clearer, but it's not a big deal.
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.
+1. I believe that changing this now would close all open PRs on tracing.
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.
Well, this branch is actions/checkout's, not tracing's. We use actions/checkout (https://github.com/actions/checkout) to checkout on GHA and we're currently using master
. But on that repo, they, i.e., GitHub renamed their default branch to main
. So this change is reasonable.
The compile error we observed on our MSRV 1.39 seemed to be a 1.40 feature (option flattening) that came into use in the most recent tracing-attributes crate (0.1.10). tracing/tracing-attributes/src/lib.rs Line 933 in 35fee1c
Failed job: https://github.com/actix/actix-net/runs/990495589 |
Ah. In that case, we should just back out that change and release a new version of |
PR #875 added code to `tracing-attributes` that uses `Option::flatten`, which was only added to the standard library in Rust 1.40. This broke our MSRV, but we missed it because the MSRV CI checks weren't working correctly (fixed in #934). This commit removes the use of `Option::flatten`, and replaces it with a manual implementation. It's a little less pretty, but it builds on our MSRV (1.39.0).
The `opentelemetry` crate depends on `prometheus`, which depends on `protobuf`, a crate which doesn't compile on our MSRV (Rust 1.39). This was missed due to issues with the MSRV CI checks, which will be fixed fixed in #934. Therefore, once the MSRV checks work properly, the `protobuf` dependency will break our builds. We don't _need_ the `opentelemetry/metrics` feature, which is what enables the `prometheus` (and thus `protobuf`) dependency. `tracing-opentelemetry` already has a `default-features = false` dependency on `opentelemetry`, but the examples don't. Therefore, I've changed the examples crate to disable `opentelemetry`'s default features as well.
PR #875 added code to `tracing-attributes` that uses `Option::flatten`, which was only added to the standard library in Rust 1.40. This broke our MSRV, but we missed it because the MSRV CI checks weren't working correctly (fixed in #934). This commit removes the use of `Option::flatten`, and replaces it with a manual implementation. It's a little less pretty, but it builds on our MSRV (1.39.0).
The `opentelemetry` crate depends on `prometheus`, which depends on `protobuf`, a crate which doesn't compile on our MSRV (Rust 1.39). This was missed due to issues with the MSRV CI checks, which will be fixed fixed in #934. Therefore, once the MSRV checks work properly, the `protobuf` dependency will break our builds. We don't _need_ the `opentelemetry/metrics` feature, which is what enables the `prometheus` (and thus `protobuf`) dependency. `tracing-opentelemetry` already has a `default-features = false` dependency on `opentelemetry`, but the examples don't. Therefore, I've changed the examples crate to disable `opentelemetry`'s default features as well.
After the changes merged in #937, it looks like there are a couple of additional dependencies that don't support Rust 1.39.0: The
@tokio-rs/tracing what do we think about this? Should we do a bump now, or change CI to exclude tests & examples from MSRV? |
I say just merge this if this implements the check, I don't think its critical that we check examples/tests for MSRV but its nice to have. |
but I would like to stick with the same MSRV as tokio if we can, its imo not important to enforce tests/examples if that means we need to bump to 1.44. |
We only need to bump to 1.40 to build everything, now --- 1.44 was required by the Tokio's MSRV is 1.39 for Tokio 0.2 (0.3, as a breaking change, will bump to 1.45). However, we can't currently build |
Go for whatever tokio 0.3 is going for I think that is fine. |
Of the two options Eliza offered, I'd prefer to bump our MSRV to 1.42. I believe that we don't need 1.44 because Eliza removed usage of If this PR is updated to not change the the the master branch to the main branch (as I'm worried this will close any open PRs on this repo) and the MSRV is set to 1.42, I'm personally satisfied with this PR and will approve it. |
We are not going to bump to the latest version except when we release a breaking change. This is for the release version of I'm happy to bump to 1.45 or whatever when we release |
Please ping me when you come to a conclusion and I'm happy to update. Not part of the team, but I agree that the MSRV should be as low as possible. |
I think we should bump to 1.40.0 as part of this branch — per an offline conversation with @davidbarsky and @LucioFranco, I think they're both fine with that. |
@JohnTitor Sorry about that. Since Eliza removed the |
No worries, but it seems there's still a conflict, 1.40.0 or 1.42.0? |
Yup, there is. Again, sorry about that! Let's do 1.40, it's a bit more conservative and it unblocks you. Final answer! |
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.
Once we change the minimum Rust version in the configs, this will be good to merge! Thank you for the fix!
@JohnTitor, I hope you don't mind if I go ahead and apply the change to the MSRV in the configs and merge this? I'd really like to get the MSRV checks actually working again.
Sorry for the delay!
Yeah, feel free. Thanks for taking care of it instead :) |
No problem! Thanks so much for noticing the issue and fixing it! |
## Motivation PR #934 fixed a bug in the CI configuration where MSRV checks were not being run correctly. After this was fixed, it was necessary to bump the MSRV to 1.40.0, as the tests were no longer actually passing on 1.39, because some dependencies no longer support it. While updating the documentation to indicate that the new MSRV is 1.40, I noticed that the note on the MSRV was located inconsistently in the READMEs and `lib.rs` documentation of various crates, and missing entirely in some cases. Additionally, there have been some questions on what our MSRV _policies_ are, and whether MSRV bumps are considered breaking changes (see e.g. #936). ## Solution I've updated all the MSRV notes in the documentation and READMEs to indicate that the MSRV is 1.40. I've also ensured that the MSRV note is in the same place for every crate (at the end of the "Overview" section in the docs), and that it's formatted consistently. Furthermore, I added a new section to the READMEs and `lib.rs` docs explaining the current MSRV policy in some detail. Hopefully, this should answer questions like #936 in the future. The MSRV note in the overview section includes a link to the section with further details. Finally, while doing this, I noticed a couple of crates (`tracing-journald` and `tracing-serde`) were missing top-level `lib.rs` docs. Rather than just adding an MSRV note and nothing else, I went ahead and fixed this using documentation from those crate's READMEs. Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Motivation
The current MSRV check is lazybones, it's meaningless unless we override toolchain. Actually, we cannot compile tracing crates with 1.39.0, it should work with 1.44.0 or later because of the
protobuf
crate and others.Solution
This enforces to override toolchain and updates MSRV to 1.44.0, this should compile all the crates fine.
And replaces
actions/checkout@master
withmain
as they've renamed the default branch name tomain
.