mirror of
https://github.com/openwrt/packages.git
synced 2025-12-21 23:34:31 +04:00
prometheus-node-exporter-lua: add newline to error messages
Description: 1. Avoid error on nil value by skipping over it 2. Adds a newline to error messages Signed-off-by: Amos Shapira <amos.shapira@gmail.com> [bump version] Signed-off-by: Etienne Champetier <champetier.etienne@gmail.com>
This commit is contained in:
committed by
Etienne Champetier
parent
3b2a63dae2
commit
bb43d5f28e
@@ -4,7 +4,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=prometheus-node-exporter-lua
|
PKG_NAME:=prometheus-node-exporter-lua
|
||||||
PKG_VERSION:=2025.06.08
|
PKG_VERSION:=2025.06.23
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
PKG_MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ end
|
|||||||
|
|
||||||
function print_metric(metric, labels, value)
|
function print_metric(metric, labels, value)
|
||||||
local label_string = ""
|
local label_string = ""
|
||||||
|
if type(value) == "nil" then
|
||||||
|
return
|
||||||
|
end
|
||||||
if labels then
|
if labels then
|
||||||
for label,value in pairs(labels) do
|
for label,value in pairs(labels) do
|
||||||
label_string = label_string .. label .. '="' .. value .. '",'
|
label_string = label_string .. label .. '="' .. value .. '",'
|
||||||
@@ -59,7 +62,7 @@ function timed_scrape(collector)
|
|||||||
local status, err = pcall(collector.scrape)
|
local status, err = pcall(collector.scrape)
|
||||||
if not status then
|
if not status then
|
||||||
success = 0
|
success = 0
|
||||||
io.stderr:write(err)
|
io.stderr:write(err .. '\n')
|
||||||
end
|
end
|
||||||
return (socket.gettime() - start_time), success
|
return (socket.gettime() - start_time), success
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user