Software /
code /
prosody
Comparison
core/moduleapi.lua @ 11931:c65d5da8e99a
mod_admin_shell: List collected metrics in module:info
Lets you know what to look for with stats:show()
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 24 Nov 2021 20:03:38 +0100 |
parent | 11921:89aef37fca54 |
child | 11987:4b519c575ad0 |
comparison
equal
deleted
inserted
replaced
11930:ec46f110ce1d | 11931:c65d5da8e99a |
---|---|
529 end | 529 end |
530 -- new_legacy_metric takes care of scoping for us, as it does not accept | 530 -- new_legacy_metric takes care of scoping for us, as it does not accept |
531 -- an array of labels | 531 -- an array of labels |
532 -- the prosody_ prefix is automatically added by statsmanager for legacy | 532 -- the prosody_ prefix is automatically added by statsmanager for legacy |
533 -- metrics. | 533 -- metrics. |
534 self:add_item("measure", { name = name, type = stat_type, conf = conf }); | |
534 return measure(stat_type, "mod_"..self.name.."/"..name, conf, fixed_label_key, fixed_label_value) | 535 return measure(stat_type, "mod_"..self.name.."/"..name, conf, fixed_label_key, fixed_label_value) |
535 end | 536 end |
536 | 537 |
537 function api:metric(type_, name, unit, description, label_keys, conf) | 538 function api:metric(type_, name, unit, description, label_keys, conf) |
538 local metric = require "core.statsmanager".metric; | 539 local metric = require "core.statsmanager".metric; |
542 local orig_labels = label_keys | 543 local orig_labels = label_keys |
543 label_keys = array { "host" } | 544 label_keys = array { "host" } |
544 label_keys:append(orig_labels) | 545 label_keys:append(orig_labels) |
545 end | 546 end |
546 local mf = metric(type_, "prosody_mod_"..self.name.."/"..name, unit, description, label_keys, conf) | 547 local mf = metric(type_, "prosody_mod_"..self.name.."/"..name, unit, description, label_keys, conf) |
548 self:add_item("metric", { name = name, mf = mf }); | |
547 if is_scoped then | 549 if is_scoped then |
548 -- make sure to scope the returned metric family to the current host | 550 -- make sure to scope the returned metric family to the current host |
549 return mf:with_partial_label(self.host) | 551 return mf:with_partial_label(self.host) |
550 end | 552 end |
551 return mf | 553 return mf |