Skip to content

Commit

Permalink
review(*) improves histogram representation in Lua
Browse files Browse the repository at this point in the history
  • Loading branch information
casimiro committed Sep 6, 2024
1 parent eef9838 commit 12dd92b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/resty/wasmx/shm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ local function parse_cmetric(cmetric)
break
end

h.value[cb.upper_bound] = cb.count
h.value[#(h.value) + 1] = { ub = cb.upper_bound, count = cb.count }
end

return h
Expand Down
4 changes: 2 additions & 2 deletions t/04-openresty/ffi/shm/201-metrics_get.t
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ __DATA__
--- response_body
c1: {type="counter",value=1}
g1: {type="gauge",value=10}
h1: {type="histogram",value={[4294967295]=0,[128]=1}}
h1: {type="histogram",value={{count=1,ub=128},{count=0,ub=4294967295}}}
--- no_error_log
[error]
[crit]
Expand Down Expand Up @@ -101,7 +101,7 @@ h1: {type="histogram",value={[4294967295]=0,[128]=1}}
--- response_body
pw.hostcalls.c1: {type="counter",value=13}
pw.hostcalls.g1: {type="gauge",value=1}
pw.hostcalls.h1: {type="histogram",value={[4294967295]=0,[128]=1,[16]=1}}
pw.hostcalls.h1: {type="histogram",value={{count=1,ub=16},{count=1,ub=128},{count=0,ub=4294967295}}}
--- no_error_log
[error]
[crit]
Expand Down
2 changes: 1 addition & 1 deletion t/04-openresty/ffi/shm/203-metrics_record.t
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ __DATA__
}
--- response_body
g1: {type="gauge",value=10}
h1: {type="histogram",value={[4294967295]=0,[128]=1}}
h1: {type="histogram",value={{count=1,ub=128},{count=0,ub=4294967295}}}
--- no_error_log
[error]
[crit]
Expand Down

0 comments on commit 12dd92b

Please sign in to comment.