Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
新卒2ヶ月目で起こしたインシデントの話
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Toranosuke Ujike
December 07, 2023
Programming
1.1k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
新卒2ヶ月目で起こしたインシデントの話
人生初の登壇!
2023年ヒヤリハット大反省会@新宿 で発表した
Toranosuke Ujike
December 07, 2023
More Decks by Toranosuke Ujike
See All by Toranosuke Ujike
Apollo Sandbox における 認証トークンの自動適用
torabit
0
240
Other Decks in Programming
See All in Programming
巨大モノリシックアプリ モダン化大作戦
ktcryomm
0
360
Laravelのアプリケーションをどこにデプロイするか #ツナギメオフライン.9
akase244
0
120
不幸な GC
chencmd
0
900
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
アクセシビリティから考える情報設計
high_g_engineer
0
350
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.6k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
310
Press start. Python's next generation.
willingc
PRO
3
330
【高い買い物LT会】初任給で話題の国産フィジカルAIを買った話
akagami
PRO
0
130
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
910
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
140
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
BBQ
matthewcrist
89
10k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
890
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Test your architecture with Archunit
thirion
2
2.4k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Design in an AI World
tapps
1
310
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
45k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Transcript
© 2023 Wantedly, Inc. 新卒2ヶ月目で起こした インシデントの話 2023年ヒヤリハット大反省会 @新宿 Toranosuke Ujike
/ @tora_tora_bit
自己紹介 氏家 虎之介 (Ujike Toranosuke) フロントエンドエンジニアとして、 Wantedly Visitを主にUI 面から改善することで、ユーザー、企業への提供価値を向 上させている。
© 2023 Wantedly, Inc. 所属: Wantedly, inc. X: @tora_tora_bit ある特定の技術領域に縛られないことをモットーに、 現在は優秀な同期と共にバックエンドについて学習中。
インシデントの内容 メッセージ機能を修正する施策を担当 © 2023 Wantedly, Inc.
やばい Wantedlyのメッセージ送信機能を壊した © 2023 Wantedly, Inc.
ステージング環境での検証や テストを書いて確認したのになぜ © 2023 Wantedly, Inc.
根本原因 RubyのHashから値を取得する際の Key指定を間違えていた © 2023 Wantedly, Inc.
Ruby Rubyには文字列とシンボルの 2つの異なるデータ型がある © 2023 Wantedly, Inc.
シンボルを使ったHash © 2023 Wantedly, Inc. user = { name: "Tora",
age: 26, city: "Kyoto" } result = user["name"] result.inspect # nil ruby 文字列で指定した場合 キーとして使われているのはシンボル 文字列で "name" を指定しても 対応するキーが存在しないため nil が返される
正しくはこう © 2023 Wantedly, Inc. user = { name: "Tora",
age: 26, city: "Kyoto" } result = user[:name] result.inspect # "Tora" ruby シンボルで指定した場合 要素へのアクセスにはHashのキーとして 使用されているデータ型を正確に指定する必要がある
実際に何が起こっていたのか © 2023 Wantedly, Inc. user = UserHashService.compose!( # hashを作成
name: name, age: age, city: city, ) # user hashのkeyはシンボルで宣言されているため文字列で指 定できない name = user["name"] age = user["age"] city = user["city"] let(:user) { # モックデータ { "name" => "Tora", "age" => 26, "city" => "Kyoto", } } … allow(UserHashService).to receive(:compose!).and_return(user) … it "user test" do name = { user["name"] } expect(name).to eq("Tora") # モックデータのキーとして扱われているのは文字列なのでテストが通る end 例) user_message_service.rb 例) user_message_service_spec.rb
根本原因 都合の良いモックデータを与えてしまっていた © 2023 Wantedly, Inc.
マージまでの流れ 1. PRを作成 2. ステージング環境で検証 3. 問題ないことを確認してレビュー依頼 4. レビューを受けて修正 5.
テストが通ることを確認 6. PRのレビューを再依頼 7. Approveをもらう 8. マニュアルテストをせずに翌日にマージ インシデント発生 © 2023 Wantedly, Inc.
レビューを貰ったあとに ステージング環境で検証を行っていない © 2023 Wantedly, Inc.
PRマージ後 1. インシデント発生 ◦ Honeybadgerがエラーを拾ってSlackで通知 2. 上司が出社 ◦ エラーを確認 ◦
周囲のエンジニアに周知 3. インシデント対応 ◦ Rollback ◦ 対象のPRをRevert 4. インシデント解消 © 2023 Wantedly, Inc.
よかったこと • インシデントを起こした数十分後に上司が出社した ◦ 上司と同期的に密なコミュニケーションがとれた • リリース後の監視がうまくワークした ◦ ユーザー問い合わせ前の内部発見に繋がった •
毎週金曜日に行われている All Hands Meeting 前に気づけた ◦ 復旧作業を他のエンジニアと協力して迅速に行えた ◦ 焦ることなく、行うべき一次対応に集中できた © 2023 Wantedly, Inc.
Wantedlyの障害対応の心構えについて Wantedly Engineering Handbook © 2023 Wantedly, Inc.
Wantedly Engineering Handbook © 2023 Wantedly, Inc. 新しくWantedlyの開発チームに参加する人向けのドキュメン ト 社内のエンジニアが知るべき情報のうち外部にも公開できる情
報を体系的にまとめたもの
Wantedly Engineering Handbook © 2023 Wantedly, Inc. インシデントを起こす前日に更新
Wantedly Engineering Handbook © 2023 Wantedly, Inc. 障害を起こした人に向けてのセクションが加筆されている
インシデントを起こしたあとに ドキュメントに残す文化が深く根付いている © 2023 Wantedly, Inc. Wantedlyの文化
ポストモーテムとは © 2023 Wantedly, Inc. 失敗から学ぶために振り返りを行うこと
ポストモーテムを実施しての気づき そもそもテストの書き方がよくないのでは🤔 © 2023 Wantedly, Inc.
都合の良いモックデータを与えたことが本当の原因なのか 🤔 © 2023 Wantedly, Inc. UserHashService は内部で UserService を使い
User の情報を引っ張って きている 本来は UserHashService の返り値をモックするのではなく UserService の返り値をモックしてあげるべきなのでは? そもそもモックせずに UserService から取得した User のデータ をそのまま使うことはできなかったのか?
本当の根本原因 テストの書き方が問題ということに気づいた © 2023 Wantedly, Inc.
再発防止のために • すぐに取り組みができること ◦ すべてのPRにおいてマージ前後の動作確認やアラートチェックを欠かさない ◦ テストファイルの見直し • 時間をかけて改善すること ◦
結合テストの導入 © 2023 Wantedly, Inc. 大きく2つある
なにを学んだか • 電気通信事業者の場合メッセージ機能を停止させてしまうと官庁報告が必要 な場合がある • リリース前後にマニュアルテストをすることの重要性 • なにか異変に気づいたら報告することの大切さ • 再発防止のためにポストモーテムを実施することの大切さ
© 2023 Wantedly, Inc.
まとめ © 2023 Wantedly, Inc. • テストファイルの書き方は大切 ◦ 自分を疑うためのテストを書け •
マニュアルテストも大切 • インシデントが発生した場合にドキュメントに残す文化の偉大さ • インシデントを起こしてしまったことで過度に責められることはない • 優しい言葉をいただけたお陰でメンタルが安定した
ご清聴ありがとうございました © 2023 Wantedly, Inc. おわり