diff --git a/.github/workflows/instrumentations_0.yml b/.github/workflows/instrumentations_0.yml index c0df94171d..d6a1d688e6 100644 --- a/.github/workflows/instrumentations_0.yml +++ b/.github/workflows/instrumentations_0.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 84c0e4f38d4fcdb8c13fd3988469fbb8cda28150 + CORE_REPO_SHA: e98af82ff0ebe7e687fda265093aa576cd9ba80f jobs: instrumentations-0: diff --git a/.github/workflows/instrumentations_1.yml b/.github/workflows/instrumentations_1.yml index 5b57472076..7b1a0925cf 100644 --- a/.github/workflows/instrumentations_1.yml +++ b/.github/workflows/instrumentations_1.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: 84c0e4f38d4fcdb8c13fd3988469fbb8cda28150 + CORE_REPO_SHA: e98af82ff0ebe7e687fda265093aa576cd9ba80f jobs: instrumentations-1: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1d6b03d74b..33791db4cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,7 @@ on: - 'release/*' pull_request: env: - CORE_REPO_SHA: d829e375202d0106d45d7a2441409be82086b423 + CORE_REPO_SHA: e98af82ff0ebe7e687fda265093aa576cd9ba80f jobs: misc: diff --git a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py index e290362e77..01c9487ea8 100644 --- a/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py +++ b/instrumentation/opentelemetry-instrumentation-celery/tests/test_metrics.py @@ -64,8 +64,44 @@ def test_basic_metric(self): def test_metric_uninstrument(self): CeleryInstrumentor().instrument() - metrics = self.get_metrics() - self.assertEqual(len(metrics), 1) + + self.get_metrics() + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 1, + ) + + self.get_metrics() + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 2, + ) + CeleryInstrumentor().uninstrument() - self.assertIsNone(self.memory_metrics_reader.get_metrics_data()) + self.get_metrics() + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 2, + ) diff --git a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py index 087607e606..e544feaaef 100644 --- a/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py +++ b/instrumentation/opentelemetry-instrumentation-urllib/tests/test_metrics_instrumentation.py @@ -194,15 +194,147 @@ def test_basic_metric_request_not_empty(self): ) 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) + self.assertEqual( + len( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics + ) + ), + 3, + ) + + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 1, + ) + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[1] + .data.data_points[0] + .bucket_counts[0] + ), + 1, + ) + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[2] + .data.data_points[0] + .bucket_counts[2] + ), + 1, + ) + + with request.urlopen(self.URL): + + self.assertEqual( + len( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics + ) + ), + 3, + ) + + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 2, + ) + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[1] + .data.data_points[0] + .bucket_counts[0] + ), + 2, + ) + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[2] + .data.data_points[0] + .bucket_counts[2] + ), + 2, + ) + + URLLibInstrumentor().uninstrument() + + with request.urlopen(self.URL): + + self.assertEqual( + len( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics + ) + ), + 3, + ) - URLLibInstrumentor().uninstrument() - with request.urlopen(self.URL): - self.assertIsNone( + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[0] + .data.data_points[0] + .bucket_counts[1] + ), + 2, + ) + self.assertEqual( + ( self.memory_metrics_reader.get_metrics_data() - ) + .resource_metrics[0] + .scope_metrics[0] + .metrics[1] + .data.data_points[0] + .bucket_counts[0] + ), + 2, + ) + self.assertEqual( + ( + self.memory_metrics_reader.get_metrics_data() + .resource_metrics[0] + .scope_metrics[0] + .metrics[2] + .data.data_points[0] + .bucket_counts[2] + ), + 2, + )