@@ -1285,6 +1285,10 @@ def tearDown(self):
12851285 async def default_handler (request ):
12861286 return aiohttp .web .Response (status = int (200 ))
12871287
1288+ @staticmethod
1289+ async def handler_with_body (request ):
1290+ return aiohttp .web .Response (status = 200 , body = b"hello" )
1291+
12881292 @staticmethod
12891293 def get_default_request (url : str = URL ):
12901294 async def default_request (server : aiohttp .test_utils .TestServer ):
@@ -1627,7 +1631,7 @@ def test_response_body_size_not_set_by_default(self):
16271631 AioHttpClientInstrumentor ().instrument ()
16281632
16291633 run_with_test_server (
1630- self .get_default_request (), self .URL , self .default_handler
1634+ self .get_default_request (), self .URL , self .handler_with_body
16311635 )
16321636 span = self ._assert_spans (1 )
16331637 self .assertNotIn (HTTP_RESPONSE_BODY_SIZE , span .attributes )
@@ -1643,7 +1647,7 @@ def test_response_body_size_set_on_span(self):
16431647 AioHttpClientInstrumentor ().uninstrument ()
16441648 AioHttpClientInstrumentor ().instrument ()
16451649 run_with_test_server (
1646- self .get_default_request (), self .URL , self .default_handler
1650+ self .get_default_request (), self .URL , self .handler_with_body
16471651 )
16481652 span = self ._assert_spans (1 )
16491653 self .assertIn (HTTP_RESPONSE_BODY_SIZE , span .attributes )
@@ -1659,8 +1663,9 @@ def test_response_body_size_set_on_span(self):
16591663 def test_response_body_size_metric_recorded (self ):
16601664 AioHttpClientInstrumentor ().uninstrument ()
16611665 AioHttpClientInstrumentor ().instrument ()
1666+
16621667 run_with_test_server (
1663- self .get_default_request (), self .URL , self .default_handler
1668+ self .get_default_request (), self .URL , self .handler_with_body
16641669 )
16651670 metrics = self ._assert_metrics (2 )
16661671 metric_names = {m .name for m in metrics }
@@ -1682,7 +1687,7 @@ def test_response_body_size_not_set_without_new_semconv(self):
16821687 AioHttpClientInstrumentor ().uninstrument ()
16831688 AioHttpClientInstrumentor ().instrument ()
16841689 run_with_test_server (
1685- self .get_default_request (), self .URL , self .default_handler
1690+ self .get_default_request (), self .URL , self .handler_with_body
16861691 )
16871692 span = self ._assert_spans (1 )
16881693 self .assertNotIn (HTTP_RESPONSE_BODY_SIZE , span .attributes )
0 commit comments