Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
〇〇を切り出したいときに / Extract something from big rails...
Search
Masayuki Izumi
July 29, 2018
Programming
0
390
〇〇を切り出したいときに / Extract something from big rails app
TokyuRuby会議12 での飛び入り LT 資料です
http://regional.rubykaigi.org/tokyu12/
Masayuki Izumi
July 29, 2018
Tweet
Share
More Decks by Masayuki Izumi
See All by Masayuki Izumi
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
9
4.3k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.5k
connect-go で面倒くささと戦う / 2024-08-27 #newmo_layerx_go
izumin5210
2
810
コンパウンドプロダクト開発の質とスピードを支える Protobuf と Connect #アーキテクチャ_findy / Boosting Compound Product Development Efficiency with Protobuf and Connect
izumin5210
12
2.8k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
1.2k
Next.js App Router を例に考える、技術選定・技術との距離感 #技術選定_findy / findy 2024-01-24
izumin5210
14
6.2k
雑なコード生成のすすめ #nihonbashijs 8 / zatsu-code-generation
izumin5210
0
91
React Server Components で複雑さに立ち向かう #コンポーネント_findy / findy 2023-10-04
izumin5210
10
3.3k
みんなで育てる GraphQL スキーマ, それを支える Protobuf / GraphQL and Protobuf #tech_stand
izumin5210
8
3.7k
Other Decks in Programming
See All in Programming
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
Criando Commits Incríveis no Git
marcelgsantos
2
170
ブラウザ単体でmp4書き出すまで - muddy-web - 2024-12
yue4u
2
460
快速入門可觀測性
blueswen
0
320
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
300
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
DevFest Tokyo 2025 - Flutter のアプリアーキテクチャ現在地点
wasabeef
5
900
CSC509 Lecture 14
javiergs
PRO
0
130
The Efficiency Paradox and How to Save Yourself and the World
hollycummins
1
440
talk-with-local-llm-with-web-streams-api
kbaba1001
0
170
Discord Bot with AI -for English learners-
xin9le
1
120
fs2-io を試してたらバグを見つけて直した話
chencmd
0
220
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
The Language of Interfaces
destraynor
154
24k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Practical Orchestrator
shlominoach
186
10k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
How STYLIGHT went responsive
nonsquared
95
5.2k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Transcript
ʓʓΛΓग़͍ͨ͠ͱ͖ʹ ͓͓͖ΊͷϦϑΝΫλΛΔPO3BJMTʢʁʣ TokyuRubyKaigi #12 !J[VNJO 2018.7.29 -
izumin5210 Engineer at Wantedly, Inc. Wantedly People ‣ Web Application
Engineer - Profile Data Strategy Group ‣ Interests in developer productivity on microservices Gopher, Rubyist, JavaScripter and Androider
˓˓ΛΓग़͍ͨ͠ɾҠߦ͍ͨ͠ ͍·Θͤͦ͏ͳ࣮ %# .PEFM ػೳ γεςϜͷҰ෦
ςετΛॻ͜͏ ϩάΛͱΖ͏ ͍͞͠ΐʹߟ͑Δ͜ͱ
ςετΛॻ͜͏ ͦͦςετϦϑΝΫλϦϯάͷͨΊʹ͋Δʢۃʣ ίʔυ͕յΕΔͱςετ͕མͪͯؾ͚ͮͯศར ͳ͔ͬͨΒؤுͬͯॻ͘ʢنʹΑͬͯఘΊ؊৺ʣ ϩάΛͱΖ͏
͍͞͠ΐʹߟ͑Δ͜ͱ
ςετΛॻ͜͏ ϩάΛͱΖ͏ Ͳ͏͍͏ܦ࿏Ͱར༻͞ΕΔ͔ɼͲΕ͘Β͍ར༻͞ΕΔ͔ ͦͦESPQͰ͖ͳ͍͔ յΕͦ͏ͳͱ͜ΖͷςετΛॏతʹॻ͚Δ
͍͞͠ΐʹߟ͑Δ͜ͱ
DBMMFSΛه͢Δ ࡶʹϩάΛཷΊࠐΊΔπʔϧɾαʔϏεΛ͏ ƁŞƄŪžUJQT
DBMMFSΛه͢Δ ͡ `Thread.current[:controller] = controller_name`͠ͱ͘ͱศར ͋͘·ͰҰ࣌తͳϩάऩूͳͷͰɼਖ਼͠͞खܰ͞ɾརศੑ
ࡶʹϩάΛཷΊࠐΊΔπʔϧɾαʔϏεΛ͏ ƁŞƄŪžUJQT caller.find do |c| !c.to_s.start_with?(Bundler.bundle_path.to_s) && c.to_s.start_with?(Rails.root.to_s) end
DBMMFSΛه͢Δ ࡶʹϩάΛཷΊࠐΊΔπʔϧɾαʔϏεΛ͏ ʮϨεϙϯεʹӨڹΛ༩͑ͳ͍ʯॏཁ ͍͍ײ͡ʹCVGGFSJOHͨ͠ΓඇಉظͰσʔλૹͬͯ͘ΕΔ܅Λ͔ͭ͏ fluent-logger-ruby
td-logger-ruby FUD Ұ࣌తͳϩάऩूͳͷͰɼਖ਼͠͞खܰ͞ɾརศੑେͳ͜ͱͳͷͰʢ͈́ ƁŞƄŪžUJQT
DBMMFSΛه͢Δ ࡶʹϩάΛཷΊࠐΊΔπʔϧɾαʔϏεΛ͏ ʮϨεϙϯεʹӨڹΛ༩͑ͳ͍ʯॏཁ ͍͍ײ͡ʹCVGGFSJOHͨ͠ΓඇಉظͰσʔλૹͬͯ͘ΕΔ܅Λ͔ͭ͏ qVFOUMPHHFSSVCZ
UEMPHHFSSVCZ FUD Ұ࣌తͳϩάऩूͳͷͰɼਖ਼͠͞खܰ͞ɾརศੑେͳ͜ͱͳͷͰʢ͈́ ƁŞƄŪžUJQT caller_app = caller.find do |c| !c.to_s.start_with?(Bundler.bundle_path.to_s) && c.to_s.start_with?(Rails.root.to_s) end TD.event.post("hoge_log", { caller_app: caller_app, request_controller: Tread.current[:request_controller], request_action: Tread.current[:request_action], # sinp. }) Կߟ͑ͣʢUFTUBCJMJUZʹӨڹΛ༩͑ͣʣɼࡶʹϩά͛ΒΕΔͷ3VCZ͔ͩΒͦ͜
DBMMFSΛه͢Δ ࡶʹϩάΛཷΊࠐΊΔπʔϧɾαʔϏεΛ͏ ʮϨεϙϯεʹӨڹΛ༩͑ͳ͍ʯॏཁ ͍͍ײ͡ʹCVGGFSJOHͨ͠ΓඇಉظͰσʔλૹͬͯ͘ΕΔ܅Λ͔ͭ͏ qVFOUMPHHFSSVCZ
UEMPHHFSSVCZ FUD Ұ࣌తͳϩάऩूͳͷͰɼਖ਼͠͞खܰ͞ɾརศੑେͳ͜ͱͳͷͰʢ͈́ ƁŞƄŪžUJQT class ActiveRecrod::Relation def eager_loading? super.tap do |loading| if loading # send logs end end end 3VCZͳͷͰܭଌ༻ίʔυͲ͜ʹͰࠐΊΔ ʢ˞༻͕ࡁΜͩΒফ͠·͠ΐ͏ʣ
ίʔυͷมߋൣғΛ࠷খʹཹΊΔ Ϛϝʹຊ൪ʹग़͢ ෳࡶͳͱ͜ΖΕͳ͍͔ৄ͍͠ਓʹฉ͘ Ͳ͏ͬͯ͢͢ΊΔʁ
ίʔυͷมߋൣғΛ࠷খʹཹΊΔ ΞϓϦ͕σΧ͘ͳΔͱཏతʹมߋ͢Δͷେม FH%#ׂͰAProfileA͕AProfileDb::ProfileAʹͳΓ·͢ͱ͔มߋྔଟ͗ͯ͢ແཧ ϕʔεΫϥεΛม͑ΔʢAApplicationRecordAAProfileRecordAʣͱ͔ͳΒ·ͩΘ͔Δ ӨڹൣғΛࡶʹѲ͢ΔͷʹΫϥεਤॻ͘ͱศར
Ϛϝʹຊ൪ʹग़͢ ෳࡶͳͱ͜ΖΕͳ͍͔ৄ͍͠ਓʹฉ͘ Ͳ͏ͬͯ͢͢ΊΔʁ
ίʔυͷมߋൣғΛ࠷খʹཹΊΔ ΞϓϦ͕σΧ͘ͳΔͱཏతʹมߋ͢Δͷେม FH%#ׂͰAProfileA͕AProfileDb::ProfileAʹͳΓ·͢ͱ͔มߋྔଟ͗ͯ͢ແཧ ϕʔεΫϥεΛม͑ΔʢAApplicationRecordAAProfileRecordAʣͱ͔ͳΒ·ͩΘ͔Δ ӨڹൣғΛࡶʹѲ͢ΔͷʹΫϥεਤॻ͘ͱศར
Ϛϝʹຊ൪ʹग़͢ ෳࡶͳͱ͜ΖΕͳ͍͔ৄ͍͠ਓʹฉ͘ Ͳ͏ͬͯ͢͢ΊΔʁ ػցతʹੜͰ͖Δؾ͢Δ͕ɼͲΕ͘Β͍3VCZͷຐज़ΛͬͯΔ͔ʹґଘ͢Δ ˢͷΫϥεਤHSFQ
ίʔυͷมߋൣғΛ࠷খʹཹΊΔ Ϛϝʹຊ൪ʹग़͢ ҰؾʹΔͱյΕͨͱ͖ʹݪҼڀ໌͕େม ෳࡶͳͱ͜ΖΕͳ͍͔ৄ͍͠ਓʹฉ͘ Ͳ͏ͬͯ͢͢ΊΔʁ
ίʔυͷมߋൣғΛ࠷খʹཹΊΔ Ϛϝʹຊ൪ʹग़͢ ෳࡶͳͱ͜ΖΕͳ͍͔ৄ͍͠ਓʹฉ͘ ͨ·ʔʹʮ͜ΜͳΜઈରແཧΖ͆ʯΈ͍ͨͳͷ͕͋Δ ΊͬͪΌ"SFM͝ʹΐ͝ʹΐͯ͠Δͱ͔ɼΞϓϦͷίΞʹΊͬͪΌґଘͯ͠Δͱ͔
ͦ͏͍͏ͷ༷ͦͦΛΕͳ͍͔ɾଞͷ࣮͕ͳ͍͔ߟ͑Δ υϝΠϯʹৄ͍͠ਓʹͬͯΒ͏ͷ͕٢ Ͳ͏ͬͯ͢͢ΊΔʁ
͍ͪΜॏཁͳϙΠϯτ ʢݸਓతʹʣ
͍ͱےͰԡ͠Δ ظઓʹͳΔͱ৺͕ંΕͦ͏ʹͳΔ ˞͜ͷͱ͖ʢ%#ׂʣͰڧߦಥഁͨ͠ͷͰ͔͢ΓইͰࡁΜͩ
࣮ࡍʹͦͦ͜͜Ͱ͔͍ΞϓϦͰͬͨࣄྫ
࣮ࡍʹͦͦ͜͜Ͱ͔͍ΞϓϦͰͬͨࣄྫ ͜͜ʹه͢ʹ༨ന͕ڱ͗͢Δ
None
͖ͭͮ Ͱʂ