SlideShare a Scribd company logo
fluent-plugin-resque_stat

                @Spring_MT




13年2月15日金曜日
Profile
                  Twitter : @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_stat
              Resqueの状態をfluentdに投げるインプットプ
              ラグイン

        pending       キューの残数
        processed     取り出したキューの総数
        queues        登録されてるキューの名前の総数
        workers       キューを取り出すworkerの数
        working       キューを処理中のworker数
        failed        失敗したキュー数
        servers       resqueが動いてるサーバーのhostやportの情報
                      resque_statが動いているサーバーの RAILS_ENV or
        environment
                      RACK_ENV(なければdevelopmentが入る)
13年2月15日金曜日
fluent-plugin-resque_stat
             ikachanで見ると




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 1
  end


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日金曜日
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).co
      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
  end
end

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日金曜日
ローカルでgem install
$ 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...


13年2月15日金曜日
まとめ(一応)


    テストを書くためだけに
              プラグインにしても
              良いと思います!
13年2月15日金曜日
13年2月15日金曜日

More Related Content

PDF
#31 愛しのst2
PDF
PDF
Programming camp 2010 debug hacks
PDF
Debug Hacks at Security and Programming camp 2011
PDF
perl5の日付時刻処理とか
PDF
capistrano-colorized-stream
PDF
20130413 qpstudy Chef邪道編
PDF
Lessfs をかじってみた(小江戸らぐオフな集まり第110回)
#31 愛しのst2
Programming camp 2010 debug hacks
Debug Hacks at Security and Programming camp 2011
perl5の日付時刻処理とか
capistrano-colorized-stream
20130413 qpstudy Chef邪道編
Lessfs をかじってみた(小江戸らぐオフな集まり第110回)

Viewers also liked (12)

PDF
Rubyでプリキュアを作った #cure_advent #shibuyarb
PDF
プリキュアのRuby実装の紹介 #RubyHiroba
PDF
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
PDF
First step of Rails Contribute‎ #shibuyarb
PDF
初心者エンジニアのシステム構築失敗談
PDF
Fluentd meetup #2
PDF
DB技術[実践]入門を読んだ
PDF
MySQL カジュアル 福岡 03
PDF
Fluentd in Co-Work
PDF
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
PDF
PayPal Big Data and MySQL Cluster
PDF
Fluentd Meetup #2 @外道父 Fluentdを優しく見守る監視事例
Rubyでプリキュアを作った #cure_advent #shibuyarb
プリキュアのRuby実装の紹介 #RubyHiroba
プリキュアハッカソン2 参加者アンケート集計結果 #cure_hack
First step of Rails Contribute‎ #shibuyarb
初心者エンジニアのシステム構築失敗談
Fluentd meetup #2
DB技術[実践]入門を読んだ
MySQL カジュアル 福岡 03
Fluentd in Co-Work
Resemaraを支えた技術 フライングゲットガチャの舞台裏 #ksgstudy #ドリコム
PayPal Big Data and MySQL Cluster
Fluentd Meetup #2 @外道父 Fluentdを優しく見守る監視事例
Ad

Similar to fluent-plugin-resque_stat (7)

ODP
etckeeperをopenSUSEの公式リポジトリに入れたいぞ! Ver.2
PDF
プログラミング学習のための学習
PDF
Sacss sp5
PDF
20130719 始めるdev ops
PDF
WordBench Osaka 春の大翻訳祭り
PDF
開発エンジニアがChefで テスト駆動サーバー設定してみた #biglobetechtalk
PDF
Js kusen
etckeeperをopenSUSEの公式リポジトリに入れたいぞ! Ver.2
プログラミング学習のための学習
Sacss sp5
20130719 始めるdev ops
WordBench Osaka 春の大翻訳祭り
開発エンジニアがChefで テスト駆動サーバー設定してみた #biglobetechtalk
Js kusen
Ad

More from Makoto Haruyama (12)

PPTX
Rails on GKEで運用するWebアプリケーションの紹介
PDF
マイクロサービスっぽい感じの話
PDF
DeNAオリジナル ゲーム専用プラットフォーム Sakashoについて
PDF
DeNAのゲーム開発を支える Game Backend as a Service
PDF
backbone.jsの使用例 その1
KEY
初心者エンジニアの システム構築 失敗談
KEY
Mysql casual fukuoa_vlo_2
KEY
Yapc2012 ltthon
KEY
分散ファイルストレージ
KEY
Automation tech casual_talks_1_20120717
KEY
My sql casual_in_fukuoka_vol1
PPTX
20110622 haruyama webso]cket
Rails on GKEで運用するWebアプリケーションの紹介
マイクロサービスっぽい感じの話
DeNAオリジナル ゲーム専用プラットフォーム Sakashoについて
DeNAのゲーム開発を支える Game Backend as a Service
backbone.jsの使用例 その1
初心者エンジニアの システム構築 失敗談
Mysql casual fukuoa_vlo_2
Yapc2012 ltthon
分散ファイルストレージ
Automation tech casual_talks_1_20120717
My sql casual_in_fukuoka_vol1
20110622 haruyama webso]cket

fluent-plugin-resque_stat