Skip to main content

systemprompt_analytics/models/cli/
tool.rs

1use chrono::{DateTime, Utc};
2use serde::{Deserialize, Serialize};
3use sqlx::FromRow;
4
5#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
6pub struct ToolListRow {
7    pub tool_name: String,
8    pub server_name: String,
9    pub execution_count: i64,
10    pub success_count: i64,
11    pub avg_time: f64,
12    pub last_used: DateTime<Utc>,
13}
14
15#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
16pub struct ToolStatsRow {
17    pub total_tools: i64,
18    pub total_executions: i64,
19    pub successful: i64,
20    pub failed: i64,
21    pub timeout: i64,
22    pub avg_time: f64,
23    pub p95_time: f64,
24}
25
26#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
27pub struct ToolSummaryRow {
28    pub total: i64,
29    pub successful: i64,
30    pub failed: i64,
31    pub timeout: i64,
32    pub avg_time: f64,
33    pub p95_time: f64,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
37pub struct ToolStatusBreakdownRow {
38    pub status: String,
39    pub status_count: i64,
40}
41
42#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
43pub struct ToolErrorRow {
44    pub error_msg: Option<String>,
45    pub error_count: i64,
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
49pub struct ToolAgentUsageRow {
50    pub agent_name: Option<String>,
51    pub usage_count: i64,
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
55pub struct ToolExecutionRow {
56    pub created_at: DateTime<Utc>,
57    pub status: Option<String>,
58    pub execution_time_ms: Option<i32>,
59}