#1297 stats:show displays counter stat type wrongly
Reporter
pep.
Owner
MattJ
Created
Updated
Stars
★ (1)
Tags
Status-NeedInfo
Priority-Medium
Patch
Type-Defect
pep.
on
What steps will reproduce the problem?
1. mod_measure_cpu loaded (or any other thing that provides a counter)
2. `stats:show()` in admin telnet
What is the expected output?
> | cpu.clock:counter 279.700536
> | cpu.percent:amount 0.20719375057321
What do you see instead?
> | cpu.clock:amount 279.700536
> | cpu.percent:amount 0.20719375057321
What version of the product are you using? On what operating system?
prosody: 7fa273f8869e
prosody-modules: e0fb97f47212
Please provide any additional information below.
I am not entirely sure that's how it should be, it just seemed like a mistake. Please discard if so, otherwise here is a patch.
# HG changeset patch
# User Maxime “pep” Buquet <pep@bouah.net>
# Date 1547656867 0
# Wed Jan 16 16:41:07 2019 +0000
# Node ID 17f038db9695892e7de21978b5a08886b6b5ac94
# Parent 00f7af0be849549c1e65c485f214ca90c97981a9
util.statistics: Fix counter method name
diff --git a/util/statistics.lua b/util/statistics.lua
--- a/util/statistics.lua
+++ b/util/statistics.lua
@@ -51,7 +51,7 @@ local function new_registry(config)
end;
counter = function (name, initial)
local v = initial or 0;
- registry[name..":amount"] = function () return "amount", v; end
+ registry[name..":counter"] = function () return "counter", v; end
return function (delta)
v = v + delta;
end;
Zash
on
I believe it's intentional, that a counter is defined as an amount that is updated by a delta.
Need MattJ to confirm this.
What steps will reproduce the problem? 1. mod_measure_cpu loaded (or any other thing that provides a counter) 2. `stats:show()` in admin telnet What is the expected output? > | cpu.clock:counter 279.700536 > | cpu.percent:amount 0.20719375057321 What do you see instead? > | cpu.clock:amount 279.700536 > | cpu.percent:amount 0.20719375057321 What version of the product are you using? On what operating system? prosody: 7fa273f8869e prosody-modules: e0fb97f47212 Please provide any additional information below. I am not entirely sure that's how it should be, it just seemed like a mistake. Please discard if so, otherwise here is a patch. # HG changeset patch # User Maxime “pep” Buquet <pep@bouah.net> # Date 1547656867 0 # Wed Jan 16 16:41:07 2019 +0000 # Node ID 17f038db9695892e7de21978b5a08886b6b5ac94 # Parent 00f7af0be849549c1e65c485f214ca90c97981a9 util.statistics: Fix counter method name diff --git a/util/statistics.lua b/util/statistics.lua --- a/util/statistics.lua +++ b/util/statistics.lua @@ -51,7 +51,7 @@ local function new_registry(config) end; counter = function (name, initial) local v = initial or 0; - registry[name..":amount"] = function () return "amount", v; end + registry[name..":counter"] = function () return "counter", v; end return function (delta) v = v + delta; end;
I believe it's intentional, that a counter is defined as an amount that is updated by a delta. Need MattJ to confirm this.
Changes