Diff

core/moduleapi.lua @ 13513:2fb79fe54390 0.12

core.moduleapi: Default labels to empty list to fix error if omitted In a host-scoped module in the `if is_scoped` clause the resulting `array:append(nil)` call throws.
author Kim Alvefur <zash@zash.se>
date Sun, 18 Aug 2024 16:58:30 +0200
parent 12479:4d36fbcdd210
child 13514:a1bc6533bbba
line wrap: on
line diff
--- a/core/moduleapi.lua	Thu Aug 08 19:18:22 2024 +0200
+++ b/core/moduleapi.lua	Sun Aug 18 16:58:30 2024 +0200
@@ -558,6 +558,7 @@
 function api:metric(type_, name, unit, description, label_keys, conf)
 	local metric = require "core.statsmanager".metric;
 	local is_scoped = self.host ~= "*"
+	label_keys = label_keys or {};
 	if is_scoped then
 		-- prepend `host` label to label keys if this is not a global module
 		local orig_labels = label_keys