Skip to content

chore: configure Vercel Speed Insights for docs project#2536

Merged
jaygiang merged 2 commits intomasterfrom
chore/add-vercel-speed-insights-docs
Apr 29, 2026
Merged

chore: configure Vercel Speed Insights for docs project#2536
jaygiang merged 2 commits intomasterfrom
chore/add-vercel-speed-insights-docs

Conversation

@jaygiang
Copy link
Copy Markdown
Collaborator

@jaygiang jaygiang commented Apr 29, 2026

Speed Insights metrics for /docs/* were landing in the www.ory.com Vercel project instead of the docs project.

fix

Pass scriptSrc and endpoint to injectSpeedInsights() in src/clientModules/speedInsights.tsx, pointing both at the docs project's Vercel alias

Related Issue or Design Document

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    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.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

Further comments

Summary by CodeRabbit

  • Chores
    • Updated Speed Insights configuration to use custom settings for script injection and data handling.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Warning

Rate limit exceeded

@jaygiang has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 49 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c4e7f20e-0432-4a3f-818d-f892b9e608df

📥 Commits

Reviewing files that changed from the base of the PR and between 111aab1 and ef1305d.

📒 Files selected for processing (1)
  • src/clientModules/speedInsights.tsx
📝 Walkthrough

Walkthrough

The 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 scriptSrc and endpoint for where vitals data is transmitted at runtime when the window object is available.

Changes

Cohort / File(s) Summary
Speed Insights Configuration
src/clientModules/speedInsights.tsx
Updated Speed Insights injection to use custom scriptSrc and endpoint configuration parameters instead of defaults, controlling runtime URLs for script injection and data transmission.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • vinckr
  • zepatrik
  • piotrmsc
  • aeneasr

Poem

🐰 A rabbit hops through config lands,
Where Speed Insights now takes custom stands,
With scriptSrc and endpoint bright,
Vitals dance through the network night!
Configuration whispered with care,
Makes performance monitoring fair! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: configuring Vercel Speed Insights specifically for the docs project, which aligns with the primary objective of fixing metrics routing.
Description check ✅ Passed The description adequately explains the problem, fix, and implementation details. However, no issue reference is provided despite the template expecting one for bug fixes, and most checklist items remain unchecked.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-vercel-speed-insights-docs

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 53 minutes and 49 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 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

📥 Commits

Reviewing files that changed from the base of the PR and between ff73b9a and 111aab1.

📒 Files selected for processing (1)
  • src/clientModules/speedInsights.tsx

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 explicit scriptSrc and endpoint URLs pointing at the docs project’s Vercel alias.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/clientModules/speedInsights.tsx Outdated
@jaygiang jaygiang enabled auto-merge (squash) April 29, 2026 16:51
@jaygiang jaygiang merged commit 74a9329 into master Apr 29, 2026
11 checks passed
@jaygiang jaygiang deleted the chore/add-vercel-speed-insights-docs branch April 29, 2026 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants