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

Improve README for first time users #825

Merged
merged 3 commits into from
Aug 5, 2020
Merged

Conversation

bz2
Copy link
Contributor

@bz2 bz2 commented Jul 18, 2020

Motivation

The documentation nearly put me off trying to use tracing at all. It looks hard to set up and use, and the two problems I first ran into (needing to output to stderr, and instrumenting a function with a non-formattable arg) were not easy to find the right solutions for.

Solution

This change rearranges the README a little to emphasise solutions, rather than problems and extra details a first time user probably doesn't need to care about yet.

  • Start with the simple way of setting up a subscriber rather than diving into the complex ways.
  • Show the preferred method of instrumenting async code before explaining why it is more complex and how it's implemented.
  • Remove yak credit. Does anyone care?

Start with the simple way of setting up a subscriber rather than
diving into the complex ways.

Show the preferred method of instrumenting async code before
explaining why it is more complex and how it's implemented.

Remove yak credit. Does anyone care?
@bz2 bz2 requested review from hawkw and a team as code owners July 18, 2020 15:14
@hawkw
Copy link
Member

hawkw commented Jul 18, 2020

cc @davidbarsky and @yaahc, who almost certainly have docs opinions.

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

Thanks for working on the docs, it's much appreciated! I had a few thoughts that I commented on inline.

A lot of the same examples are reproduced in the tracing crate's README (https://github.com/tokio-rs/tracing/tree/master/tracing#usage), since that's what's rendered on the crate's crates.io page. Once we finalize the changes to the repository README, we ought to try to ensure the relevant changes are reflected there as well.

README.md Outdated Show resolved Hide resolved
```

This requires the [`tracing-futures`] crate to be specified as a dependency.

Copy link
Member

Choose a reason for hiding this comment

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

And then maybe put the example with the instrument combinator here as well, before discussing the reasons for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was an awkward join between the examples still. I've reworked the language here but left the motivation in the middle, as it helps understand the combinator (though you can arrive here without really having taken in what a span is yet).

README.md Outdated
Note: Libraries should *NOT* call `set_global_default()`, as this will cause
conflicts when executables try to set the default later.
Note: Libraries should *NOT* install a subscriber by using a method than calls
`set_global_default()`, as this will cause conflicts when executables try to
Copy link
Member

Choose a reason for hiding this comment

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

I think we should at least discuss the existence of set_global_default and what it does before this warning. If the first example is changed to show tracing_subscriber::init, then users will read this note before even knowing that there is a function called set_global_default.

Perhaps another example after the first one, explaining that tracing_subscriber::init() uses set_global_default, the generalized way of setting a global default subscriber?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added some better joining language between the examples to address this. I think one simple example and one complex example is enough?

README.md Show resolved Hide resolved
@yaahc
Copy link
Collaborator

yaahc commented Jul 18, 2020

I think this is a great idea. I don't have any comments on the particular changes being made but I think I'll follow the example set here and make the same changes to tracing-error to prioritize examples about setup over examples about advanced usage.

My one comment is that I think should be applied to more than just README.md files. I almost never go to the readme first, I usually just type docs.rs/tracing into the url bar and go straight to the docs, so I'd like to see changes like these made to the core docs on the lib.rs file. I think much of the docs on the main page could be moved to a guide similar to SNAFU's docs, and leave the main page to examples of setup and simple usage along with links to relevant crates and whatnot.

@hawkw
Copy link
Member

hawkw commented Jul 18, 2020

@yaac

I think much of the docs on the main page could be moved to a guide similar to SNAFU's docs, and leave the main page to examples of setup and simple usage along with links to relevant crates and whatnot.

The new version of tokio.rs is going live pretty soon, and will have a tracing section, so that's probably a good home for long-form guides and tutorials. It's mostly usage examples and related crates now

Also, I think the lib.rs docs have gotten a bit more concise recently — in the last couple of releases I think a lot of the more detailed documentation has moved to the span and eventmodules, IIRC.

@bz2
Copy link
Contributor Author

bz2 commented Jul 23, 2020

@yaahc @hawkw Thanks for the reviews! I'll reply to a few specifics inline and make updates.

Address @hawkw review comments. Opted for clearer wording in passages
joining examples together rather than extra reordering for now.
@bz2 bz2 force-pushed the less_scary_readme branch from 0fa1438 to c527fd2 Compare July 23, 2020 02:45
@hawkw hawkw requested a review from davidbarsky July 23, 2020 02:59
@hawkw
Copy link
Member

hawkw commented Jul 27, 2020

@davidbarsky have you had a chance to give this a skim yet?

Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

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

I was hoping to get @davidbarsky to give this a skim, but I think it's fine to merge as-is. We can always make more docs improvements in a follow-up.

@davidbarsky
Copy link
Member

I haven't had the time; feel free to merge.

@hawkw hawkw merged commit 0da8e3f into tokio-rs:master Aug 5, 2020
@bz2
Copy link
Contributor Author

bz2 commented Aug 5, 2020

@hawkw Thanks! I see from #808 that the future is changing, so lets let that resolve and maybe do another pass over the async bit before propagating to more bits of docs?

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