diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7d79123de5..cb1eecbf34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 0ef76a5cc39626f783416ca75e43556e2bb2739d + CORE_REPO_SHA: d054dff47d2da663a39b9656d106c3d15f344269 jobs: build: diff --git a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py index cb22174482..209acdf663 100644 --- a/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py +++ b/instrumentation/opentelemetry-instrumentation-asgi/tests/test_asgi_middleware.py @@ -656,10 +656,7 @@ def test_no_metric_for_websockets(self): self.send_input({"type": "websocket.receive", "text": "ping"}) self.send_input({"type": "websocket.disconnect"}) self.get_all_output() - metrics_list = self.memory_metrics_reader.get_metrics_data() - self.assertEqual( - len(metrics_list.resource_metrics[0].scope_metrics), 0 - ) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) class TestAsgiAttributes(unittest.TestCase): diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py index 46e39a6046..e290362e77 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py @@ -68,9 +68,4 @@ def test_metric_uninstrument(self): self.assertEqual(len(metrics), 1) CeleryInstrumentor().uninstrument() - metrics = self.get_metrics() - self.assertEqual(len(metrics), 1) - - for metric in metrics: - for point in list(metric.data.data_points): - self.assertEqual(point.count, 1) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) diff --git a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py index 2d753c3c42..8d89959428 100644 --- a/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-sqlalchemy/tests/test_sqlalchemy_metrics.py @@ -56,8 +56,7 @@ def test_metrics_one_connection(self): pool_logging_name=pool_name, ) - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 0) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) with engine.connect(): self.assert_pool_idle_used_expected( @@ -78,8 +77,7 @@ def test_metrics_without_pool_name(self): pool_logging_name=pool_name, ) - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 0) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) with engine.connect(): self.assert_pool_idle_used_expected( @@ -100,8 +98,7 @@ def test_metrics_two_connections(self): pool_logging_name=pool_name, ) - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 0) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) with engine.connect(): with engine.connect(): @@ -122,8 +119,7 @@ def test_metrics_connections(self): pool_logging_name=pool_name, ) - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 0) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) with engine.connect(): with engine.connect(): @@ -156,5 +152,4 @@ def test_metric_uninstrument(self): engine.connect() - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 0) + self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py index f56aa4f97d..d8f19f4e5d 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py @@ -16,6 +16,9 @@ from timeit import default_timer from urllib import request from urllib.parse import urlencode +from pytest import mark +from platform import python_implementation +from sys import version_info import httpretty @@ -185,16 +188,27 @@ def test_basic_metric_request_not_empty(self): ), ) + @mark.skipif( + python_implementation() == "PyPy" or version_info.minor == 7, + reason="Fails randomly in 3.7 and pypy" + ) def test_metric_uninstrument(self): with request.urlopen(self.URL): metrics = self.get_sorted_metrics() self.assertEqual(len(metrics), 3) + self.assertEqual( + metrics[0].data.data_points[0].sum, 1 + ) + self.assertEqual( + metrics[1].data.data_points[0].sum, 0 + ) + self.assertEqual( + metrics[2].data.data_points[0].sum, 6 + ) + URLLibInstrumentor().uninstrument() with request.urlopen(self.URL): - metrics = self.get_sorted_metrics() - self.assertEqual(len(metrics), 3) - - for metric in metrics: - for point in list(metric.data.data_points): - self.assertEqual(point.count, 1) + self.assertIsNone( + self.memory_metrics_reader.get_metrics_data() + )