108108//!
109109use std:: {
110110 ffi:: OsStr ,
111- ops:: Deref ,
112111 path:: { Path , PathBuf } ,
113112} ;
114113
115114use clap:: Args ;
116115use product_config:: ProductConfigManager ;
117116use snafu:: { ResultExt , Snafu } ;
117+ use stackable_telemetry:: tracing:: TelemetryOptions ;
118118
119119use crate :: { namespace:: WatchNamespace , utils:: cluster_info:: KubernetesClusterInfoOpts } ;
120120
@@ -165,10 +165,8 @@ pub enum Command<Run: Args = ProductOperatorRun> {
165165/// ```rust
166166/// # use stackable_operator::cli::{Command, ProductOperatorRun, ProductConfigPath};
167167/// use clap::Parser;
168- /// use stackable_operator::{
169- /// cli::TelemetryArguments,
170- /// namespace::WatchNamespace,
171- /// };
168+ /// use stackable_operator::namespace::WatchNamespace;
169+ /// use stackable_telemetry::tracing::TelemetryOptions;
172170///
173171/// #[derive(clap::Parser, Debug, PartialEq, Eq)]
174172/// struct Run {
@@ -184,7 +182,7 @@ pub enum Command<Run: Args = ProductOperatorRun> {
184182/// common: ProductOperatorRun {
185183/// product_config: ProductConfigPath::from("bar".as_ref()),
186184/// watch_namespace: WatchNamespace::One("foobar".to_string()),
187- /// telemetry_arguments: TelemetryArguments ::default(),
185+ /// telemetry_arguments: TelemetryOptions ::default(),
188186/// cluster_info_opts: Default::default(),
189187/// },
190188/// }));
@@ -219,7 +217,7 @@ pub struct ProductOperatorRun {
219217 pub watch_namespace : WatchNamespace ,
220218
221219 #[ command( flatten) ]
222- pub telemetry_arguments : TelemetryArguments ,
220+ pub telemetry_arguments : TelemetryOptions ,
223221
224222 #[ command( flatten) ]
225223 pub cluster_info_opts : KubernetesClusterInfoOpts ,
@@ -280,50 +278,6 @@ impl ProductConfigPath {
280278 }
281279}
282280
283- #[ derive( Debug , Default , PartialEq , Eq , Args ) ]
284- pub struct TelemetryArguments {
285- /// Disable console output.
286- #[ arg( long, env) ]
287- pub no_console_output : bool ,
288-
289- /// Enable logging to rolling files located in the specified DIRECTORY.
290- #[ arg( long, env, value_name = "DIRECTORY" , group = "rolling_logs_group" ) ]
291- pub rolling_logs : Option < PathBuf > ,
292-
293- /// Time PERIOD after which log files are rolled over.
294- #[ arg( long, env, value_name = "PERIOD" , requires = "rolling_logs_group" ) ]
295- pub rolling_logs_period : Option < RollingPeriod > ,
296-
297- /// Enable exporting traces via OTLP.
298- #[ arg( long, env) ]
299- pub otlp_traces : bool ,
300-
301- /// Enable exporting logs via OTLP.
302- #[ arg( long, env) ]
303- pub otlp_logs : bool ,
304- }
305-
306- #[ derive( Clone , Debug , PartialEq , Eq , strum:: Display , strum:: EnumString , clap:: ValueEnum ) ]
307- pub enum RollingPeriod {
308- Minutely ,
309- Hourly ,
310- Daily ,
311- Never ,
312- }
313-
314- impl Deref for RollingPeriod {
315- type Target = tracing_appender:: rolling:: Rotation ;
316-
317- fn deref ( & self ) -> & Self :: Target {
318- match self {
319- RollingPeriod :: Minutely => & tracing_appender:: rolling:: Rotation :: MINUTELY ,
320- RollingPeriod :: Hourly => & tracing_appender:: rolling:: Rotation :: HOURLY ,
321- RollingPeriod :: Daily => & tracing_appender:: rolling:: Rotation :: DAILY ,
322- RollingPeriod :: Never => & tracing_appender:: rolling:: Rotation :: NEVER ,
323- }
324- }
325- }
326-
327281#[ cfg( test) ]
328282mod tests {
329283 use std:: { env, fs:: File } ;
0 commit comments