0
我正在使用sidekiq Pro並通常在他們的Web UI上監視我的工作人員的進程。無論什麼時候出現錯誤,任務都將移動到顯示隊列名稱和錯誤消息的Retries選項卡。問題是我想將數據添加到此消息(特別是類名和行號),但是我沒有在任何地方找到有關此信息。是否可以編輯/配置Web UI顯示?如果是這樣,怎麼樣?更改或添加數據到Sidekiq Web UI
我正在使用sidekiq Pro並通常在他們的Web UI上監視我的工作人員的進程。無論什麼時候出現錯誤,任務都將移動到顯示隊列名稱和錯誤消息的Retries選項卡。問題是我想將數據添加到此消息(特別是類名和行號),但是我沒有在任何地方找到有關此信息。是否可以編輯/配置Web UI顯示?如果是這樣,怎麼樣?更改或添加數據到Sidekiq Web UI
是否可以編輯/配置Web UI顯示?如果是這樣, 怎麼樣?
是的,這是可能的。實現其他監控信息的一種方法是構建自定義UI頁面。你會需要定義一個包含模塊請求處理邏輯和寄存器模塊作爲Sidekiq網頁:
module WebAddition
def self.registered(app)
app.get('/desired_path') do
# you can define @instance_variables for passing into template
# Sidekiq uses erb for its templates so you should do it aswell
erb File.read(path_to_desired_erb_file)
end
end
end
# here we instruct Sidekiq to take our UI extension onboard
Sidekiq::Web.register WebAddition
# in case you want to provide localization, it's achieved here
Sidekiq::Web.locales << File.expand_path(File.dirname(__FILE__) + "/web/locales")
# the name of your tab (at the left hand) gonna be translated
# using the provided locale file (if any).
# right hand of the equation should be equal to the path you specified
# in registered() method
Sidekiq::Web.tabs['disappeared_jobs'] = 'desired_path'
另一種選擇(雖然極力不推薦)可能是猴補丁Sidekiq UI代碼本身。看看課程,改變你感興趣的方法並更新位於web/views文件夾中的* .erb文件。