Background
The NETSUKE_NINJA feature (PR #323) improved observability around Ninja subprocess execution. The following have already been implemented in PR #323:
command_span creates a "ninja_subprocess" tracing span with stable low-cardinality fields: operation, ninja_program, redacted_arg_count, suppress_stderr, failure_category = field::Empty
- Spawn and exit failures record
failure_category = "spawn" and failure_category = "exit_status" as structured span fields
log_command_execution, log_command_spawn_failure, log_command_exit_failure emit structured tracing events with operation and ninja_program fields
Remaining required work
Two acceptance criteria from the original description remain unmet:
1. Log NETSUKE_NINJA resolution at the env-var boundary
resolve_ninja_program_utf8_with in src/runner/process/mod.rs silently picks the env-var value or falls back to NINJA_PROGRAM with no trace event. Add a debug! event at that boundary, e.g.:
fn resolve_ninja_program_utf8_with<F>(mut read_env: F) -> Utf8PathBuf
where
F: FnMut(&str) -> Option<OsString>,
{
match read_env(NINJA_ENV).and_then(|value| {
Utf8PathBuf::from_path_buf(PathBuf::from(value)).ok()
}) {
Some(path) => {
tracing::debug!(
ninja_program = %path,
source = "env",
"Resolved Ninja program from {NINJA_ENV}"
);
path
}
None => {
tracing::debug!(
ninja_program = NINJA_PROGRAM,
source = "default",
"NETSUKE_NINJA unset or non-UTF-8; using default Ninja program"
);
Utf8PathBuf::from(NINJA_PROGRAM)
}
}
}
2. Demote high-cardinality args/paths from the log event message
log_command_execution currently emits the full redacted_command string (which includes the build file path and target list) in the message body. Move high-cardinality data to a debug! companion event rather than including it in the info! span event message. The info! event should carry only stable low-cardinality fields; the redacted_command string should be emitted separately at debug! level.
Acceptance criteria
Backlinks
Background
The NETSUKE_NINJA feature (PR #323) improved observability around Ninja subprocess execution. The following have already been implemented in PR #323:
command_spancreates a"ninja_subprocess"tracing span with stable low-cardinality fields:operation,ninja_program,redacted_arg_count,suppress_stderr,failure_category = field::Emptyfailure_category = "spawn"andfailure_category = "exit_status"as structured span fieldslog_command_execution,log_command_spawn_failure,log_command_exit_failureemit structuredtracingevents withoperationandninja_programfieldsRemaining required work
Two acceptance criteria from the original description remain unmet:
1. Log NETSUKE_NINJA resolution at the env-var boundary
resolve_ninja_program_utf8_withinsrc/runner/process/mod.rssilently picks the env-var value or falls back toNINJA_PROGRAMwith no trace event. Add adebug!event at that boundary, e.g.:2. Demote high-cardinality args/paths from the log event message
log_command_executioncurrently emits the fullredacted_commandstring (which includes the build file path and target list) in the message body. Move high-cardinality data to adebug!companion event rather than including it in theinfo!span event message. Theinfo!event should carry only stable low-cardinality fields; theredacted_commandstring should be emitted separately atdebug!level.Acceptance criteria
resolve_ninja_program_utf8_withemits adebug!event at the env-var resolution boundary withninja_programandsourcefieldslog_command_executionno longer includesredacted_commandin itsinfo!message body; that string is emitted atdebug!level insteadmake check-fmt && make lint && make test#[expect(..., reason = "...")]Backlinks