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

[breaking] deps(udp): make tracing optional and add optional log #1921

Closed
wants to merge 3 commits into from

Conversation

mxinden
Copy link
Collaborator

@mxinden mxinden commented Jul 18, 2024

This commit makes the tracing dependency in quinn-udp optional, but enabled by default. If disabled, log is used. By adding it to the default feature set, this is not a breaking change.


Context:

  • I am working on integrating quinn-udp into Firefox. See mozilla-central pull request.

  • Each Rust dependency in Firefox needs to be audited via cargo vet.

    ➜  mozilla-unified git:(quic-rust-udp-io) ✗ ./mach cargo vet 
    Vetting Failed!
    
    3 unvetted dependencies:
      tracing:0.1.37 missing ["safe-to-deploy"]
      tracing-attributes:0.1.24 missing ["safe-to-deploy"]
      tracing-core:0.1.30 missing ["safe-to-deploy"]
    
    recommended audits for safe-to-deploy:
        Command                                      Publisher  Used By                                   Audit Size
        cargo vet inspect tracing-attributes 0.1.24  hawkw      tracing                                   5025 lines
        cargo vet inspect tracing-core 0.1.30        hawkw      tracing                                   7032 lines
        cargo vet inspect tracing 0.1.34             hawkw      h2, warp, hyper, quinn-udp, and 2 others  11016 lines
    
    estimated audit backlog: 23073 lines
    
  • quinn-udp optionally not depending on tracing will safe Mozilla a lot of work auditing all of tracing.

Questions:

  • Would you be open to making tracing optional in quinn-udp?
  • If yes, how would you want to proceed with the log feature? See inline comment below.

Follow-up to #1473 and #1903

quinn-udp/Cargo.toml Outdated Show resolved Hide resolved
@djc
Copy link
Member

djc commented Jul 18, 2024

Definitely unexcited about this change, but I suppose I can live with it.

Does the cargo vet output imply that mozilla-central already depends on h2 and warp, or just that those are the most popular crates.io crates that depend on tracing?

quinn-udp/Cargo.toml Outdated Show resolved Hide resolved
quinn-udp/src/unix.rs Outdated Show resolved Hide resolved
@mxinden
Copy link
Collaborator Author

mxinden commented Jul 18, 2024

Does the cargo vet output imply that mozilla-central already depends on h2 and warp, or just that those are the most popular crates.io crates that depend on tracing?

mozilla-central depends on h2 and warp as dev-dependencies. warp is used to test the crashreporter, h2 is, I assume, used in warp through hyper only.

quinn-udp will be used not as a dev-dependency, but as a dependency. Thus it requires a stronger audit, namely a safe-to-deploy audit instead of a safe-to-run audit.

quinn-udp/src/unix.rs Show resolved Hide resolved
quinn-udp/src/unix.rs Outdated Show resolved Hide resolved
quinn-udp/Cargo.toml Outdated Show resolved Hide resolved
@mxinden mxinden force-pushed the optional-tracing branch 2 times, most recently from e79254b to 9066958 Compare July 18, 2024 10:30
@mxinden
Copy link
Collaborator Author

mxinden commented Jul 18, 2024

I don't think the freebsd CI check failure is related:

  thread 'tests::key_update_simple' panicked at quinn-proto/src/tests/mod.rs:996:5:
  assertion failed: `None` does not match `Some(Event::Stream(StreamEvent::Readable { id })) if id == s`
  
  
  failures:
      tests::key_update_simple
  
  test result: FAILED. 232 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.94s
  
  error: test failed, to rerun pass `-p quinn-proto --lib`

quinn-udp/Cargo.toml Outdated Show resolved Hide resolved
quinn/Cargo.toml Outdated Show resolved Hide resolved
This commit makes the `tracing` dependency in `quinn-udp` optional, but enabled
by default. In additional it adds optional logging via `log`. `tracing` takes
precedence over `log`.
@mxinden mxinden changed the title deps(udp): make tracing optional deps(udp): make tracing optional and add optional log Jul 18, 2024
@djc
Copy link
Member

djc commented Jul 18, 2024

Thanks, this looks good to me.

Copy link
Collaborator

@Ralith Ralith left a comment

Choose a reason for hiding this comment

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

Thanks!

@Ralith
Copy link
Collaborator

Ralith commented Jul 18, 2024

Note that quinn-udp is presently a public dependency of quinn by direct reexport. I don't recall offhand if there's a very good reason for this, but it does mean we can't update quinn to use quinn-udp 0.6 without a breaking change.

I think we could avoid the breaking change in quinn-udp in this change. For example, we could have a feature native-log = ["dep:log"] and retain the existing log feature. That may or may not be worth the trouble/weirdness depending on whether we expect other breaking quinn-udp changes soon.

@djc
Copy link
Member

djc commented Jul 18, 2024

I think we could avoid the breaking change in quinn-udp in this change. For example, we could have a feature native-log = ["dep:log"] and retain the existing log feature. That may or may not be worth the trouble/weirdness depending on whether we expect other breaking quinn-udp changes soon.

I think that makes sense as a temporary solution until the next breaking change? I think the only downside is the slightly weird feature name, which seems manageable if that lets us retain semver compatibility.

@mxinden mxinden changed the title deps(udp): make tracing optional and add optional log [breaking] deps(udp): make tracing optional and add optional log Jul 19, 2024
@mxinden
Copy link
Collaborator Author

mxinden commented Jul 19, 2024

Good catch @Ralith. Thanks.

I created #1923 implementing your suggestion above.

That may or may not be worth the trouble/weirdness depending on whether we expect other breaking quinn-udp changes soon.

Happy to prepare an additional clean-up pull request that can be merged once a breaking change release is in sight.

What do you think @djc and @Ralith?

@Ralith
Copy link
Collaborator

Ralith commented Jul 19, 2024

LGTM! Merged #1923.

@Ralith Ralith closed this Jul 19, 2024
mxinden added a commit to mxinden/quinn that referenced this pull request Jul 22, 2024
Previously `quinn*` would provide the `log` feature to log events via `log` if
no `tracing` subscriber exists.

Later quinn-rs#1923 allowed `quinn-udp` to log via
`log` directly, making `tracing` an optional dependency. For that, it introduced
the `direct-log` feature, a workaround name in order to not introduce a breaking
change.

This commit cleans up the above, renaming the `log` feature to `tracing-log` and
the `direct-log` to `log`. This is a breaking change and thus `quinn-udp` is
bumped to `v0.6.0`.

See quinn-rs#1921 for the full history.
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.

3 participants