Skip to content

Commit

Permalink
chore: fix inconsistent terminology
Browse files Browse the repository at this point in the history
I noticed a handful of places where `v0.1.x` refers to `Subscriber`s as
 "collectors". This probably happened because we backported some commits
 from master and forgot to change every instance of "collector" back to
 "subscriber".

 This commit fixes that. Whoops.

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
  • Loading branch information
hawkw committed Sep 4, 2021
1 parent 978624e commit ac4a8dd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/examples/fmt-multiple-writers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
.with(EnvFilter::from_default_env().add_directive(tracing::Level::TRACE.into()))
.with(fmt::Layer::new().with_writer(io::stdout))
.with(fmt::Layer::new().with_writer(non_blocking));
tracing::subscriber::set_global_default(subscriber).expect("Unable to set a global collector");
tracing::subscriber::set_global_default(subscriber).expect("Unable to set a global subscriber");

let number_of_yaks = 3;
// this creates a new event, outside of any spans.
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/fmt-pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fn main() {
.with_thread_names(true)
// enable everything
.with_max_level(tracing::Level::TRACE)
// sets this to be the default, global collector for this application.
// sets this to be the default, global subscriber for this application.
.init();

let number_of_yaks = 3;
Expand Down
2 changes: 1 addition & 1 deletion examples/examples/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ fn main() {
tracing_subscriber::fmt()
// enable everything
.with_max_level(tracing::Level::TRACE)
// sets this to be the default, global collector for this application.
// sets this to be the default, global subscriber for this application.
.init();

let number_of_yaks = 3;
Expand Down
6 changes: 3 additions & 3 deletions tracing-opentelemetry/src/span_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ impl OpenTelemetrySpanExt for tracing::Span {
if cx.is_valid() {
let mut cx = Some(cx);
let mut att = Some(attributes);
self.with_subscriber(move |(id, collector)| {
if let Some(get_context) = collector.downcast_ref::<WithContext>() {
get_context.with_context(collector, id, move |builder, _tracer| {
self.with_subscriber(move |(id, subscriber)| {
if let Some(get_context) = subscriber.downcast_ref::<WithContext>() {
get_context.with_context(subscriber, id, move |builder, _tracer| {
if let Some(cx) = cx.take() {
let attr = att.take().unwrap_or_default();
let follows_link = opentelemetry::trace::Link::new(cx, attr);
Expand Down
2 changes: 1 addition & 1 deletion tracing-subscriber/src/filter/env/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ impl EnvFilter {
#[cfg(feature = "ansi_term")]
use ansi_term::{Color, Style};
// NOTE: We can't use a configured `MakeWriter` because the EnvFilter
// has no knowledge of any underlying subscriber or collector, which
// has no knowledge of any underlying subscriber or subscriber, which
// may or may not use a `MakeWriter`.
let warn = |msg: &str| {
#[cfg(not(feature = "ansi_term"))]
Expand Down
12 changes: 6 additions & 6 deletions tracing-subscriber/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//!
//! ## Filtering Events with Environment Variables
//!
//! The default collector installed by `init` enables you to filter events
//! The default subscriber installed by `init` enables you to filter events
//! at runtime using environment variables (using the [`EnvFilter`]).
//!
//! The filter syntax is a superset of the [`env_logger`] syntax.
Expand All @@ -52,7 +52,7 @@
//! You can create one by calling:
//!
//! ```rust
//! let collector = tracing_subscriber::fmt()
//! let subscriber = tracing_subscriber::fmt()
//! // ... add configuration
//! .finish();
//! ```
Expand Down Expand Up @@ -336,7 +336,7 @@ pub struct SubscriberBuilder<
/// .with_target(false)
/// .with_timer(tracing_subscriber::fmt::time::uptime())
/// .with_level(true)
/// // Set the collector as the default.
/// // Set the subscriber as the default.
/// .init();
/// ```
///
Expand All @@ -347,11 +347,11 @@ pub struct SubscriberBuilder<
///
/// fn init_subscriber() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
/// tracing_subscriber::fmt()
/// // Configure the collector to emit logs in JSON format.
/// // Configure the subscriber to emit logs in JSON format.
/// .json()
/// // Configure the collector to flatten event fields in the output JSON objects.
/// // Configure the subscriber to flatten event fields in the output JSON objects.
/// .flatten_event(true)
/// // Set the collector as the default, returning an error if this fails.
/// // Set the subscriber as the default, returning an error if this fails.
/// .try_init()?;
///
/// Ok(())
Expand Down
4 changes: 2 additions & 2 deletions tracing/tests/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ fn move_field_out_of_struct() {
#[cfg_attr(target_arch = "wasm32", wasm_bindgen_test::wasm_bindgen_test)]
#[test]
fn float_values() {
let (collector, handle) = collector::mock()
let (subscriber, handle) = subscriber::mock()
.new_span(
span::mock().named("foo").with_field(
field::mock("x")
Expand All @@ -472,7 +472,7 @@ fn float_values() {
)
.run_with_handle();

with_default(collector, || {
with_default(subscriber, || {
let foo = span!(Level::TRACE, "foo", x = 3.234, y = -1.223);
foo.in_scope(|| {});
});
Expand Down

0 comments on commit ac4a8dd

Please sign in to comment.