@@ -6,6 +6,7 @@ import type { Client } from '@sentry/core/browser';
66import { SentrySpan , spanToJSON } from '@sentry/core/browser' ;
77import type { FetchHint , XhrHint } from '@sentry/browser-utils' ;
88import { SENTRY_XHR_DATA_KEY } from '@sentry/browser-utils' ;
9+ import { URL_FULL } from '@sentry/conventions/attributes' ;
910import { describe , expect , test } from 'vitest' ;
1011import {
1112 _getGraphQLOperation ,
@@ -352,14 +353,15 @@ describe('GraphqlClient', () => {
352353 extensions : { } ,
353354 } ;
354355
355- test ( 'enriches http.client span for absolute URLs (http.url attribute) ' , ( ) => {
356+ test ( 'enriches http.client span for absolute URLs' , ( ) => {
356357 const handler = setupHandler ( [ / \/ g r a p h q l $ / ] ) ;
357358 const span = new SentrySpan ( {
358359 name : 'POST http://localhost:4000/graphql' ,
359360 op : 'http.client' ,
360361 attributes : {
361362 'http.method' : 'POST' ,
362363 'http.url' : 'http://localhost:4000/graphql' ,
364+ [ URL_FULL ] : 'http://localhost:4000/graphql' ,
363365 url : 'http://localhost:4000/graphql' ,
364366 } ,
365367 } ) ;
@@ -371,9 +373,27 @@ describe('GraphqlClient', () => {
371373 expect ( json . data [ 'graphql.document' ] ) . toBe ( requestBody . query ) ;
372374 } ) ;
373375
376+ test ( 'enriches http.client span when only url.full is present' , ( ) => {
377+ const handler = setupHandler ( [ / \/ g r a p h q l $ / ] ) ;
378+ const span = new SentrySpan ( {
379+ name : 'POST http://localhost:4000/graphql' ,
380+ op : 'http.client' ,
381+ attributes : {
382+ 'http.method' : 'POST' ,
383+ [ URL_FULL ] : 'http://localhost:4000/graphql' ,
384+ } ,
385+ } ) ;
386+
387+ handler ( span , makeFetchHint ( 'http://localhost:4000/graphql' , requestBody ) ) ;
388+
389+ const json = spanToJSON ( span ) ;
390+ expect ( json . description ) . toBe ( 'POST http://localhost:4000/graphql (query GetHello)' ) ;
391+ expect ( json . data [ 'graphql.document' ] ) . toBe ( requestBody . query ) ;
392+ } ) ;
393+
374394 test ( 'enriches http.client span for relative URLs (only url attribute)' , ( ) => {
375395 const handler = setupHandler ( [ / \/ g r a p h q l $ / ] ) ;
376- // Fetch instrumentation does NOT set http.url for relative URLs — only `url` .
396+ // Fetch instrumentation does not set ` http.url` or `url.full` for relative URLs.
377397 const span = new SentrySpan ( {
378398 name : 'POST /graphql' ,
379399 op : 'http.client' ,
@@ -433,6 +453,7 @@ describe('GraphqlClient', () => {
433453 attributes : {
434454 'http.method' : 'POST' ,
435455 'http.url' : 'http://localhost:4000/graphql' ,
456+ [ URL_FULL ] : 'http://localhost:4000/graphql' ,
436457 url : 'http://localhost:4000/graphql' ,
437458 } ,
438459 } ) ;
0 commit comments