Upload
makoto-haruyama
View
1.538
Download
1
Embed Size (px)
DESCRIPTION
Citation preview
fluent-plugin-resque_stat
@Spring_MT
13年2月15日金曜日
ProfileTwitter : @Spring_MT
所属 :10xlab
http://10xlab.jp (FBページ)
13年2月15日金曜日
Resque
Resque
githubで使われてるRubyベースのジョブキュー ライブラリ
バックエンドはredis
13年2月15日金曜日
fluent-plugin-resque
fluentdからResqueにキューを送るoutputプラグイン
セコンさん謹製
13年2月15日金曜日
fluent-plugin-resque_statResqueの状態をfluentdに投げるインプットプラグイン
pending キューの残数
processed 取り出したキューの総数
queues 登録されてるキューの名前の総数
workers キューを取り出すworkerの数
working キューを処理中のworker数
failed 失敗したキュー数
servers resqueが動いてるサーバーのhostやportの情報
environmentresque_statが動いているサーバーの RAILS_ENV or
RACK_ENV(なければdevelopmentが入る)
13年2月15日金曜日
fluent-plugin-resque_statikachanで見ると
13年2月15日金曜日
何でプラグインを書くのか?
13年2月15日金曜日
最初はexecプラグインですまそうかと思った
13年2月15日金曜日
#!/usr/bin/env ruby # encoding: UTF-8
require 'resque'Resque.redis = "127.0.0.1:6379"while Resque.info sleep 1end
13年2月15日金曜日
できた!!
13年2月15日金曜日
テスト!13年2月15日金曜日
テスト書きますよね。。。
13年2月15日金曜日
どうやって書こうかな。。。(´・ω・`)
13年2月15日金曜日
テスト書きたい!
13年2月15日金曜日
プラグインにしちゃえ!!
13年2月15日金曜日
Fluent::Test::InputTestDriver
13年2月15日金曜日
Fluent::Test::InputTestDriver
簡単に説明すると newしてインスタンス作って、runすればfluentdが動く
emitsでデータ取得すれば、あとはそれをcheckするだけ!
13年2月15日金曜日
#!/usr/bin/env ruby # encoding: UTF-8
require 'fluent/test'require File.dirname(__FILE__) + '/spec_helper'
DEFAULT_CONFIG = %[ tag test host 127.0.0.1 port 6379 run_interval 1s]describe Fluent::ResqueStatInput do before { Fluent::Test.setup } context 'test_emit' do it do d = Fluent::Test::InputTestDriver.new(Fluent::ResqueStatInput).configure(DEFAULT_CONFIG) d.run do sleep 2 end emits = d.emits emits.length.should > 0 emits[0][0].should eql('test') emits[0][2].keys.should eql(['pending',]) end endend
13年2月15日金曜日
13年2月15日金曜日
で、よく考えたら。。。
13年2月15日金曜日
execで呼び出すそのscriptにテストはありますか?
13年2月15日金曜日
テストを書くためにプラグインにしてもいいのでは?
13年2月15日金曜日
Rubyわかんない。。。。
13年2月15日金曜日
確かに。。。。
最初はperl脳とかで書いて後で直すとかでもいいのでは?
13年2月15日金曜日
テスト > 見た目
13年2月15日金曜日
公開できない。。。。
13年2月15日金曜日
Bundler使っていれば、githubのパスは指定できるが。。
13年2月15日金曜日
$ git clone git://github.com/SpringMT/fluent-plugin-resque_stat.git test$ cd test$ gem build fluent-plugin-resque_stat.gemspec Successfully built RubyGem Name: fluent-plugin-resque_stat Version: 0.0.5 File: fluent-plugin-resque_stat-0.0.5.gem$ gem install fluent-plugin-resque_stat-0.0.5.gem Successfully installed fluent-plugin-resque_stat-0.0.5 1 gem installed Installing ri documentation for fluent-plugin-resque_stat-0.0.5... Installing RDoc documentation for fluent-plugin-resque_stat-0.0.5...
ローカルでgem install
13年2月15日金曜日
テストを書くためだけにプラグインにしても良いと思います!
まとめ(一応)
13年2月15日金曜日
13年2月15日金曜日