File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
tests/opentelemetry-test-utils Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff 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 = []
Original file line number Diff line number Diff line change 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 , [])
You can’t perform that action at this time.
0 commit comments