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

mock: document public API in collector module #2389

Merged
merged 17 commits into from Jun 24, 2023
Merged

Conversation

hds
Copy link
Contributor

@hds hds commented Nov 16, 2022

Motivation

There has been interest around publishing tracing-mock to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

Solution

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the Expect struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539

There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
@hds hds requested review from hawkw, davidbarsky and a team as code owners November 16, 2022 14:44
It creates too many issues (need to add `allow_deprecated` annotations
all over the place) and they will actually make fixing those tests to
use the new (but as yet unimplemented) `MockCollector::close_span` more
difficult.
They are! I removed the referce to `MockCollector::close_span` as it
doesn't yet exist.
Also cleaned up the text and tried to apply the code review comments
from #2426 to what I'd written already.
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Show resolved Hide resolved
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Show resolved Hide resolved
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
tracing-mock/src/collector.rs Show resolved Hide resolved
@@ -311,7 +313,7 @@ where
///
/// [`Collect::drop_span`]: fn@tracing::Collect::drop_span
/// [`close_span`]: fn@Self::close_span
#[deprecated(since = "0.1.0", note = "use `MockCollector::close_span` instead")]
Copy link
Member

Choose a reason for hiding this comment

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

why was the deprecated attribute on this function removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding the deprecated attribute meant adding #[allow_deprecated] on every single usage of it throughout the tracing tests. I felt it better to leave the deprecated attribute off until I can add a replacement. Then the current usage of drop_span can be replaced and this method can be marked as deprecated.

hds and others added 3 commits January 9, 2023 12:48
Co-authored-by: Eliza Weisman <eliza@buoyant.io>
All based on the lovely code review feedback I've been receiving.
tracing-mock/src/collector.rs Outdated Show resolved Hide resolved
@hds hds requested a review from hawkw January 18, 2023 17:28
@davidbarsky
Copy link
Member

I'm not really gonna be able to review the documentation for this; I trust that Eliza has gotten most of this.

@hawkw hawkw merged commit 9ad2740 into master Jun 24, 2023
57 checks passed
@hawkw hawkw deleted the hds/mock-collector-docs branch June 24, 2023 02:09
davidbarsky pushed a commit that referenced this pull request Sep 26, 2023
There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
davidbarsky pushed a commit that referenced this pull request Sep 27, 2023
There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
hawkw pushed a commit that referenced this pull request Oct 1, 2023
There has been interest around publishing `tracing-mock` to crates.io
for some time. In order to make this possible, documentation and some
code clean up is needed.

This change adds documentation to the collector module itself and to all the
public APIs in the module. This includes doctests on all the methods
that serve as examples.

Additionally the implementation for the `Expect` struct has been moved
into the module with the definition, this was missed in #2369.

Refs: #539
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.

None yet

3 participants