File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/tracing-internal/src/browser Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -175,6 +175,13 @@ export function fetchCallback(
175
175
// TODO (kmclb) remove this once types PR goes through
176
176
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
177
177
span . setHttpStatus ( handlerData . response . status ) ;
178
+
179
+ const contentLength =
180
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
181
+ handlerData . response && handlerData . response . headers && handlerData . response . headers . get ( 'content-length' ) ;
182
+ if ( contentLength > 0 ) {
183
+ span . setData ( 'http.response_content_length' , contentLength ) ;
184
+ }
178
185
} else if ( handlerData . error ) {
179
186
span . setStatus ( 'internal_error' ) ;
180
187
}
@@ -186,9 +193,6 @@ export function fetchCallback(
186
193
return ;
187
194
}
188
195
189
- const contentLength =
190
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
191
- handlerData . response && handlerData . response . headers && handlerData . response . headers . get ( 'content-length' ) ;
192
196
const currentScope = getCurrentHub ( ) . getScope ( ) ;
193
197
const currentSpan = currentScope && currentScope . getSpan ( ) ;
194
198
const activeTransaction = currentSpan && currentSpan . transaction ;
@@ -199,7 +203,6 @@ export function fetchCallback(
199
203
data : {
200
204
url,
201
205
type : 'fetch' ,
202
- ...( contentLength ? { 'http.response_content_length' : contentLength } : { } ) ,
203
206
'http.method' : method ,
204
207
} ,
205
208
description : `${ method } ${ url } ` ,
You can’t perform that action at this time.
0 commit comments