Conversation
This will prevent charts and logs showing the different data. Previously, logs and charts were using different intervals for the default fetch. Reason was to show more data on the chart, but that gives the wrong impression to users.
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
📝 WalkthroughWalkthroughThe changes update the way the start time for fetching timeseries data is calculated across several hooks in the dashboard application. Specifically, the constant used for defining the historical data window is switched from Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🧰 Additional context used🧬 Code Graph Analysis (1)apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/table/hooks/use-logs-query.test.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms (6)
🔇 Additional comments (3)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/line-chart/hooks/use-fetch-timeseries.ts (1)
2-2: Validate and centralize the window constant source.You’ve swapped in
HISTORICAL_DATA_WINDOWfrom@/components/logs/constants, which couples this hook to the logs module. Since this same constant is now used across multiple chart hooks (APIs, logs, ratelimits), consider moving it to a shared dashboard constants file (e.g.@/components/dashboard/constants.ts) to improve cohesion and reduce cross-folder dependencies.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts(2 hunks)apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/line-chart/hooks/use-fetch-timeseries.ts(2 hunks)apps/dashboard/app/(app)/logs/components/charts/hooks/use-fetch-timeseries.ts(2 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts(2 hunks)apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/charts/hooks/use-fetch-timeseries.ts(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (5)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts (1)
apps/dashboard/components/logs/constants.ts (1)
HISTORICAL_DATA_WINDOW(2-2)
apps/dashboard/app/(app)/logs/components/charts/hooks/use-fetch-timeseries.ts (1)
apps/dashboard/components/logs/constants.ts (1)
HISTORICAL_DATA_WINDOW(2-2)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/line-chart/hooks/use-fetch-timeseries.ts (1)
apps/dashboard/components/logs/constants.ts (1)
HISTORICAL_DATA_WINDOW(2-2)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts (1)
apps/dashboard/components/logs/constants.ts (1)
HISTORICAL_DATA_WINDOW(2-2)
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/charts/hooks/use-fetch-timeseries.ts (1)
apps/dashboard/components/logs/constants.ts (1)
HISTORICAL_DATA_WINDOW(2-2)
⏰ Context from checks skipped due to timeout of 90000ms (8)
- GitHub Check: Test Packages / Test ./packages/cache
- GitHub Check: Test Packages / Test ./packages/hono
- GitHub Check: Test Packages / Test ./packages/api
- GitHub Check: Test Packages / Test ./internal/clickhouse
- GitHub Check: Test Packages / Test ./packages/rbac
- GitHub Check: Test Packages / Test ./internal/encryption
- GitHub Check: autofix
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
apps/dashboard/app/(app)/apis/[apiId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts (1)
2-2: Appropriate change to standardize data window constantsThe switch from
TIMESERIES_DATA_WINDOWtoHISTORICAL_DATA_WINDOWaligns the time window used for chart data with the logs data window, which will fix the problem where charts and logs showed different data counts. This consistency ensures that users see matching counts across the dashboard.Also applies to: 16-16
apps/dashboard/app/(app)/ratelimits/[namespaceId]/_overview/components/charts/bar-chart/hooks/use-fetch-timeseries.ts (1)
2-2: Consistent update of time window constantChanging to
HISTORICAL_DATA_WINDOW(which equals 12 hours in milliseconds) standardizes the time window used for fetching data across all dashboard components, resolving the data count mismatch issue described in the PR.Also applies to: 16-16
apps/dashboard/app/(app)/ratelimits/[namespaceId]/logs/components/charts/hooks/use-fetch-timeseries.ts (1)
2-2: Good synchronization with other componentsThis change properly aligns the rate limits log charts with the same historical window used across the dashboard, ensuring consistent data presentation between charts and logs.
Also applies to: 16-16
apps/dashboard/app/(app)/logs/components/charts/hooks/use-fetch-timeseries.ts (1)
2-2: Completes the standardization across componentsThis update to the logs component completes the consistent application of the
HISTORICAL_DATA_WINDOWconstant across all dashboard views. The change ensures all components use the same 12-hour window, fixing the discrepancy between displayed chart and log counts.Also applies to: 15-15
.../app/(app)/apis/[apiId]/_overview/components/charts/line-chart/hooks/use-fetch-timeseries.ts
Show resolved
Hide resolved
chronark
left a comment
There was a problem hiding this comment.
oh lol, that was surprisingly simple
|
:ez_pepe: |
|
that was the reason for seeing different reason on ratelimit chart and logs |
|
I thought it would be better to fetch longer intervals for charts so they look full. never again 😄 |
What does this PR do?
This will prevent charts and logs showing the different data. Previously, logs and charts were using different intervals for the default fetch. Reason was to show more data on the chart, but that gives the wrong impression to users.
Fixes # (issue)
Chart and log counts will add up.
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
BEFORE
AFTER
Active keys counts are already showing min-max for selected interval. It shouldn't be
0-5.Summary by CodeRabbit