feat: add observability api foundation

This commit is contained in:
a.tolmachev
2026-03-30 00:00:13 +03:00
parent 0a1680f24e
commit be9ee95cbe
21 changed files with 1535 additions and 94 deletions
+25 -2
View File
@@ -57,7 +57,8 @@ mod tests {
};
use crank_mapping::{MappingRule, MappingSet};
use crank_registry::{
CreateAgentRequest, PostgresRegistry, PublishAgentRequest, PublishRequest,
CreateAgentRequest, ListInvocationLogsQuery, PostgresRegistry, PublishAgentRequest,
PublishRequest,
};
use crank_schema::{Schema, SchemaKind};
use serde_json::{Value, json};
@@ -97,7 +98,7 @@ mod tests {
publish_agent_for_operation(&registry, &operation, "sales-rest").await;
let base_url = spawn_mcp_server(build_app(
registry,
registry.clone(),
Duration::from_millis(0),
Some("https://crank.example.com".to_owned()),
))
@@ -142,6 +143,28 @@ mod tests {
json!({ "id": "lead_123" })
);
assert_eq!(call_result["result"]["isError"], false);
let logs = registry
.list_invocation_logs(ListInvocationLogsQuery {
workspace_id: &test_workspace_id(),
level: None,
search_text: None,
source: Some(crank_core::InvocationSource::AgentToolCall),
operation_id: Some(&operation.id),
agent_id: None,
created_after: None,
limit: 10,
})
.await
.unwrap();
assert_eq!(logs.len(), 1);
assert_eq!(
logs[0].log.source,
crank_core::InvocationSource::AgentToolCall
);
assert_eq!(logs[0].log.status, crank_core::InvocationStatus::Ok);
assert_eq!(logs[0].log.tool_name, "crm_create_lead");
}
#[tokio::test]