Skip to content

Commit a6535a3

Browse files
committed
set span status
1 parent ad48785 commit a6535a3

File tree

1 file changed

+4
-5
lines changed
  • packages/sveltekit/src/client

1 file changed

+4
-5
lines changed

packages/sveltekit/src/client/load.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,13 @@ function instrumentSvelteKitFetch(originalFetch: SvelteKitFetch): SvelteKitFetch
179179
name: `${requestData.method} ${requestData.url}`, // this will become the description of the span
180180
op: 'http.client',
181181
data: requestData,
182-
parentSpanId: activeSpan && activeSpan.spanId,
183182
},
184-
async span => {
185-
const fetchResult: Response = await wrappingTarget.apply(thisArg, [input, patchedInit]);
183+
span => {
184+
const promise: Promise<Response> = wrappingTarget.apply(thisArg, [input, patchedInit]);
186185
if (span) {
187-
span.setHttpStatus(fetchResult.status);
186+
promise.then(res => span.setHttpStatus(res.status)).catch(_ => span.setStatus('internal_error'));
188187
}
189-
return fetchResult;
188+
return promise;
190189
},
191190
);
192191
} else {

0 commit comments

Comments
 (0)