Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Add clone_span and drop_span hooks to Subscriber #97

Merged
merged 11 commits into from Nov 16, 2018
Merged

Conversation

hawkw
Copy link
Owner

@hawkw hawkw commented Nov 15, 2018

Closes #80

This branch adds new clone_span and drop_span methods to the Subscriber
trait, which are called when a span handle is cloned or dropped, respectively.
This allows the subscriber to track the number of span handles with a given ID,
so that a pointer (or an index into an arena) may be used as span IDs, and the
subscriber may deallocate the storage for a span when that span no longer
exists.

Both of these methods have default implementations which do nothing, so that
subscriber implementations which don't need to track this information don't need
to implement them. However, they may be overridden by subscribers which do care
about span reference counts. This is similar to the clone_id and drop_id methods of
futures::executor::Notify.

This branch also allows the test support mock subscriber to expect calls to
these methods, and adds new unit tests for them.

Signed-off-by: Eliza Weisman eliza@buoyant.io

@hawkw hawkw added kind/enhancement New feature or request crate/core Issues and features relating to the `tokio-trace-core` crate labels Nov 15, 2018
@hawkw hawkw added this to the core 0.1 milestone Nov 15, 2018
@hawkw hawkw self-assigned this Nov 15, 2018
@hawkw hawkw added this to In progress in core 0.1 via automation Nov 15, 2018
@hawkw hawkw merged commit 533ede5 into master Nov 16, 2018
core 0.1 automation moved this from In progress to Done Nov 16, 2018
@hawkw hawkw deleted the eliza/clone-id branch November 16, 2018 00:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crate/core Issues and features relating to the `tokio-trace-core` crate kind/enhancement New feature or request
Projects
core 0.1
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

1 participant