-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP リクエストヘッダを指定できる様にするためにオプションパラメータを受け付ける #1
Conversation
ee1de01
to
0b9161b
Compare
0b9161b
to
653b7bf
Compare
@@ -0,0 +1,3 @@ | |||
machine: | |||
ruby: | |||
version: 2.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gem::InstallError: public_suffix requires Ruby version >= 2.1.
Gem::InstallError: strptime requires Ruby version ~> 2.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.1 はもう EOL を迎えたので、2.2 以上で良いような。
https://www.ruby-lang.org/ja/downloads/
gem の CI は複数バージョンの Ruby の指定が簡単な https://travis-ci.org/ がお手軽なイメージです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
travis
わかります。雛形で作った(と思わしき)設定ファイルが残っているところとかも気持ち悪さが若干あったりします。
2.1 はもう EOL を迎えたので、2.2 以上で良いような。
CI を通す以上の理由はなかったです。
td-agent 同梱の Ruby のバージョンも把握できておらず、今回は CI 通すだけのバージョン指定とさせてもらいたいです。
@@ -17,13 +17,14 @@ def format(tag, time, record) | |||
|
|||
def write(chunk) | |||
chunk.msgpack_each do |(tag,time,record)| | |||
request(record['url'], record['body']) | |||
options = record['options'] || {} | |||
request(record['url'], record['body'], options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``` Gem::InstallError: public_suffix requires Ruby version >= 2.1. Gem::InstallError: strptime requires Ruby version ~> 2.0. ```
fc36246
to
4c4c35f
Compare
あまり把握はできていないのですが、 bugsnag/bugsnag-ruby#411 で Session tracking という機能が実装され、それ関連で必要になったのですかね。 |
@@ -0,0 +1,3 @@ | |||
machine: | |||
ruby: | |||
version: 2.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2.1 はもう EOL を迎えたので、2.2 以上で良いような。
https://www.ruby-lang.org/ja/downloads/
gem の CI は複数バージョンの Ruby の指定が簡単な https://travis-ci.org/ がお手軽なイメージです。
@@ -36,13 +37,22 @@ def request(url, body) | |||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE | |||
end | |||
|
|||
request = Net::HTTP::Post.new(path(uri), {"Content-Type" => "application/json"}) | |||
headers = options.key?('headers') ? options['headers'] : {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 option の中から 'headers'
だけ頂く。それ以外は捨てる。
@koshigoe あまり重要ではありませんが、 #1 (comment) だけ気になりました。CI を通す程度で良ければ、そのままでもかまわないです。 |
わたしも詳細把握してませんが、そんな感じですね。 |
この PR はこの状態でマージしてしまいます。 |
Bugsnag::Delivery::{DeliverClass}#deliver
の第四引数options
(Hash)を使って HTTP リクエストヘッダを指定する実装がある。https://github.com/bugsnag/bugsnag-ruby/blob/44c6ab14d7b82f6ed39109225897e7e49927085c/lib/bugsnag/delivery/synchronous.rb#L43-L44
https://github.com/bugsnag/bugsnag-ruby/blob/44c6ab14d7b82f6ed39109225897e7e49927085c/lib/bugsnag.rb#L117-L119
bugsnag-delivery-fluent でも同様に HTTP リクエストヘッダを options 引数経由で受け渡しできる様にする前提で、このプラグインを拡張する。