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 ToolExistsRow {
28    pub count: i64,
29}
30
31#[derive(Debug, Clone, Copy, Serialize, Deserialize, FromRow)]
32pub struct ToolSummaryRow {
33    pub total: i64,
34    pub successful: i64,
35    pub failed: i64,
36    pub timeout: i64,
37    pub avg_time: f64,
38    pub p95_time: f64,
39}
40
41#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
42pub struct ToolStatusBreakdownRow {
43    pub status: String,
44    pub status_count: i64,
45}
46
47#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
48pub struct ToolErrorRow {
49    pub error_msg: Option<String>,
50    pub error_count: i64,
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
54pub struct ToolAgentUsageRow {
55    pub agent_name: Option<String>,
56    pub usage_count: i64,
57}
58
59#[derive(Debug, Clone, Serialize, Deserialize, FromRow)]
60pub struct ToolExecutionRow {
61    pub created_at: DateTime<Utc>,
62    pub status: Option<String>,
63    pub execution_time_ms: Option<i32>,
64}