chore: configure Vercel Speed Insights for docs project#2536
chore: configure Vercel Speed Insights for docs project#2536
Conversation
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Speed Insights injection mechanism in the client module has been updated to utilize custom configuration parameters. Instead of relying on default values, the injection now explicitly specifies a custom Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 53 minutes and 49 seconds.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/clientModules/speedInsights.tsx (1)
5-8: Reduce drift risk by extracting the shared base URL.Line 5 and Line 7 duplicate the same host/path prefix. Consider centralizing it so future host changes don’t update one URL but miss the other.
Refactor suggestion
if (typeof window !== "undefined") { + const speedInsightsBaseUrl = + "https://docs-omega-six.vercel.app/_vercel/speed-insights" + injectSpeedInsights({ - scriptSrc: - "https://docs-omega-six.vercel.app/_vercel/speed-insights/script.js", - endpoint: - "https://docs-omega-six.vercel.app/_vercel/speed-insights/vitals", + scriptSrc: `${speedInsightsBaseUrl}/script.js`, + endpoint: `${speedInsightsBaseUrl}/vitals`, }) }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/clientModules/speedInsights.tsx` around lines 5 - 8, Duplicate host/path prefix used in the scriptSrc and endpoint values should be extracted into a single shared constant (e.g., baseSpeedInsightsUrl) and then referenced when building scriptSrc and endpoint (for example via string concatenation or template literals) so updates to the host/path only need to be made in one place; update the declarations that set scriptSrc and endpoint to use that new base constant and ensure names like scriptSrc and endpoint remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/clientModules/speedInsights.tsx`:
- Around line 5-8: Duplicate host/path prefix used in the scriptSrc and endpoint
values should be extracted into a single shared constant (e.g.,
baseSpeedInsightsUrl) and then referenced when building scriptSrc and endpoint
(for example via string concatenation or template literals) so updates to the
host/path only need to be made in one place; update the declarations that set
scriptSrc and endpoint to use that new base constant and ensure names like
scriptSrc and endpoint remain unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 9924aba6-f59e-4a5b-8613-4f7b4b6b7c86
📒 Files selected for processing (1)
src/clientModules/speedInsights.tsx
There was a problem hiding this comment.
Pull request overview
This PR fixes Vercel Speed Insights attribution for the Docusaurus docs site so metrics for /docs/* land in the intended Vercel docs project rather than the www.ory.com project.
Changes:
- Configures
injectSpeedInsights()to use explicitscriptSrcandendpointURLs pointing at the docs project’s Vercel alias.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Speed Insights metrics for
/docs/*were landing in the www.ory.com Vercel project instead of the docs project.fix
Pass
scriptSrcandendpointtoinjectSpeedInsights()insrc/clientModules/speedInsights.tsx, pointing both at the docs project's Vercel aliasRelated Issue or Design Document
Checklist
If this pull request addresses a security vulnerability,
I confirm that I got approval (please contact security@ory.com) from the maintainers to push the changes.
Further comments
Summary by CodeRabbit