mirror of
https://github.com/tokio-rs/tracing.git
synced 2025-10-02 15:24:47 +00:00
subscriber: feature flag registry implementation only (#565)
## Motivation Currently, both the `Registry` type _and_ the `LookupSpan` and `SpanData` traits require the "registry" feature flag. This means that if a user wishes to implement their own custom registry type that implements `LookupSpan`, they must enable the "registry" feature flag, which also enables the `Registry` type and its dependencies. ## Solution This commit changes the feature flag so that only the `Registry` and `Data` types are conditional on the "registry" feature. The `LookupSpan` and `SpanData` traits are now always enabled, as they are not much code & don't require any additional internal dependencies (although if anyone thinks it's important for them to have their own separate feature flag, I am willing to change that). Signed-off-by: Eliza Weisman <eliza@buoyant.io>
This commit is contained in:
parent
bf6c4d55b7
commit
737eba22a8
@ -98,8 +98,6 @@ pub mod filter;
|
||||
pub mod fmt;
|
||||
pub mod layer;
|
||||
pub mod prelude;
|
||||
#[cfg(feature = "registry")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
|
||||
pub mod registry;
|
||||
pub mod reload;
|
||||
pub(crate) mod sync;
|
||||
|
@ -68,11 +68,18 @@ use tracing_core::{field::FieldSet, span::Id, Metadata};
|
||||
|
||||
/// A module containing a type map of span extensions.
|
||||
mod extensions;
|
||||
#[cfg(feature = "registry")]
|
||||
mod sharded;
|
||||
#[cfg(feature = "registry")]
|
||||
mod stack;
|
||||
|
||||
pub use extensions::{Extensions, ExtensionsMut};
|
||||
pub use sharded::{Data, Registry};
|
||||
#[cfg(feature = "registry")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
|
||||
pub use sharded::Data;
|
||||
#[cfg(feature = "registry")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
|
||||
pub use sharded::Registry;
|
||||
|
||||
/// Provides access to stored span metadata.
|
||||
///
|
||||
|
@ -43,6 +43,8 @@ use tracing_core::{
|
||||
/// [`LookupSpan`]: trait.LookupSpan.html
|
||||
/// [`LookupMetadata`]: trait.LookupMetadata.html
|
||||
/// [extensions]: extensions/index.html
|
||||
#[cfg(feature = "registry")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
|
||||
#[derive(Debug)]
|
||||
pub struct Registry {
|
||||
spans: Slab<DataInner>,
|
||||
@ -58,6 +60,8 @@ pub struct Registry {
|
||||
/// [`Registry`]: struct.Registry.html
|
||||
/// [`Layer`s]: ../trait.Layer.html
|
||||
/// [extensions]: extensions/index.html
|
||||
#[cfg(feature = "registry")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "registry")))]
|
||||
#[derive(Debug)]
|
||||
pub struct Data<'a> {
|
||||
inner: Guard<'a, DataInner>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user