feat(audit): added audit log for billing line items#2500
Merged
waleedlatif1 merged 4 commits intostagingfrom Dec 20, 2025
Merged
feat(audit): added audit log for billing line items#2500waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1 merged 4 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
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
|
a3eb8db to
8c2d1bc
Compare
Collaborator
Author
|
@greptile |
Collaborator
Author
|
@greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Type of Change
Testing
Tested manually
Checklist