diff --git a/instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py b/instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py index cb877e67be..3a82491676 100644 --- a/instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py +++ b/instrumentation/opentelemetry-instrumentation-aiohttp-server/tests/test_aiohttp_server_integration.py @@ -97,6 +97,9 @@ def __repr__(self): TRACE = "TRACE" +SCOPE = "opentelemetry.instrumentation.aiohttp_server" + + @pytest.fixture(name="test_base", scope="function") def fixture_test_base(): test_base = TestBase() @@ -172,14 +175,14 @@ async def test_status_code_instrumentation( server, _ = server_fixture assert len(test_base.get_finished_spans()) == 0 - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) assert len(metrics) == 0 client = await aiohttp_client(server) await client.get(url) assert len(test_base.get_finished_spans()) == 1 - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) assert len(metrics) == 2 [span] = test_base.get_finished_spans() @@ -327,7 +330,7 @@ async def handler(request): spans = test_base.get_finished_spans() assert len(spans) == 0 - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) assert len(metrics) == 0 AioHttpServerInstrumentor().uninstrument() @@ -545,7 +548,7 @@ async def test_semantic_conventions_metrics_old_default( assert NETWORK_PROTOCOL_VERSION not in span.attributes assert HTTP_RESPONSE_STATUS_CODE not in span.attributes - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) expected_metric_names = [ "http.server.active_requests", "http.server.duration", @@ -619,7 +622,7 @@ async def test_semantic_conventions_metrics_new( assert HTTP_FLAVOR not in span.attributes assert HTTP_STATUS_CODE not in span.attributes - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) expected_metric_names = [ "http.server.active_requests", "http.server.request.duration", @@ -701,7 +704,7 @@ async def test_semantic_conventions_metrics_both( assert span.attributes.get(HTTP_RESPONSE_STATUS_CODE) == 200 assert span.attributes.get(HTTP_ROUTE) == "default_handler" - metrics = test_base.get_sorted_metrics() + metrics = test_base.get_sorted_metrics(SCOPE) assert len(metrics) == 3 # Both duration metrics + active requests server_active_requests_count_attrs_both = list( _server_active_requests_count_attrs_old diff --git a/instrumentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_future_cancellation.py b/instrumentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_future_cancellation.py index 99a3991e38..01e1a8e1b8 100644 --- a/instrumentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_future_cancellation.py +++ b/instrumentation/opentelemetry-instrumentation-asyncio/tests/test_asyncio_future_cancellation.py @@ -8,6 +8,8 @@ from opentelemetry.test.test_base import TestBase from opentelemetry.trace import get_tracer +SCOPE = "opentelemetry.instrumentation.asyncio" + class TestTraceFuture(TestBase): @patch.dict( @@ -41,7 +43,7 @@ async def future_cancelled(): self.assertEqual(spans[0].name, "root") self.assertEqual(spans[1].name, "asyncio future") - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 2) self.assertEqual(metrics[0].name, "asyncio.process.created") diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py index a225b73e22..57ceb51d36 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py @@ -10,6 +10,8 @@ from .celery_test_tasks import app, task_add +SCOPE = "opentelemetry.instrumentation.celery" + class TestMetrics(TestBase): def setUp(self): @@ -34,7 +36,7 @@ def get_metrics(self): if time.time() > timeout: break time.sleep(0.05) - return self.get_sorted_metrics() + return self.get_sorted_metrics(SCOPE) def test_basic_metric(self): CeleryInstrumentor().instrument() diff --git a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py index 6397be6cc6..e892696599 100644 --- a/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-django/tests/test_middleware.py @@ -99,6 +99,8 @@ def path(path_argument, *args, **kwargs): ] _django_instrumentor = DjangoInstrumentor() +SCOPE = "opentelemetry.instrumentation.django" + # pylint: disable=too-many-public-methods class TestMiddleware(WsgiTestBase): @@ -737,7 +739,7 @@ def test_wsgi_metrics(self): response = Client().get("/span_name/1234/") self.assertEqual(response.status_code, 200) duration = max(round((default_timer() - start) * 1000), 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histrogram_data_point_seen = False @@ -786,7 +788,7 @@ def test_wsgi_metrics_new_semconv(self): response = Client().get("/span_name/1234/") self.assertEqual(response.status_code, 200) duration_s = default_timer() - start - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histrogram_data_point_seen = False @@ -855,7 +857,7 @@ def test_wsgi_metrics_both_semconv(self): self.assertEqual(response.status_code, 200) duration_s = max(default_timer() - start, 0) duration = max(round(duration_s * 1000), 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histrogram_data_point_seen = False @@ -901,7 +903,7 @@ def test_wsgi_metrics_unistrument(self): Client().get("/span_name/1234/") _django_instrumentor.uninstrument() Client().get("/span_name/1234/") - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): diff --git a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py index 3ab1c6d102..d56a0f1303 100644 --- a/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py +++ b/instrumentation/opentelemetry-instrumentation-falcon/tests/test_falcon.py @@ -120,6 +120,9 @@ _parsed_falcon_version = package_version.parse(_falcon_version) +SCOPE = "opentelemetry.instrumentation.falcon" + + class TestFalconBase(TestBase): def setUp(self): super().setUp() @@ -487,7 +490,7 @@ def test_traced_not_recording(self): self.assertFalse(mock_span.set_attribute.called) self.assertFalse(mock_span.set_status.called) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertTrue(len(metrics) != 0) for metric in metrics: data_points = list(metric.data.data_points) @@ -519,7 +522,7 @@ def test_falcon_metrics(self): self.client().simulate_get("/hello/756") self.client().simulate_get("/hello/756") self.client().simulate_get("/hello/756") - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histogram_data_point_seen = False self.assertTrue(len(metrics) != 0) @@ -545,7 +548,7 @@ def test_falcon_metric_values_new_semconv(self): self.client().simulate_get("/hello/756") duration = max(default_timer() - start, 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: data_points = list(metric.data.data_points) self.assertEqual(len(data_points), 1) @@ -577,7 +580,7 @@ def test_falcon_metric_values_both_semconv(self): self.client().simulate_get("/hello/756") duration_s = default_timer() - start - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) # pylint: disable=too-many-nested-blocks for metric in metrics: @@ -626,7 +629,7 @@ def test_falcon_metric_values(self): self.client().simulate_get("/hello/756") duration = max(round((default_timer() - start) * 1000), 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: data_points = list(metric.data.data_points) self.assertEqual(len(data_points), 1) @@ -650,7 +653,7 @@ def test_metric_uninstrument(self): self.client().simulate_request(method="POST", path="/hello/756") FalconInstrumentor().uninstrument() self.client().simulate_request(method="POST", path="/hello/756") - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): diff --git a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py index a778589c49..039ae9db83 100644 --- a/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py +++ b/instrumentation/opentelemetry-instrumentation-flask/tests/test_programmatic.py @@ -146,6 +146,8 @@ def expected_attributes_new(override_attributes): "http.server.request.duration": _server_duration_attrs_new_copy, } +SCOPE = "opentelemetry.instrumentation.flask" + # pylint: disable=too-many-public-methods class TestProgrammatic(InstrumentationTest, WsgiTestBase): @@ -497,7 +499,7 @@ def test_flask_metrics(self): self.client.get("/hello/321") self.client.get("/hello/756") duration = max(round((default_timer() - start) * 1000), 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histogram_data_point_seen = False self.assertTrue(len(metrics) != 0) @@ -525,7 +527,7 @@ def test_flask_metrics_new_semconv(self): self.client.get("/hello/321") self.client.get("/hello/756") duration_s = max(default_timer() - start, 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histogram_data_point_seen = False self.assertTrue(len(metrics) != 0) @@ -557,7 +559,7 @@ def test_flask_metric_values(self): self.client.post("/hello/756") self.client.post("/hello/756") duration = max(round((default_timer() - start) * 1000), 0) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): @@ -573,7 +575,7 @@ def _assert_basic_metric( expected_histogram_explicit_bounds=None, ): # pylint: disable=too-many-nested-blocks - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): diff --git a/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_automatic.py b/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_automatic.py index 1b50070d30..8754381dc2 100644 --- a/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_automatic.py +++ b/instrumentation/opentelemetry-instrumentation-pyramid/tests/test_automatic.py @@ -92,6 +92,8 @@ MetricInstruments.HTTP_SERVER_DURATION: _server_duration_attrs_old, } +SCOPE = "opentelemetry.instrumentation.pyramid.callbacks" + class TestAutomatic(InstrumentationTest, WsgiTestBase): def setUp(self): @@ -223,7 +225,7 @@ def test_pyramid_metric(self): self.client.get("/hello/756") self.client.get("/hello/756") self.client.get("/hello/756") - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) number_data_point_seen = False histogram_data_point_seen = False self.assertEqual(len(metrics), 2) diff --git a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py index 2d1fc556cb..5c5338a413 100644 --- a/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py +++ b/instrumentation/opentelemetry-instrumentation-requests/tests/test_requests_integration.py @@ -102,6 +102,9 @@ def __init__(self): self.response = {} +SCOPE = "opentelemetry.instrumentation.requests" + + class RequestsIntegrationTestBase(abc.ABC): # pylint: disable=no-member # pylint: disable=too-many-public-methods @@ -1008,7 +1011,7 @@ def test_basic_metric_success(self): HTTP_SCHEME: "http", } - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 1) for metric in metrics: self.assertEqual(metric.unit, "ms") @@ -1036,7 +1039,7 @@ def test_basic_metric_new_semconv(self): HTTP_REQUEST_METHOD: "GET", NETWORK_PROTOCOL_VERSION: "1.1", } - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 1) for metric in metrics: self.assertEqual(metric.unit, "s") @@ -1074,7 +1077,7 @@ def test_basic_metric_both_semconv(self): NETWORK_PROTOCOL_VERSION: "1.1", } - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 2) for metric in metrics: for data_point in metric.data.data_points: @@ -1145,7 +1148,7 @@ def test_basic_metric_non_recording_span(self): self.assertTrue(mock_span.is_recording.called) self.assertFalse(mock_span.set_attribute.called) self.assertFalse(mock_span.set_status.called) - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 1) duration_data_point = metrics[0].data.data_points[0] self.assertDictEqual( diff --git a/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py b/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py index 9a6af615d4..a2a22a8e65 100644 --- a/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-starlette/tests/test_starlette_instrumentation.py @@ -64,6 +64,8 @@ "http.server.request.size": _duration_attrs, } +SCOPE = "opentelemetry.instrumentation.starlette" + class TestStarletteManualInstrumentation(TestBase): def _create_app(self): @@ -182,9 +184,7 @@ def test_starlette_metrics(self): self._client.get("/foobar") number_data_point_seen = False histogram_data_point_seen = False - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.starlette" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertTrue(len(metrics) == 3) for metric in metrics: self.assertIn(metric.name, _expected_metric_names) @@ -225,9 +225,7 @@ def test_basic_post_request_metric_success(self): duration = max(round((default_timer() - start) * 1000), 0) response_size = int(response.headers.get("content-length")) request_size = int(response.request.headers.get("content-length")) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.starlette" - ) + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): @@ -254,9 +252,7 @@ def test_metric_for_uninstrment_app_method(self): self._instrumentor.uninstrument_app(self._app) self._client.get("/foobar") self._client.get("/foobar") - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.starlette" - ) + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): @@ -275,9 +271,7 @@ def test_metric_uninstrument_inherited_by_base(self): client.get("/foobar") client.get("/foobar") client.get("/foobar") - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.starlette" - ) + metrics = self.get_sorted_metrics(SCOPE) for metric in metrics: for point in list(metric.data.data_points): if isinstance(point, HistogramDataPoint): diff --git a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_metrics.py b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_metrics.py index 54d78ce913..6c87aa7e3c 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-urllib3/tests/test_urllib3_metrics.py @@ -30,6 +30,8 @@ from opentelemetry.test.httptest import HttpTestBase from opentelemetry.test.test_base import TestBase +SCOPE = "opentelemetry.instrumentation.urllib3" + class TestURLLib3InstrumentorMetric(HttpTestBase, TestBase): HTTP_URL = "http://mock/status/200" @@ -73,9 +75,7 @@ def test_basic_metrics(self): start_time = default_timer() response = self.pool.request("GET", self.HTTP_URL) duration_ms = max(round((default_timer() - start_time) * 1000), 0) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 3) ( @@ -145,9 +145,7 @@ def test_basic_metrics_new_semconv(self): response = self.pool.request("GET", self.HTTP_URL) duration_s = max(default_timer() - start_time, 0) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 3) ( client_request_size, @@ -220,9 +218,7 @@ def test_basic_metrics_both_semconv(self): duration = max(round(duration_s * 1000), 0) expected_size = len(response.data) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 6) ( @@ -359,9 +355,7 @@ def test_basic_metrics_nonstandard_http_method(self): response = self.pool.request("NONSTANDARD", self.HTTP_URL) duration_ms = max(round((default_timer() - start_time) * 1000), 0) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) ( client_duration, @@ -434,9 +428,7 @@ def test_basic_metrics_nonstandard_http_method_new_semconv(self): response = self.pool.request("NONSTANDARD", self.HTTP_URL) duration_s = max(default_timer() - start_time, 0) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) ( client_request_size, @@ -506,9 +498,7 @@ def test_basic_metrics_nonstandard_http_method_new_semconv(self): def test_str_request_body_size_metrics(self): self.pool.request("POST", self.HTTP_URL, body="foobar") - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) (_, client_request_size, _) = metrics self.assertEqual(client_request_size.name, "http.client.request.size") @@ -542,9 +532,7 @@ def test_schema_url(self): for metrics in resource_metrics: scope_metrics_list = [ - sm - for sm in metrics.scope_metrics - if sm.scope.name == "opentelemetry.instrumentation.urllib3" + sm for sm in metrics.scope_metrics if sm.scope.name == SCOPE ] for scope_metrics in scope_metrics_list: self.assertEqual( @@ -555,9 +543,7 @@ def test_schema_url(self): def test_bytes_request_body_size_metrics(self): self.pool.request("POST", self.HTTP_URL, body=b"foobar") - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) (_, client_request_size, _) = metrics self.assertEqual(client_request_size.name, "http.client.request.size") @@ -585,9 +571,7 @@ def test_bytes_request_body_size_metrics(self): def test_fields_request_body_size_metrics(self): self.pool.request("POST", self.HTTP_URL, fields={"foo": "bar"}) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) (_, client_request_size, _) = metrics self.assertEqual(client_request_size.name, "http.client.request.size") @@ -616,9 +600,7 @@ def test_fields_request_body_size_metrics(self): def test_bytesio_request_body_size_metrics(self): self.pool.request("POST", self.HTTP_URL, body=io.BytesIO(b"foobar")) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) (_, client_request_size, _) = metrics self.assertEqual(client_request_size.name, "http.client.request.size") @@ -648,9 +630,7 @@ def test_generator_request_body_size_metrics(self): "POST", self.HTTP_URL, body=(b for b in (b"foo", b"bar")) ) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 2) self.assertNotIn("http.client.request.size", [m.name for m in metrics]) @@ -659,9 +639,7 @@ def test_metric_uninstrument(self): URLLib3Instrumentor().uninstrument() self.pool.request("GET", self.HTTP_URL) - metrics = self.get_sorted_metrics( - scope="opentelemetry.instrumentation.urllib3" - ) + metrics = self.get_sorted_metrics(SCOPE) self.assertEqual(len(metrics), 3) for metric in metrics: diff --git a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py index e85aa9a796..edb6655c5c 100644 --- a/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-wsgi/tests/test_wsgi_middleware.py @@ -204,6 +204,8 @@ def wsgi_with_repeat_custom_response_headers(environ, start_response): "http.server.request.duration": _server_duration_attrs_new, } +SCOPE = "opentelemetry.instrumentation.wsgi" + class TestWsgiApplication(WsgiTestBase): def setUp(self): @@ -430,7 +432,7 @@ def test_wsgi_metrics(self): number_data_point_seen = False histogram_data_point_seen = False - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertTrue(len(metrics) > 0) for metric in metrics: self.assertIn(metric.name, _expected_metric_names_old) @@ -494,7 +496,7 @@ def test_wsgi_metrics_new_semconv(self): number_data_point_seen = False histogram_data_point_seen = False - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertTrue(len(metrics) != 0) for metric in metrics: self.assertIn(metric.name, _expected_metric_names_new) @@ -525,7 +527,7 @@ def test_wsgi_metrics_both_semconv(self): number_data_point_seen = False histogram_data_point_seen = False - metrics = self.get_sorted_metrics() + metrics = self.get_sorted_metrics(SCOPE) self.assertTrue(len(metrics) != 0) for metric in metrics: if metric.unit == "ms":