Merged
Conversation
Add a new tRPC query that computes data volume analytics for the selected environment and time range: current/previous period aggregates for trend comparison, per-pipeline breakdown, and bucketed time series for charts.
Build the /analytics page with KPI cards (Total In, Total Out, Reduction %), a volume-over-time area chart using Recharts, and a sortable per-pipeline breakdown table with colored reduction bars.
Place Analytics with BarChart3 icon after Alerts in the sidebar navigation.
Document the new Analytics page including KPI cards, volume chart, per-pipeline breakdown table, and time range selector.
Annotate PipelineRow interface and lambda parameters to satisfy strict implicit-any checks.
Replace useMemo with direct computation to avoid preserve-manual-memoization lint errors from the React Compiler.
Contributor
Greptile SummaryThis PR adds a Data Volume Analytics page ( Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Browser as Analytics Page
participant tRPC as tRPC / Next.js
participant MW as withTeamAccess("VIEWER")
participant DB as PostgreSQL (Prisma)
Browser->>tRPC: volumeAnalytics({ environmentId, range })
tRPC->>MW: verify team membership via environmentId
MW-->>tRPC: authorized (or throws FORBIDDEN)
tRPC->>DB: aggregate() — current period _sum
tRPC->>DB: aggregate() — previous period _sum
tRPC->>DB: groupBy(pipelineId) — per-pipeline _sum
tRPC->>DB: findMany(pipelineIds) — fetch names
tRPC->>DB: findMany(take:50000, orderBy:desc) — raw metrics for chart
DB-->>tRPC: rawMetrics (≤50k rows, most-recent first)
Note over tRPC: JS bucketing into time buckets
tRPC-->>Browser: { current, previous, perPipeline, timeSeries }
Browser->>Browser: render KPI cards, AreaChart, sortable table
Last reviewed commit: bd8bddb |
- Inline timeSeries/perPipeline data access to fix React Compiler memoization errors - Replace useMemo with useState for Date.now() to fix impure function call - Remove unused useMemo import - Remove unused componentKey destructuring in detail panel
- Cap raw metrics query to 50k rows to prevent OOM on large 30d windows - Make reduction % color thresholds consistent (>=50% green, >=20% amber) between KPI card and per-pipeline table - Handle 30d range in formatTimeAxis to show date labels instead of time-only labels
Add TB threshold to shared formatBytes utility and remove duplicate formatVolumeBytes function from analytics page, ensuring consistent byte formatting across the application.
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
volumeAnalyticstRPC procedure to the dashboard router that computes current/previous period aggregates, per-pipeline breakdowns, and bucketed time series for data volume/analyticspage with KPI cards (Total In, Total Out, Reduction %), an area chart for volume over time, and a sortable per-pipeline breakdown tabledocs/public/user-guide/dashboard.mdwith Data Volume Analytics documentationTest plan