Skip to content

Commit 94abc01

Browse files
pzhan9meta-codesync[bot]
authored andcommitted
Change DISABLE_SQLITE_TRACING to ENABLE_SQLITE_TRACING (#1907)
Summary: Pull Request resolved: #1907 The current setup is a little confusing on whether the sqlite layer is on or not. This diff makes it more explicit. Reviewed By: mariusae Differential Revision: D87234372 fbshipit-source-id: 1fa0d79d2e4e506257d1f55175407170397af1ee
1 parent a25c3ed commit 94abc01

File tree

1 file changed

+12
-9
lines changed
  • hyperactor_telemetry/src

1 file changed

+12
-9
lines changed

hyperactor_telemetry/src/lib.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pub const DISABLE_OTEL_METRICS: &str = "DISABLE_OTEL_METRICS";
2626
/// Set to "1" to disable the recorder output.
2727
pub const DISABLE_RECORDER_TRACING: &str = "DISABLE_RECORDER_TRACING";
2828

29-
/// Environment variable to disable the sqlite logging layer.
30-
/// Set to "1" to disable the sqlite tracing.
31-
pub const DISABLE_SQLITE_TRACING: &str = "DISABLE_SQLITE_TRACING";
29+
/// Environment variable to enable the sqlite logging layer.
30+
/// Set to "1" to enable the sqlite tracing.
31+
pub const ENABLE_SQLITE_TRACING: &str = "ENABLE_SQLITE_TRACING";
3232

3333
/// Environment variable constants
3434
// Log level (debug, info, warn, error, critical) to capture for Monarch traces on dedicated log file (changes based on environment, see `log_file_path`).
@@ -39,7 +39,6 @@ pub const MAST_HPC_JOB_NAME_ENV: &str = "MAST_HPC_JOB_NAME";
3939
// Log level constants
4040
const LOG_LEVEL_INFO: &str = "info";
4141
const LOG_LEVEL_DEBUG: &str = "debug";
42-
const LOG_LEVEL_ERROR: &str = "error";
4342

4443
// Span field constants
4544
const SPAN_FIELD_RECORDING: &str = "recording";
@@ -64,7 +63,6 @@ mod spool;
6463
pub mod sqlite;
6564
pub mod task;
6665
pub mod trace;
67-
use std::io::IsTerminal;
6866
use std::io::Write;
6967
use std::str::FromStr;
7068
use std::sync::Arc;
@@ -606,21 +604,26 @@ pub fn initialize_logging_with_log_prefix(
606604
{
607605
use crate::env::Env;
608606
fn is_layer_enabled(env_var: &str) -> bool {
609-
std::env::var(env_var).unwrap_or_default() != "1"
607+
std::env::var(env_var).unwrap_or_default() == "1"
608+
}
609+
fn is_layer_disabled(env_var: &str) -> bool {
610+
std::env::var(env_var).unwrap_or_default() == "1"
610611
}
611612
if let Err(err) = Registry::default()
612-
.with(if is_layer_enabled(DISABLE_SQLITE_TRACING) {
613+
.with(if is_layer_enabled(ENABLE_SQLITE_TRACING) {
614+
// TODO: get_reloadable_sqlite_layer currently still returns None,
615+
// and some additional work is required to make it work.
613616
Some(get_reloadable_sqlite_layer().expect("failed to create sqlite layer"))
614617
} else {
615618
None
616619
})
617-
.with(if is_layer_enabled(DISABLE_OTEL_TRACING) {
620+
.with(if !is_layer_disabled(DISABLE_OTEL_TRACING) {
618621
Some(otel::tracing_layer())
619622
} else {
620623
None
621624
})
622625
.with(file_layer)
623-
.with(if is_layer_enabled(DISABLE_RECORDER_TRACING) {
626+
.with(if !is_layer_disabled(DISABLE_RECORDER_TRACING) {
624627
Some(recorder().layer())
625628
} else {
626629
None

0 commit comments

Comments
 (0)