Skip to content

Commit 8d5e22d

Browse files
committed
feat!: Use Tracing::pre_configured from stackable-telemetry
BREAKING: The console log level, file log level and directory variables have been changed
1 parent 6fa082e commit 8d5e22d

File tree

4 files changed

+21
-45
lines changed

4 files changed

+21
-45
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ strum = { version = "0.27", features = ["derive"] }
2929
tokio = { version = "1.40", features = ["full"] }
3030
tracing = "0.1"
3131

32-
# [patch."https://github.com/stackabletech/operator-rs"]
33-
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
34-
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
32+
[patch."https://github.com/stackabletech/operator-rs.git"]
33+
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "feat/stackable-telemetry-tracing-default" }
34+
stackable-telemetry = { git = "https://github.com/stackabletech//operator-rs.git", branch = "feat/stackable-telemetry-tracing-default" }

crate-hashes.json

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

rust/operator-binary/src/main.rs

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,8 @@ use stackable_operator::{
2323
},
2424
logging::controller::report_controller_reconciled,
2525
shared::yaml::SerializeOptions,
26-
telemetry::{
27-
Tracing,
28-
tracing::{RollingPeriod, settings::Settings},
29-
},
26+
telemetry::Tracing,
3027
};
31-
use tracing::level_filters::LevelFilter;
3228

3329
use crate::{
3430
crd::{
@@ -85,42 +81,12 @@ async fn main() -> anyhow::Result<()> {
8581
telemetry_arguments,
8682
cluster_info_opts,
8783
}) => {
88-
let _tracing_guard = Tracing::builder()
89-
.service_name("superset-operator")
90-
.with_console_output((
91-
ENV_VAR_CONSOLE_LOG,
92-
LevelFilter::INFO,
93-
!telemetry_arguments.no_console_output,
94-
))
95-
// NOTE (@NickLarsenNZ): Before stackable-telemetry was used, the log directory was
96-
// set via an env: `SUPERSET_OPERATOR_LOG_DIRECTORY`.
97-
// See: https://github.com/stackabletech/operator-rs/blob/f035997fca85a54238c8de895389cc50b4d421e2/crates/stackable-operator/src/logging/mod.rs#L40
98-
// Now it will be `ROLLING_LOGS` (or via `--rolling-logs <DIRECTORY>`).
99-
.with_file_output(telemetry_arguments.rolling_logs.map(|log_directory| {
100-
let rotation_period = telemetry_arguments
101-
.rolling_logs_period
102-
.unwrap_or(RollingPeriod::Never)
103-
.clone();
104-
105-
Settings::builder()
106-
.with_environment_variable(ENV_VAR_CONSOLE_LOG)
107-
.with_default_level(LevelFilter::INFO)
108-
.file_log_settings_builder(log_directory, "tracing-rs.json")
109-
.with_rotation_period(rotation_period)
110-
.build()
111-
}))
112-
.with_otlp_log_exporter((
113-
"OTLP_LOG",
114-
LevelFilter::DEBUG,
115-
telemetry_arguments.otlp_logs,
116-
))
117-
.with_otlp_trace_exporter((
118-
"OTLP_TRACE",
119-
LevelFilter::DEBUG,
120-
telemetry_arguments.otlp_traces,
121-
))
122-
.build()
123-
.init()?;
84+
// NOTE (@NickLarsenNZ): Before stackable-telemetry was used:
85+
// - The console log level was set by `SUPERSET_OPERATOR_LOG`, and is now `CONSOLE_LOG` (when using Tracing::pre_configured).
86+
// - The file log level was set by `SUPERSET_OPERATOR_LOG`, and is now set via `FILE_LOG` (when using Tracing::pre_configured).
87+
// - The file log directory was set by `SUPERSET_OPERATOR_LOG_DIRECTORY`, and is now set by `ROLLING_LOGS_DIR` (or via `--rolling-logs <DIRECTORY>`).
88+
let _tracing_guard =
89+
Tracing::pre_configured(built_info::PKG_NAME, telemetry_arguments).init()?;
12490

12591
tracing::info!(
12692
built_info.pkg_version = built_info::PKG_VERSION,

0 commit comments

Comments
 (0)