|
8 | 8 |
|
9 | 9 | use std::path::PathBuf;
|
10 | 10 |
|
| 11 | +#[cfg_attr(feature = "clap", cfg(doc))] |
| 12 | +use clap; |
11 | 13 | use opentelemetry::trace::TracerProvider;
|
12 | 14 | use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge;
|
13 | 15 | use opentelemetry_otlp::{LogExporter, SpanExporter};
|
@@ -117,6 +119,9 @@ pub enum Error {
|
117 | 119 | /// }
|
118 | 120 | /// ```
|
119 | 121 | ///
|
| 122 | +/// Also see the documentation for [`TelemetryOptions`] which details how it can be used as CLI |
| 123 | +/// arguments via [`clap`]. |
| 124 | +/// |
120 | 125 | /// ## Builders
|
121 | 126 | ///
|
122 | 127 | /// When choosing the builder, there are two different styles to configure individual subscribers:
|
@@ -305,8 +310,8 @@ impl Tracing {
|
305 | 310 | /// | ---------------- | ------------------------------------------ | ------------- |
|
306 | 311 | /// | Console logs | [`CONSOLE_LOG`](Self::CONSOLE_LOG_ENV_VAR) | `INFO` |
|
307 | 312 | /// | File logs | [`FILE_LOG`](Self::FILE_LOG_ENV_VAR) | `INFO` |
|
308 |
| - /// | OTLP logs | [`OTLP_LOG`](Self::OTLP_LOG_ENV_VAR) | `INFO` | |
309 |
| - /// | OTLP traces | [`OTLP_TRACE`](Self::OTLP_TRACE_ENV_VAR) | `INFO` | |
| 313 | + /// | OTLP logs | [`OTLP_LOG`](Self::OTLP_LOG_ENV_VAR) | `INFO` | |
| 314 | + /// | OTLP traces | [`OTLP_TRACE`](Self::OTLP_TRACE_ENV_VAR) | `INFO` | |
310 | 315 | ///
|
311 | 316 | /// ### Default Values
|
312 | 317 | ///
|
@@ -696,6 +701,25 @@ fn env_filter_builder(env_var: &str, default_directive: impl Into<Directive>) ->
|
696 | 701 | ///
|
697 | 702 | /// Additionally, this struct can be used as operator CLI arguments. This functionality is only
|
698 | 703 | /// available if the feature `clap` is enabled.
|
| 704 | +/// |
| 705 | +#[cfg_attr( |
| 706 | + feature = "clap", |
| 707 | + doc = r#" |
| 708 | +``` |
| 709 | +# use stackable_telemetry::tracing::TelemetryOptions; |
| 710 | +use clap::Parser; |
| 711 | +
|
| 712 | +#[derive(Parser)] |
| 713 | +struct Cli { |
| 714 | + #[arg(short, long)] |
| 715 | + namespace: String, |
| 716 | +
|
| 717 | + #[clap(flatten)] |
| 718 | + telemetry_arguments: TelemetryOptions, |
| 719 | +} |
| 720 | +``` |
| 721 | +"# |
| 722 | +)] |
699 | 723 | #[cfg_attr(feature = "clap", derive(clap::Args, PartialEq, Eq))]
|
700 | 724 | #[derive(Debug, Default)]
|
701 | 725 | pub struct TelemetryOptions {
|
|
0 commit comments