From cb67f4c62dac184303bb04019ce71ffd3ee66f87 Mon Sep 17 00:00:00 2001 From: Yannick Martin Date: Mon, 26 Aug 2024 18:03:33 +0200 Subject: [PATCH] allow 0 value as a valid value for set() and observe() --- prometheus.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prometheus.lua b/prometheus.lua index a1848a8..a5fedcf 100644 --- a/prometheus.lua +++ b/prometheus.lua @@ -549,7 +549,7 @@ end -- value: numeric value. -- label_values: a list of label values, in the same order as label keys. local function set(self, value, label_values) - if not value then + if tonumber(value) == nil then self._log_error("No value passed for " .. self.name) return end @@ -573,7 +573,7 @@ end -- value: numeric value to record. Should be defined. -- label_values: a list of label values, in the same order as label keys. local function observe(self, value, label_values) - if not value then + if tonumber(value) == nil then self._log_error("No value passed for " .. self.name) return end