@@ -21,12 +21,9 @@ use stackable_operator::{
2121 } ,
2222 logging:: controller:: report_controller_reconciled,
2323 shared:: yaml:: SerializeOptions ,
24- telemetry:: {
25- Tracing ,
26- tracing:: { RollingPeriod , settings:: Settings } ,
27- } ,
24+ telemetry:: Tracing ,
2825} ;
29- use tracing:: { info_span, level_filters :: LevelFilter } ;
26+ use tracing:: info_span;
3027use tracing_futures:: Instrument ;
3128
3229use crate :: crd:: {
@@ -49,9 +46,6 @@ mod built_info {
4946 include ! ( concat!( env!( "OUT_DIR" ) , "/built.rs" ) ) ;
5047}
5148
52- // TODO (@NickLarsenNZ): Change the variable to `CONSOLE_LOG`
53- pub const ENV_VAR_CONSOLE_LOG : & str = "SPARK_K8S_OPERATOR_LOG" ;
54-
5549#[ derive( Parser ) ]
5650#[ clap( about, author) ]
5751struct Opts {
@@ -84,42 +78,12 @@ async fn main() -> anyhow::Result<()> {
8478 telemetry_arguments,
8579 cluster_info_opts,
8680 } ) => {
87- let _tracing_guard = Tracing :: builder ( )
88- . service_name ( "spark-k8s-operator" )
89- . with_console_output ( (
90- ENV_VAR_CONSOLE_LOG ,
91- LevelFilter :: INFO ,
92- !telemetry_arguments. no_console_output ,
93- ) )
94- // NOTE (@NickLarsenNZ): Before stackable-telemetry was used, the log directory was
95- // set via an env: `SPARK_K8S_OPERATOR_LOG_DIRECTORY`.
96- // See: https://github.com/stackabletech/operator-rs/blob/f035997fca85a54238c8de895389cc50b4d421e2/crates/stackable-operator/src/logging/mod.rs#L40
97- // Now it will be `ROLLING_LOGS` (or via `--rolling-logs <DIRECTORY>`).
98- . with_file_output ( telemetry_arguments. rolling_logs . map ( |log_directory| {
99- let rotation_period = telemetry_arguments
100- . rolling_logs_period
101- . unwrap_or ( RollingPeriod :: Never )
102- . clone ( ) ;
103-
104- Settings :: builder ( )
105- . with_environment_variable ( ENV_VAR_CONSOLE_LOG )
106- . with_default_level ( LevelFilter :: INFO )
107- . file_log_settings_builder ( log_directory, "tracing-rs.json" )
108- . with_rotation_period ( rotation_period)
109- . build ( )
110- } ) )
111- . with_otlp_log_exporter ( (
112- "OTLP_LOG" ,
113- LevelFilter :: DEBUG ,
114- telemetry_arguments. otlp_logs ,
115- ) )
116- . with_otlp_trace_exporter ( (
117- "OTLP_TRACE" ,
118- LevelFilter :: DEBUG ,
119- telemetry_arguments. otlp_traces ,
120- ) )
121- . build ( )
122- . init ( ) ?;
81+ // NOTE (@NickLarsenNZ): Before stackable-telemetry was used:
82+ // - The console log level was set by `SPARK_K8S_OPERATOR_LOG`, and is now `CONSOLE_LOG` (when using Tracing::pre_configured).
83+ // - The file log level was set by `SPARK_K8S_OPERATOR_LOG`, and is now set via `FILE_LOG` (when using Tracing::pre_configured).
84+ // - The file log directory was set by `SPARK_K8S_OPERATOR_LOG_DIRECTORY`, and is now set by `ROLLING_LOGS_DIR` (or via `--rolling-logs <DIRECTORY>`).
85+ let _tracing_guard =
86+ Tracing :: pre_configured ( built_info:: PKG_NAME , telemetry_arguments) . init ( ) ?;
12387
12488 tracing:: info!(
12589 built_info. pkg_version = built_info:: PKG_VERSION ,
0 commit comments