исправить: закрыть ревью сквозной корреляции
This commit is contained in:
@@ -52,9 +52,7 @@ pub(crate) async fn persist_invocation(
|
||||
|
||||
let history_span = Stage::HistoryWrite.span();
|
||||
let (outcome, db_span) = async {
|
||||
let db_span = Stage::DbQuery
|
||||
.db_span(DbOperation::InvocationHistoryWrite)
|
||||
.expect("database stage");
|
||||
let db_span = DbOperation::InvocationHistoryWrite.span();
|
||||
let outcome = state
|
||||
.registry
|
||||
.create_invocation_log(CreateInvocationLogRequest { log: &log })
|
||||
@@ -82,7 +80,7 @@ pub(crate) async fn persist_invocation(
|
||||
outcome,
|
||||
record.request_id,
|
||||
record.status,
|
||||
"agent_tool_call",
|
||||
InvocationSource::AgentToolCall,
|
||||
);
|
||||
outcome
|
||||
}
|
||||
@@ -91,7 +89,7 @@ pub(super) fn observe_invocation_history_outcome(
|
||||
outcome: InvocationHistoryWriteOutcome,
|
||||
request_id: Option<&str>,
|
||||
status: InvocationStatus,
|
||||
source: &'static str,
|
||||
source: InvocationSource,
|
||||
) {
|
||||
let Some(loss) = outcome.loss() else {
|
||||
return;
|
||||
@@ -102,13 +100,20 @@ pub(super) fn observe_invocation_history_outcome(
|
||||
warn!(
|
||||
name: "mcp.invocation_history.lost",
|
||||
request_id = request_id.unwrap_or_default(),
|
||||
source,
|
||||
source = invocation_source_label(source),
|
||||
invocation_status = invocation_status_label(status),
|
||||
error_category = loss.category.as_str(),
|
||||
"invocation history was not recorded"
|
||||
);
|
||||
}
|
||||
|
||||
fn invocation_source_label(source: InvocationSource) -> &'static str {
|
||||
match source {
|
||||
InvocationSource::AdminTestRun => "admin_test_run",
|
||||
InvocationSource::AgentToolCall => "agent_tool_call",
|
||||
}
|
||||
}
|
||||
|
||||
fn invocation_status_label(status: InvocationStatus) -> &'static str {
|
||||
match status {
|
||||
InvocationStatus::Ok => "ok",
|
||||
|
||||
@@ -75,7 +75,7 @@ fn emits_bounded_history_loss_incident() {
|
||||
}),
|
||||
Some("req_mcp_dc08"),
|
||||
InvocationStatus::Ok,
|
||||
"agent_tool_call",
|
||||
crank_core::InvocationSource::AgentToolCall,
|
||||
);
|
||||
|
||||
let output = writer.output();
|
||||
|
||||
Reference in New Issue
Block a user