Skip to content

♻️ unify endpoint URL building with buildEndpointUrl#4683

Merged
BenoitZugmeyer merged 2 commits into
mainfrom
benoit.zugmeyer/unify-endpoint-url-building
May 28, 2026
Merged

♻️ unify endpoint URL building with buildEndpointUrl#4683
BenoitZugmeyer merged 2 commits into
mainfrom
benoit.zugmeyer/unify-endpoint-url-building

Conversation

@BenoitZugmeyer
Copy link
Copy Markdown
Member

Motivation

Customers using proxy routing should get consistent and predictable intake behavior across Browser SDK features.
This change improves consistency of URL construction so proxy routing, subdomain forwarding, and site-based fallback behave the same way in core ingestion paths, profiling quota checks, and remote configuration fetches.

Changes

  • unify endpoint URL construction through buildEndpointUrl in core configuration logic
  • switch profiling quota endpoint generation to use the shared endpoint URL builder
  • switch remote configuration endpoint generation to use the same shared builder (including sdk-configuration subdomain)
  • extend endpoint URL tests to cover:
    • string and relative proxy URLs
    • subdomain forwarding with proxies
    • proxy function delegation
    • default-site fallback behavior
    • empty-parameters URL behavior
  • add/adjust profiling quota tests to validate normalized proxy URL behavior

Test instructions

  1. Run the sandbox with a proxy path configured (for example proxy: '/proxy' in SDK init).
  2. Open the sandbox in the browser and verify in Network that intake requests go through /proxy and include ddforward.
  3. Verify profiling quota requests include ddforwardSubdomain=quota when proxying is enabled.
  4. Disable proxy and verify requests target the expected Datadog intake host based on site.
  5. Configure remote configuration (with an id) and verify the fetched endpoint uses the sdk-configuration subdomain path.
  6. Validate that requests still succeed when query parameters are empty for endpoints that don’t require them.

Checklist

  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated documentation and/or relevant AGENTS.md file

route endpoint construction through a single helper for core intake, profiling quota, and remote configuration URLs, and expand unit tests to cover proxy normalization, subdomain forwarding, default site fallback, and empty parameters.
@BenoitZugmeyer BenoitZugmeyer changed the base branch from thomas.lebeau/fix-deploy-auto-pipeline to main May 27, 2026 14:00
@cit-pr-commenter-54b7da
Copy link
Copy Markdown

cit-pr-commenter-54b7da Bot commented May 27, 2026

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 173.72 KiB 173.82 KiB +97 B +0.05%
Rum Profiler 8.07 KiB 7.89 KiB -193 B -2.33%
Rum Recorder 21.23 KiB 21.23 KiB 0 B 0.00%
Logs 57.05 KiB 57.12 KiB +80 B +0.14%
Rum Slim 131.41 KiB 131.50 KiB +100 B +0.07%
Worker 22.99 KiB 22.99 KiB 0 B 0.00%

🔗 RealWorld

@datadog-prod-us1-6
Copy link
Copy Markdown

datadog-prod-us1-6 Bot commented May 27, 2026

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 80.00%
Overall Coverage: 76.80% (-0.05%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e2134c3 | Docs | Datadog PR Page | Give us feedback!

@BenoitZugmeyer BenoitZugmeyer marked this pull request as ready for review May 27, 2026 14:25
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner May 27, 2026 14:25
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e1b928fa42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


if (typeof proxy === 'function') {
return (parameters) => proxy({ path, parameters })
return proxy({ path, parameters, subdomain })
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Omit subdomain when delegating normal proxy calls

For function proxies on the normal intake paths, subdomain is now always present on the options object with value undefined; before this refactor the SDK called the proxy with only { path, parameters }. Customers whose proxy function branches on property presence (for example, 'subdomain' in options to distinguish quota/remote-configuration subdomain routing) will now misclassify every regular RUM/logs intake request and may build an undefined... host. Only include the property when a subdomain is actually provided.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's fine.

Comment thread packages/core/src/domain/configuration/endpointBuilder.ts Outdated
@BenoitZugmeyer
Copy link
Copy Markdown
Member Author

/to-staging

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 Bot commented May 27, 2026

View all feedbacks in Devflow UI.

2026-05-27 16:10:22 UTC ℹ️ Start processing command /to-staging


2026-05-27 16:10:28 UTC ℹ️ Branch Integration: starting soon, merge expected in approximately 0s (p90)

Commit e2134c31ca will soon be integrated into staging-22.


2026-05-27 16:27:18 UTC ℹ️ Branch Integration: this commit was successfully integrated

Commit e2134c31ca has been merged into staging-22 in merge commit 4d4e1dcb72.

If you need to revert this integration, you can use the following command: /code revert-integration -b staging-22

gh-worker-dd-mergequeue-cf854d Bot added a commit that referenced this pull request May 27, 2026
…aging-22

Integrated commit sha: e2134c3

Co-authored-by: BenoitZugmeyer <benoit.zugmeyer@datadoghq.com>
@BenoitZugmeyer BenoitZugmeyer merged commit 4025227 into main May 28, 2026
27 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit.zugmeyer/unify-endpoint-url-building branch May 28, 2026 16:27
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants