-
Notifications
You must be signed in to change notification settings - Fork 3.2k
improvement(stats): should track mcp and a2a executions like other trigger types #2895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Greptile SummaryThis PR extends the execution tracking system to include MCP (Model Context Protocol) and A2A (Agent-to-Agent) trigger types, bringing them to parity with existing trigger types like manual, API, webhook, schedule, and chat. Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Workflow
participant ExecutionLogger
participant Database
participant AdminAPI
Note over Workflow,Database: MCP/A2A Execution Flow
Workflow->>ExecutionLogger: finalize(costSummary, trigger='mcp'|'a2a')
ExecutionLogger->>ExecutionLogger: Check trigger type in switch
alt trigger is 'mcp'
ExecutionLogger->>Database: UPDATE user_stats SET total_mcp_executions = total_mcp_executions + 1
else trigger is 'a2a'
ExecutionLogger->>Database: UPDATE user_stats SET total_a2a_executions = total_a2a_executions + 1
end
ExecutionLogger->>Database: Update totalCost, totalTokensUsed, currentPeriodCost
Database-->>ExecutionLogger: Stats updated
Note over AdminAPI,Database: Admin Billing Query
AdminAPI->>Database: SELECT * FROM user_stats WHERE userId = ?
Database-->>AdminAPI: Return stats including totalMcpExecutions, totalA2aExecutions
AdminAPI->>AdminAPI: Map to AdminUserBilling response
AdminAPI-->>AdminAPI: Return billing data with MCP/A2A counts
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (2)
-
apps/sim/app/api/v1/admin/types.ts, line 548-552 (link)logic: Missing
totalMcpExecutionsandtotalA2aExecutionsfields that were added to theuser_statstable -
apps/sim/app/api/v1/admin/users/[id]/billing/route.ts, line 95-99 (link)logic: Missing mappings for
totalMcpExecutionsandtotalA2aExecutionsfields
4 files reviewed, 2 comments
Summary
Track MCP and A2A trigger executions like the others.
Type of Change
Testing
Tested manually
Checklist