File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
src/opentelemetry/sdk/metrics/_internal Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -208,15 +208,15 @@ def create_histogram(
208208 boundaries = advisory .explicit_bucket_boundaries
209209 invalid_advisory = not (
210210 boundaries
211- and all (isinstance (e , float ) for e in boundaries )
211+ and all (isinstance (e , ( float , int ) ) for e in boundaries )
212212 )
213213 except (KeyError , TypeError ):
214214 invalid_advisory = True
215215
216216 if invalid_advisory :
217217 advisory = None
218218 _logger .warning (
219- "Advisory must be a valid MetricsHistogramAdvisory with explicit_bucket_boundaries key containing a sequence of floats "
219+ "Advisory must be a valid MetricsHistogramAdvisory with explicit_bucket_boundaries key containing a sequence of numbers "
220220 )
221221
222222 status = self ._register_instrument (
Original file line number Diff line number Diff line change @@ -544,24 +544,21 @@ def test_create_histogram_with_advisory(self):
544544 unit = "unit" ,
545545 description = "description" ,
546546 advisory = MetricsHistogramAdvisory (
547- explicit_bucket_boundaries = [0.0 , 1.0 , 2.0 ]
547+ explicit_bucket_boundaries = [0.0 , 1.0 , 2 ]
548548 ),
549549 )
550550
551551 self .assertIsInstance (histogram , Histogram )
552552 self .assertEqual (histogram .name , "name" )
553553 self .assertEqual (
554554 histogram ._advisory ,
555- MetricsHistogramAdvisory (
556- explicit_bucket_boundaries = [0.0 , 1.0 , 2.0 ]
557- ),
555+ MetricsHistogramAdvisory (explicit_bucket_boundaries = [0.0 , 1.0 , 2 ]),
558556 )
559557
560558 def test_create_histogram_advisory_validation (self ):
561559 advisories = [
562560 MetricsHistogramAdvisory (explicit_bucket_boundaries = None ),
563561 MetricsHistogramAdvisory (explicit_bucket_boundaries = []),
564- MetricsHistogramAdvisory (explicit_bucket_boundaries = [1 ]),
565562 MetricsHistogramAdvisory (explicit_bucket_boundaries = ["1" ]),
566563 ]
567564 for advisory in advisories :
You can’t perform that action at this time.
0 commit comments