Skip to content

Commit

Permalink
docs: Convert even more intra-doc links (#1077)
Browse files Browse the repository at this point in the history
## Motivation

#940

## Solution

This changes the docs.rs links, many of which were broken (or would have
been broken on the next release). It also converts some links I missed
the first time (maybe they were added after I opened the PR?).
  • Loading branch information
jyn514 authored Nov 2, 2020
1 parent 879b350 commit a0e1daa
Show file tree
Hide file tree
Showing 33 changed files with 221 additions and 245 deletions.
4 changes: 2 additions & 2 deletions tracing-appender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@
//! [write]: https://doc.rust-lang.org/std/io/trait.Write.html
//! [non_blocking]: mod@non_blocking
//! [guard]: non_blocking::WorkerGuard
//! [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
//! [make_writer]: tracing_subscriber::fmt::MakeWriter
//! [`RollingFileAppender`]: rolling::RollingFileAppender
//! [fmt_subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/struct.Subscriber.html
//! [fmt_subscriber]: tracing_subscriber::fmt::Subscriber
//!
//! ## Non-Blocking Rolling File Appender
//!
Expand Down
4 changes: 2 additions & 2 deletions tracing-appender/src/non_blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ pub struct WorkerGuard {
/// crate. Therefore, it can be used with the [`tracing_subscriber::fmt`][fmt] module
/// or with any other subscriber/layer implementation that uses the `MakeWriter` trait.
///
/// [make_writer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/trait.MakeWriter.html
/// [fmt]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/fmt/index.html
/// [make_writer]: tracing_subscriber::fmt::MakeWriter
/// [fmt]: mod@tracing_subscriber::fmt
#[derive(Clone, Debug)]
pub struct NonBlocking {
error_counter: Arc<AtomicU64>,
Expand Down
2 changes: 1 addition & 1 deletion tracing-core/src/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub trait Collect: 'static {
/// inside of a `try_close` function may cause a double panic, if the span
/// was dropped due to a thread unwinding.
///
/// [span ID]: super::span::Id
/// [`span ID`]: super::span::Id
/// [`clone_span`]: Collect::clone_span
/// [`drop_span`]: Collect::drop_span
fn try_close(&self, id: span::Id) -> bool {
Expand Down
10 changes: 5 additions & 5 deletions tracing-error/src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ use tracing::{Metadata, Span};
///
/// [`tracing`]: https://docs.rs/tracing
/// [`Backtrace`]: https://doc.rust-lang.org/std/backtrace/struct.Backtrace.html
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html
/// [parents]: https://docs.rs/tracing/latest/tracing/span/index.html#span-relationships
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html
/// [span]: mod@tracing::span
/// [parents]: mod@tracing::span#span-relationships
/// [fields]: tracing::field
/// [futures]: https://doc.rust-lang.org/std/future/trait.Future.html
/// [`tracing-futures`]: https://docs.rs/tracing-futures/
/// [`with_spans`]: SpanTrace::with_spans()
Expand Down Expand Up @@ -111,8 +111,8 @@ impl SpanTrace {
/// indicate whether to continue iterating over spans; if it returns
/// `false`, no additional spans will be visited.
///
/// [fields]: https://docs.rs/tracing/latest/tracing/field/index.html
/// [`Metadata`]: https://docs.rs/tracing/latest/tracing/struct.Metadata.html
/// [fields]: tracing::field
/// [`Metadata`]: tracing::Metadata
pub fn with_spans(&self, f: impl FnMut(&'static Metadata<'static>, &str) -> bool) {
self.span.with_collector(|(id, s)| {
if let Some(getcx) = s.downcast_ref::<WithContext>() {
Expand Down
8 changes: 4 additions & 4 deletions tracing-error/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ use tracing_subscriber::{
/// when formatting the fields of each span in a trace. When no formatter is
/// provided, the [default format] is used instead.
///
/// [subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/subscriber/trait.Subscribe.html
/// [subscriber]: tracing_subscriber::subscribe::Subscribe
/// [`SpanTrace`]: super::SpanTrace
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/trait.FormatFields.html
/// [default format]: https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/format/struct.DefaultFields.html
/// [field formatter]: tracing_subscriber::fmt::FormatFields
/// [default format]: tracing_subscriber::fmt::format::DefaultFields
pub struct ErrorSubscriber<S, F = DefaultFields> {
format: F,

Expand Down Expand Up @@ -75,7 +75,7 @@ where
{
/// Returns a new `ErrorSubscriber` with the provided [field formatter].
///
/// [field formatter]: https://docs.rs/tracing-subscriber/0.2.10/tracing_subscriber/fmt/trait.FormatFields.html
/// [field formatter]: tracing_subscriber::fmt::FormatFields
pub fn new(format: F) -> Self {
Self {
format,
Expand Down
8 changes: 4 additions & 4 deletions tracing-error/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@
//! ```
//!
//! [`in_current_span()`]: InstrumentResult::in_current_span
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html
//! [events]: https://docs.rs/tracing/latest/tracing/struct.Event.html
//! [collector]: https://docs.rs/tracing/latest/tracing/trait.Collect.html
//! [subscriber layer]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/layer/trait.Layer.html
//! [span]: mod@tracing::span
//! [events]: tracing::Event
//! [collector]: tracing::Collect
//! [subscriber layer]: tracing_subscriber::subscribe::Subscribe
//! [`tracing`]: https://docs.rs/tracing
//! [`std::error::Error`]: https://doc.rust-lang.org/stable/std/error/trait.Error.html
//!
Expand Down
22 changes: 11 additions & 11 deletions tracing-futures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
//! The `tokio`, `std-future` and `std` features are enabled by default.
//!
//! [`tracing`]: https://crates.io/crates/tracing
//! [span]: https://docs.rs/tracing/latest/tracing/span/index.html
//! [collector]: https://docs.rs/tracing/latest/tracing/collect/index.html
//! [span]: mod@tracing::span
//! [collector]: tracing::collect
//! [`futures`]: https://crates.io/crates/futures
//!
//! ## Supported Rust Versions
Expand Down Expand Up @@ -118,7 +118,7 @@ pub mod executor;
/// Extension trait allowing futures, streams, sinks, and executors to be
/// instrumented with a `tracing` [span].
///
/// [span]: https://docs.rs/tracing/latest/tracing/span/index.html
/// [span]: mod@tracing::span
pub trait Instrument: Sized {
/// Instruments this type with the provided `Span`, returning an
/// `Instrumented` wrapper.
Expand Down Expand Up @@ -147,7 +147,7 @@ pub trait Instrument: Sized {
/// # }
/// ```
///
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter
/// [entered]: tracing::span::Span::enter()
fn instrument(self, span: Span) -> Instrumented<Self> {
Instrumented { inner: self, span }
}
Expand Down Expand Up @@ -182,8 +182,8 @@ pub trait Instrument: Sized {
/// # }
/// ```
///
/// [current]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.current
/// [entered]: https://docs.rs/tracing/latest/tracing/span/struct.Span.html#method.enter
/// [current]: tracing::span::Span::current()
/// [entered]: tracing::span::Span::enter()
#[inline]
fn in_current_span(self) -> Instrumented<Self> {
self.instrument(Span::current())
Expand All @@ -193,7 +193,7 @@ pub trait Instrument: Sized {
/// Extension trait allowing futures, streams, and sinks to be instrumented with
/// a `tracing` [collector].
///
/// [collector]: https://docs.rs/tracing/latest/tracing/collect/trait.Collect.html
/// [collector]: tracing::collect::Collect
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
pub trait WithCollector: Sized {
Expand All @@ -205,8 +205,8 @@ pub trait WithCollector: Sized {
/// When the wrapped type is an executor, the subscriber will be set as the
/// default for any futures spawned on that executor.
///
/// [collector]: https://docs.rs/tracing/latest/tracing/collect/trait.Collect.html
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber
/// [collector]: tracing::collect::Collect
/// [default]: tracing::dispatch#setting-the-default-collector
fn with_collector<S>(self, collector: S) -> WithDispatch<Self>
where
S: Into<Dispatch>,
Expand All @@ -228,8 +228,8 @@ pub trait WithCollector: Sized {
/// This can be used to propagate the current dispatcher context when
/// spawning a new future.
///
/// [collector]: https://docs.rs/tracing/latest/tracing/collect/trait.Collect.html
/// [default]: https://docs.rs/tracing/latest/tracing/dispatcher/index.html#setting-the-default-subscriber
/// [collector]: tracing::collect::Collect
/// [default]: tracing::dispatch#setting-the-default-collector
#[inline]
fn with_current_collector(self) -> WithDispatch<Self> {
WithDispatch {
Expand Down
2 changes: 1 addition & 1 deletion tracing-journald/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!
//! [msrv]: #supported-rust-versions
//! [`tracing`]: https://crates.io/crates/tracing
//! [subscriber]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/subscriber/trait.Subscriber.html
//! [subscriber]: tracing_subscriber::subscribe::Subscribe
//! [journald]: https://www.freedesktop.org/software/systemd/man/systemd-journald.service.html
//!
//! ## Supported Rust Versions
Expand Down
3 changes: 0 additions & 3 deletions tracing-log/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
//! [`tracing`]: https://crates.io/crates/tracing
//! [`log`]: https://crates.io/crates/log
//! [`env_logger` crate]: https://crates.io/crates/env-logger
//! [`log::Log`]: https://docs.rs/log/latest/log/trait.Log.html
//! [`log::Record`]: https://docs.rs/log/latest/log/struct.Record.html
//! [`tracing::Collector`]: https://docs.rs/tracing/latest/tracing/trait.Collect.html
//! [`Collect`]: https://docs.rs/tracing/latest/tracing/trait.Collect.html
//! [`tracing::Event`]: https://docs.rs/tracing/latest/tracing/struct.Event.html
Expand Down Expand Up @@ -376,7 +374,6 @@ impl AsTrace for log::Level {
/// regardless of the source of its source.
///
/// [`normalized_metadata`]: trait.NormalizeEvent.html#normalized_metadata
/// [`log::Record`]: https://docs.rs/log/0.4.7/log/struct.Record.html
pub trait NormalizeEvent<'a>: crate::sealed::Sealed {
/// If this `Event` comes from a `log`, this method provides a new
/// normalized `Metadata` which has all available attributes
Expand Down
2 changes: 1 addition & 1 deletion tracing-log/src/log_tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! default.
//!
//! [`log`]: https://docs.rs/log/0.4.8/log/
//! [logger interface]: https://docs.rs/log/0.4.8/log/trait.Log.html
//! [logger interface]: log::Log
//! [`init`]: LogTracer.html#method.init
//! [`init_with_filter`]: LogTracer.html#method.init_with_filter
//! [builder]: LogTracer::builder()
Expand Down
48 changes: 24 additions & 24 deletions tracing-opentelemetry/src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct SpanEventVisitor<'a>(&'a mut api::Event);
impl<'a> field::Visit for SpanEventVisitor<'a> {
/// Record events on the underlying OpenTelemetry [`Span`] from `bool` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_bool(&mut self, field: &field::Field, value: bool) {
match field.name() {
"message" => self.0.name = value.to_string(),
Expand All @@ -120,7 +120,7 @@ impl<'a> field::Visit for SpanEventVisitor<'a> {

/// Record events on the underlying OpenTelemetry [`Span`] from `i64` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_i64(&mut self, field: &field::Field, value: i64) {
match field.name() {
"message" => self.0.name = value.to_string(),
Expand All @@ -135,7 +135,7 @@ impl<'a> field::Visit for SpanEventVisitor<'a> {

/// Record events on the underlying OpenTelemetry [`Span`] from `u64` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_u64(&mut self, field: &field::Field, value: u64) {
match field.name() {
"message" => self.0.name = value.to_string(),
Expand All @@ -150,7 +150,7 @@ impl<'a> field::Visit for SpanEventVisitor<'a> {

/// Record events on the underlying OpenTelemetry [`Span`] from `&str` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_str(&mut self, field: &field::Field, value: &str) {
match field.name() {
"message" => self.0.name = value.to_string(),
Expand All @@ -166,7 +166,7 @@ impl<'a> field::Visit for SpanEventVisitor<'a> {
/// Record events on the underlying OpenTelemetry [`Span`] from values that
/// implement Debug.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_debug(&mut self, field: &field::Field, value: &dyn fmt::Debug) {
match field.name() {
"message" => self.0.name = format!("{:?}", value),
Expand All @@ -187,7 +187,7 @@ struct SpanAttributeVisitor<'a>(&'a mut api::SpanBuilder);
impl<'a> field::Visit for SpanAttributeVisitor<'a> {
/// Set attributes on the underlying OpenTelemetry [`Span`] from `bool` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_bool(&mut self, field: &field::Field, value: bool) {
let attribute = api::KeyValue::new(field.name(), value);
if let Some(attributes) = &mut self.0.attributes {
Expand All @@ -199,7 +199,7 @@ impl<'a> field::Visit for SpanAttributeVisitor<'a> {

/// Set attributes on the underlying OpenTelemetry [`Span`] from `i64` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_i64(&mut self, field: &field::Field, value: i64) {
let attribute = api::KeyValue::new(field.name(), value);
if let Some(attributes) = &mut self.0.attributes {
Expand All @@ -211,7 +211,7 @@ impl<'a> field::Visit for SpanAttributeVisitor<'a> {

/// Set attributes on the underlying OpenTelemetry [`Span`] from `u64` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_u64(&mut self, field: &field::Field, value: u64) {
let attribute = api::KeyValue::new(field.name(), value);
if let Some(attributes) = &mut self.0.attributes {
Expand All @@ -223,7 +223,7 @@ impl<'a> field::Visit for SpanAttributeVisitor<'a> {

/// Set attributes on the underlying OpenTelemetry [`Span`] from `&str` values.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_str(&mut self, field: &field::Field, value: &str) {
if field.name() == SPAN_NAME_FIELD {
self.0.name = value.to_string();
Expand All @@ -242,7 +242,7 @@ impl<'a> field::Visit for SpanAttributeVisitor<'a> {
/// Set attributes on the underlying OpenTelemetry [`Span`] from values that
/// implement Debug.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn record_debug(&mut self, field: &field::Field, value: &dyn fmt::Debug) {
if field.name() == SPAN_NAME_FIELD {
self.0.name = format!("{:?}", value);
Expand All @@ -267,8 +267,8 @@ where
/// Set the [`Tracer`] that this layer will use to produce and track
/// OpenTelemetry [`Span`]s.
///
/// [`Tracer`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/tracer/trait.Tracer.html
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Tracer`]: opentelemetry::api::trace::tracer::Tracer
/// [`Span`]: opentelemetry::api::trace::span::Span
///
/// # Examples
///
Expand Down Expand Up @@ -318,8 +318,8 @@ where
/// Set the [`Tracer`] that this layer will use to produce and track
/// OpenTelemetry [`Span`]s.
///
/// [`Tracer`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/tracer/trait.Tracer.html
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Tracer`]: opentelemetry::api::trace::tracer::Tracer
/// [`Span`]: opentelemetry::api::trace::span::Span
///
/// # Examples
///
Expand Down Expand Up @@ -373,9 +373,9 @@ where
/// tracing [`span`] through the [`Registry`]. This [`SpanContext`]
/// links spans to their parent for proper hierarchical visualization.
///
/// [`SpanContext`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span_context/struct.SpanContext.html
/// [`span`]: https://docs.rs/tracing/latest/tracing/struct.Span.html
/// [`Registry`]: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.Registry.html
/// [`SpanContext`]: opentelemetry::api::trace::span_context::SpanContext
/// [`span`]: tracing::Span
/// [`Registry`]: tracing_subscriber::Registry
fn parent_span_context(
&self,
attrs: &Attributes<'_>,
Expand Down Expand Up @@ -431,8 +431,8 @@ where
{
/// Creates an [OpenTelemetry `Span`] for the corresponding [tracing `Span`].
///
/// [OpenTelemetry `Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [tracing `Span`]: https://docs.rs/tracing/latest/tracing/struct.Span.html
/// [OpenTelemetry `Span`]: opentelemetry::api::trace::span::Span
/// [tracing `Span`]: tracing::Span
fn new_span(&self, attrs: &Attributes<'_>, id: &span::Id, ctx: Context<'_, S>) {
let span = ctx.span(id).expect("Span not found, this is a bug");
let mut extensions = span.extensions_mut();
Expand Down Expand Up @@ -463,7 +463,7 @@ where

/// Record OpenTelemetry [`attributes`] for the given values.
///
/// [`attributes`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/tracer/struct.SpanBuilder.html#structfield.attributes
/// [`attributes`]: opentelemetry::api::trace::tracer::SpanBuilder::attributes
fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>) {
let span = ctx.span(id).expect("Span not found, this is a bug");
let mut extensions = span.extensions_mut();
Expand Down Expand Up @@ -501,9 +501,9 @@ where
/// Note: an [`ERROR`]-level event will also set the OpenTelemetry span status code to
/// [`Unknown`], signaling that an error has occurred.
///
/// [`Event`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/event/struct.Event.html
/// [`ERROR`]: https://docs.rs/tracing/latest/tracing/struct.Level.html#associatedconstant.ERROR
/// [`Unknown`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/enum.StatusCode.html#variant.Unknown
/// [`Event`]: opentelemetry::api::trace::event::Event
/// [`ERROR`]: tracing::Level::ERROR
/// [`Unknown`]: opentelemetry::api::trace::span::StatusCode::Unknown
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>) {
// Ignore events that are not in the context of a span
if let Some(span) = ctx.lookup_current() {
Expand Down Expand Up @@ -542,7 +542,7 @@ where

/// Exports an OpenTelemetry [`Span`] on close.
///
/// [`Span`]: https://docs.rs/opentelemetry/latest/opentelemetry/api/trace/span/trait.Span.html
/// [`Span`]: opentelemetry::api::trace::span::Span
fn on_close(&self, id: span::Id, ctx: Context<'_, S>) {
let span = ctx.span(&id).expect("Span not found, this is a bug");
let mut extensions = span.extensions_mut();
Expand Down
Loading

0 comments on commit a0e1daa

Please sign in to comment.