From 31acb01008fbb6edef4edef89a871f1616ece7ec 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..5ea8499 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 type(value) ~= "number" 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 type(value) ~= "number" then self._log_error("No value passed for " .. self.name) return end