Changeset

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
parents 13505:a97c11584042
children 13514:a1bc6533bbba 13518:0ef9c26d9d96
files core/moduleapi.lua
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
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