File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
src/opentelemetry/sdk/metrics/_internal Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -205,18 +205,19 @@ def create_histogram(
205205 advisory : Optional [MetricsInstrumentAdvisory ] = None ,
206206 ) -> APIHistogram :
207207 if advisory is not None :
208- raise_error = False
208+ invalid_advisory = False
209209 try :
210210 boundaries = advisory ["explicit_bucket_boundaries" ]
211- raise_error = not (
211+ invalid_advisory = not (
212212 boundaries
213213 and all (isinstance (e , (int , float )) for e in boundaries )
214214 )
215215 except (KeyError , TypeError ):
216- raise_error = True
216+ invalid_advisory = True
217217
218- if raise_error :
219- raise ValueError (
218+ if invalid_advisory :
219+ advisory = None
220+ _logger .warning (
220221 "Advisory must be a dict with explicit_bucket_boundaries key containing a sequence of numbers"
221222 )
222223
Original file line number Diff line number Diff line change @@ -524,7 +524,7 @@ def test_create_histogram_advisory_validation(self):
524524 ]
525525 for advisory in advisories :
526526 with self .subTest (advisory = advisory ):
527- with self .assertRaises ( ValueError ):
527+ with self .assertLogs ( level = WARNING ):
528528 self .meter .create_histogram (
529529 "name" ,
530530 unit = "unit" ,
You can’t perform that action at this time.
0 commit comments