Skip to content

Commit 6baff29

Browse files
authored
fix(config_migrate): logs were disabled (#1792)
* fix(config_migrate): logs were disabled We use a filtering mechanism in which we disabled all logs not coming from `newrelic_agent_control` crate, which excluded `newrelic_config_migrate` the filters used make it tricky to configure logging properly for config_migrate. For example, debug log level cannot be activated, and previously the logs would be emitted depending on if the 'callsite' is inside the AC crate or not. the error handling of `config_migrate` needs to be improved in any case. * test: new default case
1 parent 94d57e6 commit 6baff29

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

agent-control/src/bin/main_config_migrate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tracing::{debug, info, warn};
1515
fn main() -> Result<(), Box<dyn Error>> {
1616
let cli = Cli::load();
1717
let tracing_config = TracingConfig::from_logging_path(cli.log_dir());
18-
let _tracer = try_init_tracing(tracing_config);
18+
let _tracer = try_init_tracing(tracing_config)?;
1919

2020
info!("Starting config conversion tool...");
2121

agent-control/src/instrumentation/config/logs/config.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ use tracing_subscriber::fmt::format::FmtSpan;
1111
use tracing_subscriber::layer::Filter;
1212
use tracing_subscriber::{EnvFilter, Registry};
1313

14-
const LOGGING_ENABLED_CRATES: &[&str] = &["newrelic_agent_control", "opamp_client"];
14+
const LOGGING_ENABLED_CRATES: &[&str] = &[
15+
"newrelic_agent_control",
16+
"opamp_client",
17+
"newrelic_config_migrate",
18+
];
1519

1620
const SPAN_ATTRIBUTES_MAX_LEVEL: &Level = &Level::INFO;
1721

@@ -202,7 +206,7 @@ mod tests {
202206
TestCase {
203207
name: "everything default",
204208
config: Default::default(),
205-
expected: "newrelic_agent_control=info,opamp_client=info,off",
209+
expected: "newrelic_config_migrate=info,newrelic_agent_control=info,opamp_client=info,off",
206210
},
207211
TestCase {
208212
name: "insecure fine grained overrides any logging",
@@ -219,7 +223,7 @@ mod tests {
219223
insecure_fine_grained_level: Some("".into()),
220224
..Default::default()
221225
},
222-
expected: "newrelic_agent_control=info,opamp_client=info,off", // default
226+
expected: "newrelic_config_migrate=info,newrelic_agent_control=info,opamp_client=info,off", // default
223227
},
224228
TestCase {
225229
name: "several specific targets in insecure_fine_grained_level",

0 commit comments

Comments
 (0)