2016-04-27 24 views
0

私はsidekiq Proを使用しており、通常はWeb UI上で作業者プロセスを監視しています。エラーが発生するたびに、タスクは再試行タブに移動され、キュー名とエラーメッセージが表示されます。このメッセージ(特にクラス名と行番号)にデータを追加したいのですが、どこでもこの情報が見つかりました。 Web UIの表示を編集/設定することは可能ですか?そうなら、どうですか?Sidekiq Web UIにデータを変更または追加する

答えて

0

Web UIの表示を編集/設定できますか?そうだとすれば、 ?

はい、可能です。追加の監視情報を実現する1つの方法は、カスタムUIページを構築することです。要求処理ロジックを含むモジュールを定義し、Sidekiq Webページとしてそのモジュールを登録することができちゃうの必要性:

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コード自体をモンキーパッチすることができます。​​クラスを見て、intrestedしているメソッドを変更し、web/viewsフォルダーにある* .erbファイルに従って更新してください。

関連する問題