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
Flight recorder at the application layer (NOT t...
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Ken’ichiro Oyama
August 25, 2025
Technology
0
130
Flight recorder at the application layer (NOT the FlightRecoder newly added at Go 1.25) / Fukuoka.go #22
https://fukuokago.connpass.com/event/364970/
Ken’ichiro Oyama
August 25, 2025
Tweet
Share
More Decks by Ken’ichiro Oyama
See All by Ken’ichiro Oyama
Introducing RFC9111 / YAPC::Fukuoka 2025
k1low
2
2.5k
Design and implementation of "Markdown to Google Slides" / phpconfuk 2025
k1low
1
620
analysis パッケージの仕組みの上でMulti linter with configを実現する / Go Conference 2025
k1low
1
560
ソフトウェア開発におけるインターフェイスという考え方 / PHPerKaigi 2025
k1low
11
6k
Parsing HCL/CUE / Fukuoka.go #21
k1low
0
10k
実践 net/http Middleware パターン / Kizuku.go Vol.1
k1low
2
390
Cleanup handling in Go / Go Conference 2024
k1low
7
4k
CI/CDがあたりまえの今の時代にAPIテスティングツールに求められていること / CI/CD Test Night #7
k1low
18
12k
Command-line interface tool design / PHPerKaigi 2024
k1low
8
3.6k
Other Decks in Technology
See All in Technology
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
93k
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.4k
【Oracle Cloud ウェビナー】[Oracle AI Database + AWS] Oracle Database@AWSで広がるクラウドの新たな選択肢とAI時代のデータ戦略
oracle4engineer
PRO
2
180
広告の効果検証を題材にした因果推論の精度検証について
zozotech
PRO
0
210
[CV勉強会@関東 World Model 読み会] Orbis: Overcoming Challenges of Long-Horizon Prediction in Driving World Models (Mousakhan+, NeurIPS 2025)
abemii
0
150
クレジットカード決済基盤を支えるSRE - 厳格な監査とSRE運用の両立 (SRE Kaigi 2026)
capytan
6
2.8k
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
590
Context Engineeringの取り組み
nutslove
0
370
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.6k
外部キー制約の知っておいて欲しいこと - RDBMSを正しく使うために必要なこと / FOREIGN KEY Night
soudai
PRO
12
5.6k
CDK対応したAWS DevOps Agentを試そう_20260201
masakiokuda
1
370
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
720
Featured
See All Featured
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
67
Design in an AI World
tapps
0
140
So, you think you're a good person
axbom
PRO
2
1.9k
4 Signs Your Business is Dying
shpigford
187
22k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
1
57
How to make the Groovebox
asonas
2
1.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
760
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
GitHub's CSS Performance
jonrohan
1032
470k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
The browser strikes back
jonoalderson
0
390
Transcript
Flight recorder at the application layer (NOT the FlightRecoder newly
added at Go 1.25) ⼩⼭健⼀郎 / Tailor Inc. 2025.8.25 Fukuoka.go #22
• Go 1.25で runtime/trace 追加された機能 ◦ https://pkg.go.dev/runtime/trace#FlightRecorder • トレースデータのサイズや継続的な書き込みコストから従来の実⾏トレースキャプチャでは実⽤的でな かった稀なイベントのデバッグに役にたつ軽量な実⾏トレースキャプチャ。
• 仕組みとしては実⾏トレースをインメモリのリングバッファに継続的に記録し、重要なイベントが発⽣し た際に、FlightRecorder.WriteTo を呼び出すことで、直近のトレースをファイルに書き出す。 • 直前の、必要なトレースのみをキャプチャできるため、⽣成されるトレースが⼤幅に⼩さくなる。 ◦ 従来の実⾏トレースのように⾼コストではないため、常に有効にしやすい。 • FlightRecorderConfig 内で、キャプチャする期間やデータ量を設定できる runtime/trace.FlightRecorder 2
• goroutine creation/blocking/unblocking (Goroutineの作成/ブロック/ブロック解除) • syscall enter/exit/block (System callの⼊⼒/終了/ブロック) •
GC-related events (GC 関連イベント) • changes of heap size (ヒープサイズの変更) • processor start/stop (プロセッサの開始/停⽌) • etc. runtime/trace で取得できるトレースデータ 3
• エラーが発⽣したときに原因を特定したい • コードのどこでエラーになったのか • エラーになるまでにどのような処理をしていたのか • (OSSのCLIツールとして提供しているのでOtelは使いにくい) つまり、スタックトレースや実⾏ログが欲しい アプリケーションレイヤで欲しいトレースデータ
4
• エラー時にスタックトレースと直前のログをまとめてファイルに書き出す ◦ 全てのログは必要ない。 https://pkg.go.dev/runtime/trace#FlightRecorder と同じ • ログは LogLevel=Debug な詳細なログが欲しい
アプリケーションレイヤのFlight recorder 5
スタックトレース 6
• https://github.com/k1LoW/errors • errors + stack staces. • 実装コンセプトは ◦
Retain the stack traces once stacked as far as possible. ▪ Support for errors.Join. ◦ It is possible to output stack traces in structured data. ◦ Zero dependency k1LoW/errors 7
直前のデバッグログ 8
• ユーザがログレベルをハンドリングするログハンドラと、Flight recorder⽤のログハンドラの2つに分ける ◦ Flight recorder⽤のログは常に LogLevel=Debug • log/slog だと
https://github.com/samber/slog-multi を使うと良い まずログを分岐する 9
• https://github.com/k1LoW/tail • 直近N⾏だけを保持する io.Writer を満たす実装 k1LoW/tail 10
11 完成
12
少し実⽤的で⼩さなOSSを書くのが趣味 • GitHub: @k1LoW • X: @k1LoW • SWE at
Tailor Inc. ⾃⼰紹介 13 Ken'ichiro Oyama ⼩⼭健⼀郎
14 わたしたちは、"Empower every company to deploy any ideas (誰もがデプロイできる社会を創る)" というミッ
ションのもと、誰しもがプロダクト開発の担い⼿になることができる社会の実現を⽬指しています。ミッション の実現に向けて、共に挑戦する仲間を募集しています。 https://careers.tailor.tech/ 共に働く仲間を募集しています