Skip to content

fix: remove QM-only Rust logging dependency - #778

Open
umaucher wants to merge 2 commits into
eclipse-score:mainfrom
umaucher:um_rust_logging_without_qm
Open

umaucher wants to merge 2 commits into
eclipse-score:mainfrom
umaucher:um_rust_logging_without_qm

Conversation

@umaucher

Copy link
Copy Markdown
Contributor

Remove the forced QM logging flag. Use path strings (inline or reused), instance/snapshot IDs where feasible, and error messages instead of QM-only path formatting. Keep manual ScoreDebug for JsonBackend.

Validated: Rust unit tests with default logging, consumer smoke test with asil_b, and changed-file copyright/format checks.

Use path strings, instance/snapshot IDs and error messages for diagnostics.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@umaucher
umaucher marked this pull request as ready for review November 26, 2026 08:36
/// Set the working directory used by the JSON backend.
pub fn working_dir(mut self, working_dir: PathBuf) -> Self {
trace!("'working_dir' set to {:?}", working_dir);
trace!("'working_dir' set to {}", working_dir.to_string_lossy().as_ref());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why as_ref is needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to_string_lossy() returns Cow<'_, str>, which doesn’t implement ScoreDebug. Calling as_ref() borrows it as &str, which the logger supports without QM. This adds no allocation or copy

... from my copilot ... let me know if this is "wrong"?

impl ScoreDebug for JsonBackend {
fn fmt(&self, f: score_log::fmt::Writer, spec: &score_log::fmt::FormatSpec) -> score_log::fmt::Result {
score_log::fmt::DebugStruct::new(f, spec, "JsonBackend")
.field("snapshot_max_count", &self.snapshot_max_count)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add working_dir field with a string cast manually rather than remove it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

Comment thread score/kvs/rust_kvs/json_backend.rs Outdated
fn fmt(&self, f: score_log::fmt::Writer, spec: &score_log::fmt::FormatSpec) -> score_log::fmt::Result {
score_log::fmt::DebugStruct::new(f, spec, "JsonBackend")
.field("snapshot_max_count", &self.snapshot_max_count)
.finish_non_exhaustive()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With working_dir shown it's finish().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅

Comment thread score/kvs/rust_kvs/json_backend.rs Outdated
error!("KVS or hash file not found");
error!(
"KVS or hash file not found: instance={}, snapshot={}",
instance_id.0, old_snapshot_id.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InstanceId and SnapshotId implement ScoreDebug, so can be used without .0.
Maybe this would be more consistent with existing error logs: "KVS or hash file not found: {}, {}", instance_id, old_snapshot_id.
Or "KVS or hash file not found for instance ID: {}, snapshot ID: {}", instance_id, old_snapshot_id.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without .0 ✅ ... format I kept since it is consistent with 7 other log messages

Comment thread score/kvs/rust_kvs/json_backend.rs Outdated
tmp_path,
e.to_string()
);
error!("Failed to remove stale temporary file, error: {:?}", e.to_string());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove path of tmp file?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ ... initially thought the path is contained in the error but it is not ... so brought back

Retain diagnostic paths without QM-only formatting and log ID types directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-778: https://eclipse-score.github.io/persistency/pr-778/

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants