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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Ken’ichiro Oyama
August 25, 2025
Technology
0
140
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
4.6k
Design and implementation of "Markdown to Google Slides" / phpconfuk 2025
k1low
1
750
analysis パッケージの仕組みの上でMulti linter with configを実現する / Go Conference 2025
k1low
1
610
ソフトウェア開発におけるインターフェイスという考え方 / PHPerKaigi 2025
k1low
12
6.1k
Parsing HCL/CUE / Fukuoka.go #21
k1low
0
10k
実践 net/http Middleware パターン / Kizuku.go Vol.1
k1low
2
410
Cleanup handling in Go / Go Conference 2024
k1low
7
4.1k
CI/CDがあたりまえの今の時代にAPIテスティングツールに求められていること / CI/CD Test Night #7
k1low
18
12k
Command-line interface tool design / PHPerKaigi 2024
k1low
8
3.7k
Other Decks in Technology
See All in Technology
GitHub Copilot CLI で Azure Portal to Bicep
tsubakimoto_s
0
180
頼れる Agentic AI を支える Datadog のオブザーバビリティ / Powering Reliable Agentic AI with Datadog Observability
aoto
PRO
0
260
モジュラモノリス導入から4年間の総括:アーキテクチャと組織の相互作用について / Architecture and Organizational Interaction
nazonohito51
3
1.5k
Tebiki Engineering Team Deck
tebiki
0
27k
「通るまでRe-run」から卒業!落ちないテストを書く勘所
asumikam
2
460
スピンアウト講座03_CLAUDE-MDとSKILL-MD
overflowinc
0
990
Phase09_自動化_仕組み化
overflowinc
0
1.3k
「コントロールの三分法」で考える「コト」への向き合い方 / phperkaigi2026
blue_goheimochi
0
130
「お金で解決」が全てではない!大規模WebアプリのCI高速化 #phperkaigi
stefafafan
5
2.2k
2026年もソフトウェアサプライチェーンのリスクに立ち向かうために / Product Security Square #3
flatt_security
1
750
SaaSに宿る21g
kanyamaguc
2
130
【Λ(らむだ)】最近のアプデ情報 / RPALT20260318
lambda
0
160
Featured
See All Featured
sira's awesome portfolio website redesign presentation
elsirapls
0
200
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
240
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
エンジニアに許された特別な時間の終わり
watany
106
240k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
450
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.4k
Optimising Largest Contentful Paint
csswizardry
37
3.6k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
140
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.2k
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/ 共に働く仲間を募集しています