Skip to content

Instrument resolve_config_path, env_config_path, collect_diag_file_layers, and error paths with structured tracing spans and events #292

@coderabbitai

Description

@coderabbitai

Observability

Context

PR #285 (#285) adds explicit config path resolution via resolve_config_path, env_config_path, collect_diag_file_layers, and push_file_layers in src/cli/config_merge.rs. None of these operational pathways currently emit structured log or trace events. When a user provides an explicit --config path that fails to load, or when the precedence logic selects an unexpected source, there is no diagnostic signal in the logs to aid debugging.

Required work

Instrument the following functions using the existing tracing dependency:

  1. resolve_config_path – emit a debug event recording which selector was chosen (CLI flag, NETSUKE_CONFIG, NETSUKE_CONFIG_PATH, or None) and the resolved path.
  2. env_config_path – emit a trace event when a variable is read and whether it produced a path.
  3. collect_diag_file_layers – emit a debug span covering the layer collection; include an event when the explicit path is used and when discovery is performed instead.
  4. Error paths – emit a warn event whenever an explicit config load fails, including the path and the error.

Acceptance criteria

  • All four functions have at least one tracing call on each significant branch.
  • No new dependencies are required beyond the existing tracing crate.
  • Structured fields (not format strings) are used for path values and error descriptions where possible.

Raised by

Requested by @leynos as a follow-up to #285.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmediumCould be disruptive, but might not happen

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions