Skip to content

Commit 36010e8

Browse files
committed
docs: Add doc comments for Tracing::pre_configured
1 parent 11d1622 commit 36010e8

File tree

1 file changed

+38
-2
lines changed
  • crates/stackable-telemetry/src/tracing

1 file changed

+38
-2
lines changed

crates/stackable-telemetry/src/tracing/mod.rs

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,43 @@ pub enum Error {
9090
/// }
9191
/// ```
9292
///
93-
/// ## Basic configuration
93+
/// ## Pre-configured Tracing Instance
94+
///
95+
/// There are two different styles to configure a [`Tracing`] instance: Using an opinionated pre-
96+
/// configured instance or a fully customizable builder. The first option should be suited for
97+
/// pretty much all operators by using sane defaults and applying best practices out-of-the-box.
98+
/// [`Tracing::pre_configured`] lists details about environment variables, filter levels and
99+
/// defaults used.
100+
///
101+
/// ```
102+
/// use stackable_telemetry::tracing::{Tracing, TelemetryOptions, Error};
103+
///
104+
/// #[tokio::main]
105+
/// async fn main() -> Result<(), Error> {
106+
/// let options = TelemetryOptions {
107+
/// no_console_output: false,
108+
/// rolling_logs: None,
109+
/// rolling_logs_period: None,
110+
/// otlp_traces: true,
111+
/// otlp_logs: true,
112+
/// }
113+
///
114+
/// let _tracing_guard = Tracing::pre_configured("test", options).init()?;
115+
///
116+
/// tracing::info!("log a message");
117+
///
118+
/// Ok(())
119+
/// }
120+
/// ```
121+
///
122+
/// ## Builders
123+
///
124+
/// When choosing the builder, there are two different styles to configure individual subscribers:
125+
/// Using the sophisticated [`SettingsBuilder`] or the simplified tuple style for basic
126+
/// configuration. Currently, three different subscribers are supported: console output, OTLP log
127+
/// export, and OTLP trace export.
128+
///
129+
/// ### Basic Configuration
94130
///
95131
/// A basic configuration of subscribers can be done by using 2-tuples or 3-tuples, also called
96132
/// doubles and triples. Using tuples, the subscriber can be enabled/disabled and it's environment
@@ -120,7 +156,7 @@ pub enum Error {
120156
/// }
121157
/// ```
122158
///
123-
/// ## Advanced configuration
159+
/// ### Advanced Configuration
124160
///
125161
/// More advanced configurations can be done via the [`Settings::builder`] function. Each
126162
/// subscriber provides specific settings based on a common set of options. These options can be

0 commit comments

Comments
 (0)