aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2024-08-18 16:58:30 +0200
committerKim Alvefur <zash@zash.se>2024-08-18 16:58:30 +0200
commit65386e9810670432e06c7fd62f91891f87678c6b (patch)
treeb60824b40c3868eba81e540688b4ce94c4845181
parent4f7c829b1e7e88e725ae5ccc5c5f45c92086d590 (diff)
downloadprosody-65386e9810670432e06c7fd62f91891f87678c6b.tar.gz
prosody-65386e9810670432e06c7fd62f91891f87678c6b.zip
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.
-rw-r--r--core/moduleapi.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 870a6a50..cbb2da9c 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -558,6 +558,7 @@ end
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