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(
208
208
boundaries = advisory .explicit_bucket_boundaries
209
209
invalid_advisory = not (
210
210
boundaries
211
- and all (isinstance (e , float ) for e in boundaries )
211
+ and all (isinstance (e , ( float , int ) ) for e in boundaries )
212
212
)
213
213
except (KeyError , TypeError ):
214
214
invalid_advisory = True
215
215
216
216
if invalid_advisory :
217
217
advisory = None
218
218
_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 "
220
220
)
221
221
222
222
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):
544
544
unit = "unit" ,
545
545
description = "description" ,
546
546
advisory = MetricsHistogramAdvisory (
547
- explicit_bucket_boundaries = [0.0 , 1.0 , 2.0 ]
547
+ explicit_bucket_boundaries = [0.0 , 1.0 , 2 ]
548
548
),
549
549
)
550
550
551
551
self .assertIsInstance (histogram , Histogram )
552
552
self .assertEqual (histogram .name , "name" )
553
553
self .assertEqual (
554
554
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 ]),
558
556
)
559
557
560
558
def test_create_histogram_advisory_validation (self ):
561
559
advisories = [
562
560
MetricsHistogramAdvisory (explicit_bucket_boundaries = None ),
563
561
MetricsHistogramAdvisory (explicit_bucket_boundaries = []),
564
- MetricsHistogramAdvisory (explicit_bucket_boundaries = [1 ]),
565
562
MetricsHistogramAdvisory (explicit_bucket_boundaries = ["1" ]),
566
563
]
567
564
for advisory in advisories :
You can’t perform that action at this time.
0 commit comments