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(
175175 // TODO (kmclb) remove this once types PR goes through
176176 // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
177177 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+ }
178185 } else if ( handlerData . error ) {
179186 span . setStatus ( 'internal_error' ) ;
180187 }
@@ -186,9 +193,6 @@ export function fetchCallback(
186193 return ;
187194 }
188195
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' ) ;
192196 const currentScope = getCurrentHub ( ) . getScope ( ) ;
193197 const currentSpan = currentScope && currentScope . getSpan ( ) ;
194198 const activeTransaction = currentSpan && currentSpan . transaction ;
@@ -199,7 +203,6 @@ export function fetchCallback(
199203 data : {
200204 url,
201205 type : 'fetch' ,
202- ...( contentLength ? { 'http.response_content_length' : contentLength } : { } ) ,
203206 'http.method' : method ,
204207 } ,
205208 description : `${ method } ${ url } ` ,
You can’t perform that action at this time.
0 commit comments