task: add tests for tracing instrumentation of tasks #6112
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Tokio is instrumented with traces which can be used to analyze the
behavior of the runtime during execution or post-mortem. The
instrumentation is optional. This is where tokio-console collections
information.
There are currently no tests for the instrumentation.
Solution
In order to provide more stability to the instrumentation and prepare
for future changes, tests are added to verify the current behavior. The
tests are written using the
tracing-mock
crate. As this crate is stillunreleased, a separate test create has been added under
tokio/tests
which is outside the workspace. This allows us to pull in both
tracing
and
tracing-mock
from the tracing repository on GitHub withoutaffecting the rest of the tokio repository.
Once
tracing-mock
is published on crates.io (tokio-rs/tracing#539),these tests can be moved in with the "normal" tokio integration tests.
The decision to add these tests now is due to the release of
tracing-mock
taking a while, so it would be better to have tests whilewe wait.