Skip to content

Commit

Permalink
Recording the exception on the span
Browse files Browse the repository at this point in the history
  • Loading branch information
sathiya-s1 authored Nov 6, 2024
1 parent 993370e commit a2697d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/instrumentation/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,12 @@ export function instrumentClientFetch(
const response = await Reflect.apply(target, thisArg, [request])
span.setAttributes(gatherResponseAttributes(response))
return response
} finally {
} catch (error) {
span.recordException(error as Exception)
span.setStatus({ code: SpanStatusCode.ERROR })
throw error
}
finally {
span.end()
}
})
Expand Down

0 comments on commit a2697d8

Please sign in to comment.