-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(dashboard): added stats endpoint to compute stats on server side and avoid limit #2823
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 moves dashboard statistics computation from client-side to server-side to eliminate the 10,000 row limit that was preventing accurate metrics for large datasets. Key changes:
Implementation approach: Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client as Dashboard Component
participant Hook as useDashboardStats Hook
participant API as /api/logs/stats
participant DB as Database
Client->>Hook: Request dashboard data with filters
Hook->>API: GET /api/logs/stats?workspaceId=...&filters...
API->>API: Validate session & permissions
API->>DB: Query time bounds (MIN/MAX startedAt)
DB-->>API: Return bounds
API->>API: Calculate segment size (totalMs / segmentCount)
API->>DB: Aggregate query with GROUP BY workflow + segment
Note over DB: SQL computes COUNT, AVG(duration)<br/>per workflow per time segment
DB-->>API: Return aggregated rows
API->>API: Merge overlapping segments<br/>(when DB rows map to same segment index)
API->>API: Fill missing segments with zeros
API->>API: Compute aggregate stats across workflows
API-->>Hook: Return DashboardStatsResponse
Hook-->>Client: Provide stats data
Client->>Client: Transform WorkflowStats to WorkflowExecution
Client->>Client: Render charts with pre-computed data
|
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.
2 files reviewed, 1 comment
Summary
Type of Change
Testing
Tested manually
Checklist