Skip to content

Commit 03664b0

Browse files
committed
Cast to float on observe
1 parent 05e1769 commit 03664b0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

prometheus_summary/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def _metric_init(self):
4848
)
4949

5050
def observe(self, amount):
51+
if not isinstance(amount, (float, int)):
52+
raise TypeError("Summary only works with int or float")
53+
54+
amount = float(amount)
5155
super().observe(amount)
5256
self._estimator.observe(amount)
5357

0 commit comments

Comments
 (0)