Eliza Weisman dfa8e7cd0a
Add a notion of "doneness" to Spans and allow them to mark themselves as done (#8)
Fixes #4.

This branch adds a notion of "doneness" to spans and allows spans to
mark themselves as "done" when they can no longer be entered. Spans know
when they are done by tracking the number of handles which may enter the
span; this means that the `Span::enter` API function had to be changed
to take the span by-value rather than by-reference. This meant some
other stuff had to be changed.

This branch also makes it possible to get _non-entering_ handles to a
span. These data handles keep the span's data alive, but may not
re-enter the span. This allows spans to mark themselves as done while
`Subscriber`s are still hanging on to references of their data, keeping
it alive.

Admittedly, this was a bit of a yak shave, but I also threw together a
quick mocking DSL for writing tests for this functionality. That code is
still a work in progress.

* move span to its own module

* Add states to spans

* WIP automatic span closure

* Make span module compile-y

* make core crate more compile-y

* make sloggish test compile

* whoa, something resembling unit tests!

* fix issue where span states transition _after_ notifying subscriber

* make test DSL nicer

* document span completion test

* fix test support code breaking when there's multiple tests

* add test for concurrently executing multiple threads

* Spans remain "running" as long as any thread is in the span

* add test for future span completion

* instrumented futures/streams mark their spans as done when completing

* Leave sinks be (they can't finish until the sink is dropped)

* refactor, make lock-free

* remove unused

* fix post-rebase breakage

* make everything else work with doneness API changes

* more docs

* Fix typo in comment

* Make converting from Span handles to Data handles more ergonomic

* Fix missing macro import breaking doctests

* add docs for internal span implementation types

* Clarify and factor out ActiveSpan state transition logic

* fix up rename

* fix doctest on stable compiler
2018-09-27 15:53:35 -07:00
2018-09-27 13:21:09 -07:00
Languages
Rust 99.8%
Shell 0.2%