feat: harden community production foundation through story 1.5
This commit is contained in:
@@ -15,6 +15,7 @@ use super::AppState;
|
||||
|
||||
pub(crate) struct InvocationRecord<'a> {
|
||||
pub(crate) request_id: Option<&'a str>,
|
||||
pub(crate) trace_id: Option<&'a str>,
|
||||
pub(crate) tool_name: &'a str,
|
||||
pub(crate) status: InvocationStatus,
|
||||
pub(crate) level: InvocationLevel,
|
||||
@@ -42,6 +43,7 @@ pub(crate) async fn persist_invocation(
|
||||
tool_name: record.tool_name.to_owned(),
|
||||
message: record.message.to_owned(),
|
||||
request_id: record.request_id.map(ToOwned::to_owned),
|
||||
trace_id: record.trace_id.map(ToOwned::to_owned),
|
||||
status_code: record.status_code,
|
||||
duration_ms: u64::try_from(record.duration.as_millis()).unwrap_or(u64::MAX),
|
||||
error_kind: record.error_kind.map(ToOwned::to_owned),
|
||||
@@ -79,6 +81,7 @@ pub(crate) async fn persist_invocation(
|
||||
observe_invocation_history_outcome(
|
||||
outcome,
|
||||
record.request_id,
|
||||
record.trace_id,
|
||||
record.status,
|
||||
InvocationSource::AgentToolCall,
|
||||
);
|
||||
@@ -88,6 +91,7 @@ pub(crate) async fn persist_invocation(
|
||||
pub(super) fn observe_invocation_history_outcome(
|
||||
outcome: InvocationHistoryWriteOutcome,
|
||||
request_id: Option<&str>,
|
||||
trace_id: Option<&str>,
|
||||
status: InvocationStatus,
|
||||
source: InvocationSource,
|
||||
) {
|
||||
@@ -100,6 +104,7 @@ pub(super) fn observe_invocation_history_outcome(
|
||||
warn!(
|
||||
name: "mcp.invocation_history.lost",
|
||||
request_id = request_id.unwrap_or_default(),
|
||||
trace_id = trace_id.unwrap_or_default(),
|
||||
source = invocation_source_label(source),
|
||||
invocation_status = invocation_status_label(status),
|
||||
error_category = loss.category.as_str(),
|
||||
|
||||
Reference in New Issue
Block a user