From 0c9c624327cddf046f1170add4818b805b7b7b30 Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Mon, 16 Sep 2024 17:54:11 -0600 Subject: [PATCH 1/4] Update generate-workflows (#4192) Fixes #4191 --- .github/workflows/contrib_0.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/contrib_0.yml b/.github/workflows/contrib_0.yml index 35a6418a470..aac4342e8c7 100644 --- a/.github/workflows/contrib_0.yml +++ b/.github/workflows/contrib_0.yml @@ -2060,6 +2060,34 @@ jobs: - name: Run tests run: tox -e py38-test-instrumentation-aio-pika-3 -- -ra + py38-test-instrumentation-aiokafka: + name: instrumentation-aiokafka + runs-on: ubuntu-latest + steps: + - name: Checkout contrib repo @ SHA - ${{ env.CONTRIB_REPO_SHA }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python-contrib + ref: ${{ env.CONTRIB_REPO_SHA }} + + - name: Checkout core repo @ SHA - ${{ github.sha }} + uses: actions/checkout@v4 + with: + repository: open-telemetry/opentelemetry-python + path: opentelemetry-python-core + + - name: Set up Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: "3.8" + architecture: "x64" + + - name: Install tox + run: pip install tox + + - name: Run tests + run: tox -e py38-test-instrumentation-aiokafka -- -ra + py38-test-instrumentation-kafka-python: name: instrumentation-kafka-python runs-on: ubuntu-latest From 6919f65491466db0c912aafbb3d467a0aac2c5d1 Mon Sep 17 00:00:00 2001 From: Ali Alnosairi <144171192+Ali-Alnosairi@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:40:27 +0300 Subject: [PATCH 2/4] Remove duplicated shutdown() calls as it can be called once (#4188) --- .../integration_test/test_exponential_bucket_histogram.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/opentelemetry-sdk/tests/metrics/integration_test/test_exponential_bucket_histogram.py b/opentelemetry-sdk/tests/metrics/integration_test/test_exponential_bucket_histogram.py index 6574bf43357..a6750eecf54 100644 --- a/opentelemetry-sdk/tests/metrics/integration_test/test_exponential_bucket_histogram.py +++ b/opentelemetry-sdk/tests/metrics/integration_test/test_exponential_bucket_histogram.py @@ -135,8 +135,6 @@ def test_synchronous_delta_temporality(self): results.append(reader.get_metrics_data()) - provider.shutdown() - for metrics_data in results: self.assertIsNone(metrics_data) From 71db261c7b19b6547f4d91a7f2270aa07a638f78 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Wed, 18 Sep 2024 22:12:37 +0200 Subject: [PATCH 3/4] opentelemetry-test-utils: don't crash in TestBase.get_sorted_metrics without metrics (#4194) --- .../src/opentelemetry/test/test_base.py | 3 ++- .../tests/test_base.py | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/opentelemetry-test-utils/tests/test_base.py diff --git a/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py b/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py index f9ac2dfc193..456bd1413f3 100644 --- a/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py +++ b/tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py @@ -144,8 +144,9 @@ def disable_logging(highest_level=logging.CRITICAL): logging.disable(logging.NOTSET) def get_sorted_metrics(self): + metrics_data = self.memory_metrics_reader.get_metrics_data() resource_metrics = ( - self.memory_metrics_reader.get_metrics_data().resource_metrics + metrics_data.resource_metrics if metrics_data else [] ) all_metrics = [] diff --git a/tests/opentelemetry-test-utils/tests/test_base.py b/tests/opentelemetry-test-utils/tests/test_base.py new file mode 100644 index 00000000000..92b83b9b34c --- /dev/null +++ b/tests/opentelemetry-test-utils/tests/test_base.py @@ -0,0 +1,21 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from opentelemetry.test.test_base import TestBase + + +class TestBaseTestCase(TestBase): + def test_get_sorted_metrics_works_without_metrics(self): + metrics = self.get_sorted_metrics() + self.assertEqual(metrics, []) From 6baea367a0a557e7a1a81c280dafc8324dcfafe9 Mon Sep 17 00:00:00 2001 From: Riccardo Magliocchetti Date: Thu, 19 Sep 2024 10:35:46 +0200 Subject: [PATCH 4/4] ci: consider only pull request event when running public-symbols-check (#4195) * CONTRIBUTING: the label is called "Approve Public API check" * ci: consider only pull request event when running public-symbols-check --- .github/workflows/misc_0.yml | 2 +- CONTRIBUTING.md | 2 +- scripts/public_symbols_checker.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index 83907a44aef..7de8653a12b 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -147,7 +147,7 @@ jobs: runs-on: ubuntu-latest if: | !contains(github.event.pull_request.labels.*.name, 'Approve Public API check') - && github.actor != 'opentelemetrybot' + && github.actor != 'opentelemetrybot' && github.event_name == 'pull_request' steps: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f9fe6b641cd..81376baeba5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,7 +82,7 @@ Every public symbol is something that has to be kept in order to maintain backwa To check if your PR is adding public symbols, run `tox -e public-symbols-check`. This will always fail if public symbols are being added/removed. The idea behind this is that every PR that adds/removes public symbols fails in CI, forcing reviewers to check the symbols to make sure they are strictly necessary. -If after checking them, it is considered that they are indeed necessary, the PR will be labeled with `Skip Public API check` so that this check is not +If after checking them, it is considered that they are indeed necessary, the PR will be labeled with `Approve Public API check` so that this check is not run. Also, we try to keep our console output as clean as possible. Most of the time this means catching expected log messages in the test cases: diff --git a/scripts/public_symbols_checker.py b/scripts/public_symbols_checker.py index c8bf7fd22e7..7dd9b5d309d 100644 --- a/scripts/public_symbols_checker.py +++ b/scripts/public_symbols_checker.py @@ -139,7 +139,7 @@ def remove_common_symbols(): print( "Please make sure that all of them are strictly necessary, if not, " "please consider prefixing them with an underscore to make them " - 'private. After that, please label this PR with "Skip Public API ' + 'private. After that, please label this PR with "Approve Public API ' 'check".' ) print() @@ -154,7 +154,7 @@ def remove_common_symbols(): print( "Please make sure no public symbols are removed, if so, please " "consider deprecating them instead. After that, please label this " - 'PR with "Skip Public API check".' + 'PR with "Approve Public API check".' ) exit(1) else: