fix(browser): enrich graphqlClient spans for relative URLs - #20296
Conversation
Per #20292, graphqlClientIntegration silently skips spans for relative GraphQL endpoints because the fetch instrumentation only sets `url.full` / `http.url` for absolute URLs. For relative URLs it sets the `url` attribute instead. Fall back to `spanAttributes['url']` so relative GraphQL endpoints get enriched the same way as absolute ones. Closes #20292
|
This PR has been automatically closed. The referenced issue does not show a discussion between you and a maintainer. To avoid wasted effort on both sides, please discuss your proposed approach in the issue first and wait for a maintainer to respond before opening a PR. Please review our contributing guidelines for more details. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 87cc443. Configure here.
| const httpUrl = | ||
| spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || | ||
| spanAttributes['http.url'] || | ||
| spanAttributes['url']; |
There was a problem hiding this comment.
Fix PR lacks regression test for relative URLs
Low Severity
This fix PR adds a fallback to spanAttributes['url'] for relative GraphQL endpoints but does not include any unit, integration, or e2e test that verifies the fix. The existing integration tests (in dev-packages/browser-integration-tests/suites/integrations/graphqlClient/) only use absolute URLs like http://sentry-test.io/foo. A regression test exercising a relative endpoint (e.g., /graphql) would confirm the fix works and prevent future regressions. Per the project review rules, fix PRs are expected to include at least one test covering the regression being fixed.
Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 87cc443. Configure here.


Per #20292,
graphqlClientIntegrationsilently skips spans for relative GraphQL endpoints because the fetch instrumentation only setsurl.full/http.urlfor absolute URLs. For relative URLs it sets theurlattribute instead, so the existing chain ingraphqlClient.tsreadsundefinedand bails before enriching the span.Fall back to
spanAttributes['url']so relative GraphQL endpoints get enriched the same way as absolute ones.Closes #20292