(span: Span, handlerData: HandlerDataFetch)
| 307 | } |
| 308 | |
| 309 | function endSpan(span: Span, handlerData: HandlerDataFetch): void { |
| 310 | if (handlerData.response) { |
| 311 | setHttpStatus(span, handlerData.response.status); |
| 312 | |
| 313 | const contentLength = handlerData.response?.headers?.get('content-length'); |
| 314 | |
| 315 | if (contentLength) { |
| 316 | const contentLengthNum = parseInt(contentLength); |
| 317 | if (contentLengthNum > 0) { |
| 318 | span.setAttribute('http.response_content_length', contentLengthNum); |
| 319 | } |
| 320 | } |
| 321 | } else if (handlerData.error) { |
| 322 | span.setStatus({ code: SPAN_STATUS_ERROR, message: 'internal_error' }); |
| 323 | } |
| 324 | span.end(); |
| 325 | } |
| 326 | |
| 327 | function baggageHeaderHasSentryBaggageValues(baggageHeader: unknown): boolean { |
| 328 | if (typeof baggageHeader !== 'string') { |
no test coverage detected