-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(audit): added audit log for billing line items #2500
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 adds comprehensive audit logging for all billing operations by creating a new Key Changes:
Implementation Quality:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant API as API Endpoint
participant Logger as Usage Logger
participant UserStats as User Stats Table
participant UsageLog as Usage Log Table
participant Billing as Billing Service
Note over Client,Billing: Workflow Execution Flow
Client->>API: Execute Workflow
API->>Logger: ExecutionLogger.updateUserStats()
Logger->>UserStats: Update aggregate stats (cost, tokens)
Logger->>Logger: logWorkflowUsageBatch()
Logger->>UsageLog: Batch insert (execution fee + per-model entries)
Logger->>Billing: checkAndBillOverageThreshold()
API-->>Client: Execution complete
Note over Client,Billing: Wand Usage Flow
Client->>API: POST /api/wand
API->>UserStats: Update aggregate wand stats
API->>Logger: logModelUsage(source='wand')
Logger->>UsageLog: Insert single model usage entry
API->>Billing: checkAndBillOverageThreshold()
API-->>Client: Wand response
Note over Client,Billing: Copilot Usage Flow
Client->>API: POST /api/billing/update-cost
API->>UserStats: Update aggregate copilot stats
API->>Logger: logModelUsage(source='copilot')
Logger->>UsageLog: Insert single model usage entry
API->>Billing: checkAndBillOverageThreshold()
API-->>Client: Cost update confirmed
Note over Client,Billing: Query Usage Logs Flow
Client->>API: GET /api/users/me/usage-logs
API->>Logger: getUserUsageLogs()
Logger->>UsageLog: Query with filters (source, workspace, date range)
UsageLog-->>Logger: Paginated logs + summary
Logger-->>API: Usage logs result
API-->>Client: Return logs with pagination
|
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.
8 files reviewed, 1 comment
a3eb8db to
8c2d1bc
Compare
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.
8 files reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist