Skip to content

Commit 87cc443

Browse files
committed
fix(browser): enrich graphqlClient spans for relative URLs
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
1 parent 3572788 commit 87cc443

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

packages/browser/src/integrations/graphqlClient.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ function _updateSpanWithGraphQLData(client: Client, options: GraphQLClientOption
6767
return;
6868
}
6969

70-
const httpUrl = spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] || spanAttributes['http.url'];
70+
// Fall back to the `url` attribute too: the fetch instrumentation only
71+
// sets `url.full` / `http.url` for absolute URLs, but populates `url`
72+
// for relative GraphQL endpoints. Without this fallback the integration
73+
// silently skips relative endpoints. (#20292)
74+
const httpUrl =
75+
spanAttributes[SEMANTIC_ATTRIBUTE_URL_FULL] ||
76+
spanAttributes['http.url'] ||
77+
spanAttributes['url'];
7178
const httpMethod = spanAttributes[SEMANTIC_ATTRIBUTE_HTTP_REQUEST_METHOD] || spanAttributes['http.method'];
7279

7380
if (!isString(httpUrl) || !isString(httpMethod)) {

0 commit comments

Comments
 (0)