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
380
〇〇を切り出したいときに / 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
6
1.7k
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
connect-go で面倒くささと戦う / 2024-08-27 #newmo_layerx_go
izumin5210
2
760
コンパウンドプロダクト開発の質とスピードを支える Protobuf と Connect #アーキテクチャ_findy / Boosting Compound Product Development Efficiency with Protobuf and Connect
izumin5210
12
2.7k
GraphQLサーバの構成要素を整理する #ハッカー鮨 #tsukijigraphql / graphql server technology selection
izumin5210
4
1.2k
Next.js App Router を例に考える、技術選定・技術との距離感 #技術選定_findy / findy 2024-01-24
izumin5210
14
6.1k
雑なコード生成のすすめ #nihonbashijs 8 / zatsu-code-generation
izumin5210
0
84
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
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
.NET のための通信フレームワーク MagicOnion 入門 / Introduction to MagicOnion
mayuki
1
1.4k
Content Security Policy入門 セキュリティ設定と 違反レポートのはじめ方 / Introduction to Content Security Policy Getting Started with Security Configuration and Violation Reporting
uskey512
1
530
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
CSC509 Lecture 11
javiergs
PRO
0
180
レガシーシステムにどう立ち向かうか 複雑さと理想と現実/vs-legacy
suzukihoge
14
2.2k
CSC509 Lecture 12
javiergs
PRO
0
160
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
最新TCAキャッチアップ
0si43
0
140
Outline View in SwiftUI
1024jp
1
320
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
44
2.2k
5 minutes of I Can Smell Your CMS
philhawksworth
202
19k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.5k
The Invisible Side of Design
smashingmag
298
50k
What's in a price? How to price your products and services
michaelherold
243
12k
Code Review Best Practice
trishagee
64
17k
Side Projects
sachag
452
42k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.3k
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
͖ͭͮ Ͱʂ