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 APIs in span module #2442

Merged
merged 12 commits into from
Nov 14, 2023
Merged

mock: document public APIs in span module #2442

merged 12 commits into from
Nov 14, 2023

Conversation

hds
Copy link
Contributor

@hds hds commented Jan 12, 2023

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.

The span module needs documentation and examples.

Solution

This change adds documentation to the span module and all the public
APIs within it. This includes doctests on all the methods which serve as
examples.

Additionally, the validation on ExpectedSpan was improved so that it
validates the level and target during enter and exit as well as on
new_span.

The method ExpectedSpan::with_field was renamed to with_fields
(plural) to match the same method on ExpectedEvent (and because
multiple fields can be passed to it).

A copy-paste typo was also fixed in the documentation for
ExpectedEvent::with_contextual_parent.

Refs: #539

This change adds documentation to the span module and all the public
APIs within it. This includes doctests on all the methods which serve as
examples.

Additionally, the validation on `ExpectedSpan` was improved so that it
validates the level and target during `enter` and `exit` as well as on
`new_span`.

The method `ExpectedSpan::with_field` was renamed to `with_fields`
(plural) to match the same method on `ExpectedEvent` (and because
multiple fields can be passed to it).

A copy-paste typo was also fixed in the documentation for
`ExpectedEvent::with_contextual_parent`.

Refs: #539
@hds hds requested review from hawkw, davidbarsky and a team as code owners January 12, 2023 13:31
Copy link
Member

@davidbarsky davidbarsky left a comment

Choose a reason for hiding this comment

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

not done reviewing docs, but i figured i could share a start!

tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
tracing-mock/src/span.rs Outdated Show resolved Hide resolved
@davidbarsky
Copy link
Member

after my suggestions are applied, this looks good to me :)

Copy link
Contributor Author

@hds hds left a comment

Choose a reason for hiding this comment

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

@davidbarsky I made all the changes, except one that I think needed rewording, what do you think?

tracing-mock/src/span.rs Outdated Show resolved Hide resolved
@hds hds merged commit ad2bfaa into master Nov 14, 2023
56 checks passed
@hds hds deleted the hds/mock-docs-span branch November 14, 2023 09:57
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.

2 participants