Skip to content

Commit c5fbc9c

Browse files
Merge branch 'open-telemetry:main' into add_custom_any_type
2 parents a09c449 + f15821f commit c5fbc9c

File tree

6 files changed

+28
-6
lines changed

6 files changed

+28
-6
lines changed

.github/workflows/misc_0.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
runs-on: ubuntu-latest
148148
if: |
149149
!contains(github.event.pull_request.labels.*.name, 'Approve Public API check')
150-
&& github.actor != 'opentelemetrybot'
150+
&& github.actor != 'opentelemetrybot' && github.event_name == 'pull_request'
151151
steps:
152152
- name: Checkout repo @ SHA - ${{ github.sha }}
153153
uses: actions/checkout@v4

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Every public symbol is something that has to be kept in order to maintain backwa
8282

8383
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
8484
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.
85-
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
85+
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
8686
run.
8787

8888
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:

opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/export/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def __init__(
404404

405405
def get_metrics_data(
406406
self,
407-
) -> "opentelemetry.sdk.metrics.export.MetricsData":
407+
) -> Optional["opentelemetry.sdk.metrics.export.MetricsData"]:
408408
"""Reads and returns current metrics from the SDK"""
409409
with self._lock:
410410
self.collect()

scripts/public_symbols_checker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def remove_common_symbols():
139139
print(
140140
"Please make sure that all of them are strictly necessary, if not, "
141141
"please consider prefixing them with an underscore to make them "
142-
'private. After that, please label this PR with "Skip Public API '
142+
'private. After that, please label this PR with "Approve Public API '
143143
'check".'
144144
)
145145
print()
@@ -154,7 +154,7 @@ def remove_common_symbols():
154154
print(
155155
"Please make sure no public symbols are removed, if so, please "
156156
"consider deprecating them instead. After that, please label this "
157-
'PR with "Skip Public API check".'
157+
'PR with "Approve Public API check".'
158158
)
159159
exit(1)
160160
else:

tests/opentelemetry-test-utils/src/opentelemetry/test/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ def disable_logging(highest_level=logging.CRITICAL):
144144
logging.disable(logging.NOTSET)
145145

146146
def get_sorted_metrics(self):
147+
metrics_data = self.memory_metrics_reader.get_metrics_data()
147148
resource_metrics = (
148-
self.memory_metrics_reader.get_metrics_data().resource_metrics
149+
metrics_data.resource_metrics if metrics_data else []
149150
)
150151

151152
all_metrics = []
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright The OpenTelemetry Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from opentelemetry.test.test_base import TestBase
16+
17+
18+
class TestBaseTestCase(TestBase):
19+
def test_get_sorted_metrics_works_without_metrics(self):
20+
metrics = self.get_sorted_metrics()
21+
self.assertEqual(metrics, [])

0 commit comments

Comments
 (0)