20260728 修复Explorer Reject reasons统计语义:reason_counts仅统计error对象detail(#133)
This commit is contained in:
parent
7d5454a729
commit
0d6bbec9f3
@ -613,15 +613,15 @@ impl<'de> Deserialize<'de> for ObjectStatsSeq {
|
|||||||
stats.count += 1;
|
stats.count += 1;
|
||||||
if object.result == "error" {
|
if object.result == "error" {
|
||||||
stats.rejected += 1;
|
stats.rejected += 1;
|
||||||
|
if let Some(detail) = object.detail.filter(|value| !value.is_empty()) {
|
||||||
|
bump_limited_count(&mut stats.reason_counts, &detail, 512);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*stats
|
*stats
|
||||||
.object_type_counts
|
.object_type_counts
|
||||||
.entry(object.object_type)
|
.entry(object.object_type)
|
||||||
.or_default() += 1;
|
.or_default() += 1;
|
||||||
*stats.result_counts.entry(object.result).or_default() += 1;
|
*stats.result_counts.entry(object.result).or_default() += 1;
|
||||||
if let Some(detail) = object.detail.filter(|value| !value.is_empty()) {
|
|
||||||
bump_limited_count(&mut stats.reason_counts, &detail, 512);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(ObjectStatsSeq(stats))
|
Ok(ObjectStatsSeq(stats))
|
||||||
}
|
}
|
||||||
@ -1375,7 +1375,7 @@ mod tests {
|
|||||||
"repo_terminal_state":"fresh",
|
"repo_terminal_state":"fresh",
|
||||||
"warnings":[],
|
"warnings":[],
|
||||||
"objects":[
|
"objects":[
|
||||||
{"rsync_uri":"rsync://repo.example/rpki/m.mft","sha256_hex":"11","kind":"manifest","result":"ok"},
|
{"rsync_uri":"rsync://repo.example/rpki/m.mft","sha256_hex":"11","kind":"manifest","result":"ok","detail":"restored child CA instance from publication-point cache"},
|
||||||
{"rsync_uri":"rsync://repo.example/rpki/a.roa","sha256_hex":"22","kind":"roa","result":"error","detail":"bad roa"}
|
{"rsync_uri":"rsync://repo.example/rpki/a.roa","sha256_hex":"22","kind":"roa","result":"error","detail":"bad roa"}
|
||||||
]
|
]
|
||||||
}],
|
}],
|
||||||
@ -1401,6 +1401,13 @@ mod tests {
|
|||||||
assert_eq!(summary.aspas_count, 1);
|
assert_eq!(summary.aspas_count, 1);
|
||||||
assert_eq!(summary.stats.object_type_counts["roa"], 1);
|
assert_eq!(summary.stats.object_type_counts["roa"], 1);
|
||||||
assert_eq!(summary.stats.reason_counts["bad roa"], 1);
|
assert_eq!(summary.stats.reason_counts["bad roa"], 1);
|
||||||
|
// #133: informational detail on non-error objects must not be counted
|
||||||
|
// as reject reasons.
|
||||||
|
assert_eq!(summary.stats.reason_counts.len(), 1);
|
||||||
|
assert!(!summary
|
||||||
|
.stats
|
||||||
|
.reason_counts
|
||||||
|
.contains_key("restored child CA instance from publication-point cache"));
|
||||||
|
|
||||||
let page =
|
let page =
|
||||||
list_report_objects(&report_path, "run_0001", ObjectScope::All, 1, None).expect("page");
|
list_report_objects(&report_path, "run_0001", ObjectScope::All, 1, None).expect("page");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user