Skip to content

Commit d3511c5

Browse files
committed
refactor: Use stackable_telemetry::TelemetryOptions
1 parent 2c4fd20 commit d3511c5

File tree

3 files changed

+4
-46
lines changed

3 files changed

+4
-46
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/stackable-operator/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ repository.workspace = true
1111
time = ["dep:time"]
1212

1313
[dependencies]
14+
stackable-telemetry = { path = "../stackable-telemetry", features = ["clap"]}
1415
stackable-operator-derive = { path = "../stackable-operator-derive" }
1516
stackable-shared = { path = "../stackable-shared" }
1617

crates/stackable-operator/src/cli.rs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,13 @@
108108
//!
109109
use std::{
110110
ffi::OsStr,
111-
ops::Deref,
112111
path::{Path, PathBuf},
113112
};
114113

115114
use clap::Args;
116115
use product_config::ProductConfigManager;
117116
use snafu::{ResultExt, Snafu};
117+
use stackable_telemetry::tracing::TelemetryOptions;
118118

119119
use crate::{namespace::WatchNamespace, utils::cluster_info::KubernetesClusterInfoOpts};
120120

@@ -219,7 +219,7 @@ pub struct ProductOperatorRun {
219219
pub watch_namespace: WatchNamespace,
220220

221221
#[command(flatten)]
222-
pub telemetry_arguments: TelemetryArguments,
222+
pub telemetry_arguments: TelemetryOptions,
223223

224224
#[command(flatten)]
225225
pub cluster_info_opts: KubernetesClusterInfoOpts,
@@ -280,50 +280,6 @@ impl ProductConfigPath {
280280
}
281281
}
282282

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-
327283
#[cfg(test)]
328284
mod tests {
329285
use std::{env, fs::File};

0 commit comments

Comments
 (0)