Skip to content

Commit

Permalink
[WIP] fix(prometheus) delayed require of WasmX module
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamhm committed Sep 30, 2024
1 parent d241e68 commit 563028a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kong/plugins/prometheus/wasmx.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local buffer = require "string.buffer"
local wasm = require "kong.runloop.wasm"
local wasmx_shm = require "resty.wasmx.shm"
local wasmx_shm


local fmt = string.format
Expand Down Expand Up @@ -150,6 +150,10 @@ _M.metric_data = function()
local parsed = {}
local buf = buf_new()

-- delayed require of the WasmX module, to ensure it is loaded
-- after ngx_wasm_module.so is loaded.
wasmx_shm = wasmx_shm or require "resty.wasmx.shm"

wasmx_shm.metrics:lock()

for key in wasmx_shm.metrics:iterate_keys() do
Expand Down

0 comments on commit 563028a

Please sign in to comment.