@@ -142,6 +142,8 @@ async def _async_no_update_request_hook(span: "Span", request: "RequestInfo"):
142142
143143# pylint: disable=too-many-public-methods
144144
145+ SCOPE = "opentelemetry.instrumentation.httpx"
146+
145147
146148# Using this wrapper class to have a base class for the tests while also not
147149# angering pylint or mypy when calling methods not in the class when only
@@ -205,7 +207,7 @@ def assert_span(
205207 return span_list
206208
207209 def assert_metrics (self , num_metrics : int = 1 ):
208- metrics = self .get_sorted_metrics ()
210+ metrics = self .get_sorted_metrics (SCOPE )
209211 self .assertEqual (len (metrics ), num_metrics )
210212 return metrics
211213
@@ -244,7 +246,7 @@ def test_basic(self):
244246
245247 def test_basic_metrics (self ):
246248 self .perform_request (self .URL )
247- metrics = self .get_sorted_metrics ()
249+ metrics = self .get_sorted_metrics (SCOPE )
248250 self .assertEqual (len (metrics ), 1 )
249251 duration_data_point = metrics [0 ].data .data_points [0 ]
250252 self .assertEqual (duration_data_point .count , 1 )
@@ -289,7 +291,7 @@ def test_nonstandard_http_method(self):
289291 span , opentelemetry .instrumentation .httpx
290292 )
291293 # Validate metrics
292- metrics = self .get_sorted_metrics ()
294+ metrics = self .get_sorted_metrics (SCOPE )
293295 self .assertEqual (len (metrics ), 1 )
294296 duration_data_point = metrics [0 ].data .data_points [0 ]
295297 self .assertEqual (duration_data_point .count , 1 )
@@ -331,7 +333,7 @@ def test_nonstandard_http_method_new_semconv(self):
331333 span , opentelemetry .instrumentation .httpx
332334 )
333335 # Validate metrics
334- metrics = self .get_sorted_metrics ()
336+ metrics = self .get_sorted_metrics (SCOPE )
335337 self .assertEqual (len (metrics ), 1 )
336338 duration_data_point = metrics [0 ].data .data_points [0 ]
337339 self .assertEqual (duration_data_point .count , 1 )
@@ -391,7 +393,7 @@ def test_basic_new_semconv(self):
391393 )
392394
393395 # Validate metrics
394- metrics = self .get_sorted_metrics ()
396+ metrics = self .get_sorted_metrics (SCOPE )
395397 self .assertEqual (len (metrics ), 1 )
396398 duration_data_point = metrics [0 ].data .data_points [0 ]
397399 self .assertEqual (duration_data_point .count , 1 )
@@ -448,7 +450,7 @@ def test_basic_both_semconv(self):
448450 )
449451
450452 # Validate metrics
451- metrics = self .get_sorted_metrics ()
453+ metrics = self .get_sorted_metrics (SCOPE )
452454 self .assertEqual (len (metrics ), 2 )
453455 # Old convention
454456 self .assertEqual (
@@ -497,7 +499,7 @@ def test_not_foundbasic(self):
497499 trace .StatusCode .ERROR ,
498500 )
499501 # Validate metrics
500- metrics = self .get_sorted_metrics ()
502+ metrics = self .get_sorted_metrics (SCOPE )
501503 self .assertEqual (len (metrics ), 1 )
502504 duration_data_point = metrics [0 ].data .data_points [0 ]
503505 self .assertEqual (
@@ -525,7 +527,7 @@ def test_not_foundbasic_new_semconv(self):
525527 trace .StatusCode .ERROR ,
526528 )
527529 # Validate metrics
528- metrics = self .get_sorted_metrics ()
530+ metrics = self .get_sorted_metrics (SCOPE )
529531 self .assertEqual (len (metrics ), 1 )
530532 duration_data_point = metrics [0 ].data .data_points [0 ]
531533 self .assertEqual (
@@ -556,7 +558,7 @@ def test_not_foundbasic_both_semconv(self):
556558 trace .StatusCode .ERROR ,
557559 )
558560 # Validate metrics
559- metrics = self .get_sorted_metrics ()
561+ metrics = self .get_sorted_metrics (SCOPE )
560562 self .assertEqual (len (metrics ), 2 )
561563 # Old convention
562564 self .assertEqual (
0 commit comments