20260526 增加持续soak监控与本地回放工具
This commit is contained in:
@@ -433,6 +433,7 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
}
|
||||
|
||||
let repo_sync_started = std::time::Instant::now();
|
||||
let mut runtime_repo_sync_duration_ms = None;
|
||||
let (repo_sync_ok, repo_sync_err, repo_sync_source, repo_sync_phase): (
|
||||
bool,
|
||||
Option<String>,
|
||||
@@ -444,9 +445,10 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
repo_sync_err,
|
||||
repo_sync_source,
|
||||
repo_sync_phase,
|
||||
repo_sync_duration_ms: _,
|
||||
repo_sync_duration_ms,
|
||||
warnings: repo_warnings,
|
||||
} = runtime.sync_publication_point_repo(ca)?;
|
||||
runtime_repo_sync_duration_ms = Some(repo_sync_duration_ms);
|
||||
warnings.extend(repo_warnings);
|
||||
(
|
||||
repo_sync_ok,
|
||||
@@ -575,7 +577,11 @@ impl<'a> PublicationPointRunner for Rpkiv1PublicationPointRunner<'a> {
|
||||
}
|
||||
}
|
||||
};
|
||||
let repo_sync_duration_ms = repo_sync_started.elapsed().as_millis() as u64;
|
||||
let repo_sync_duration_ms = effective_repo_sync_duration_ms(
|
||||
repo_sync_started.elapsed().as_millis() as u64,
|
||||
runtime_repo_sync_duration_ms,
|
||||
repo_sync_ok,
|
||||
);
|
||||
crate::progress_log::emit(
|
||||
"publication_point_repo_sync_done",
|
||||
serde_json::json!({
|
||||
@@ -1640,6 +1646,19 @@ fn repo_sync_source_label(source: crate::sync::repo::RepoSyncSource) -> &'static
|
||||
}
|
||||
}
|
||||
|
||||
fn effective_repo_sync_duration_ms(
|
||||
elapsed_ms: u64,
|
||||
runtime_reported_duration_ms: Option<u64>,
|
||||
repo_sync_ok: bool,
|
||||
) -> u64 {
|
||||
if repo_sync_ok {
|
||||
return elapsed_ms;
|
||||
}
|
||||
runtime_reported_duration_ms
|
||||
.map(|runtime_ms| elapsed_ms.max(runtime_ms))
|
||||
.unwrap_or(elapsed_ms)
|
||||
}
|
||||
|
||||
fn kind_from_vcir_artifact_kind(kind: VcirArtifactKind) -> AuditObjectKind {
|
||||
match kind {
|
||||
VcirArtifactKind::Mft => AuditObjectKind::Manifest,
|
||||
@@ -6463,6 +6482,15 @@ authorityKeyIdentifier = keyid:always
|
||||
assert!(audit.objects.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn effective_repo_sync_duration_uses_runtime_duration_for_failures() {
|
||||
assert_eq!(effective_repo_sync_duration_ms(0, Some(12), false), 12);
|
||||
assert_eq!(effective_repo_sync_duration_ms(5, Some(12), false), 12);
|
||||
assert_eq!(effective_repo_sync_duration_ms(20, Some(12), false), 20);
|
||||
assert_eq!(effective_repo_sync_duration_ms(5, None, false), 5);
|
||||
assert_eq!(effective_repo_sync_duration_ms(5, Some(12), true), 5);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reconstruct_snapshot_from_vcir_reports_missing_manifest_and_related_raw_bytes() {
|
||||
let now = time::OffsetDateTime::now_utc();
|
||||
|
||||
Reference in New Issue
Block a user