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
今 SLI/SLO の監視をするなら Sloth が良さそうという話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
kanata
August 04, 2022
Technology
1.3k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
今 SLI/SLO の監視をするなら Sloth が良さそうという話
3-shake SRE Tech Talk #4 (
https://3-shake.connpass.com/event/253028/
) の登壇資料です。LT です。
kanata
August 04, 2022
More Decks by kanata
See All by kanata
ISUCON で使えるツールを作った
shotakitazawa
0
1.4k
CloudNative Days を支える CI/CD ワークフローの変遷
shotakitazawa
2
2.1k
OpenFlow について
shotakitazawa
0
100
Kubernetes で Pod ができるまで
shotakitazawa
3
1.2k
Spinnaker で Blue-Green Deployment やってみた
shotakitazawa
1
1.5k
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
21k
SREへの勘違いに気づいた後の話
tomodakengo
0
160
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
130
EventBridge に「合流」はない ― サーバーレスのワークフローを育てるということ / No Join in EventBridge
yusukeshimizu
2
560
ScotSecure West 2026 - Glasgow
raybugg
0
180
AIエージェントを安全で速い現場監督にする:Jev・Obsidian・メタハーネス
x5gtrn
PRO
0
120
「今盗んで、後で解く」に備える ― AWSのポスト量子暗号入門
yama3133
2
250
CI/CDではもう遅い - 人とAIが迂回しないDevSecOps Verify基盤の再設計 -
kintotechdev
1
270
ほんとうの信頼性はヒーローが死んでからはじまる / True reliability begins after the hero dies
vtryo
0
120
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
300
AWS DevOps Agent スキルをつかいこなそう / Master AWS DevOps Agent Skills
kinunori
1
500
Datadog で始める トークンセーフティなAI 導⼊と定着
vkbaba
1
100
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
35
2.8k
Automating Front-end Workflow
addyosmani
1369
210k
Code Review Best Practice
trishagee
74
20k
The Pragmatic Product Professional
lauravandoore
37
7.5k
Believing is Seeing
oripsolob
1
220
The Language of Interfaces
destraynor
162
27k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
Statistics for Hackers
jakevdp
799
230k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
540
Writing Fast Ruby
sferik
630
63k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
Transcript
今 SLI/SLO の監視をするなら Sloth が良さそうという話 北澤 祥太 / kanata 1
北澤 祥太 / kanata / かなた @kanatakita ShotaKitazawa 趣味: ラーメン、スノボ、自宅鯖構築、イベント裏方
最近: Kubernetes custom controller の実装など $ whoami 2 よく使う アイコン
今日話すこと・話さないこと 話すこと • Sloth というツールで何が出来るのか • Sloth を使うと何が嬉しいのか 話さないこと •
Sloth を実際のプロダクト開発・運用に利用する話 ◦ SLO Review 等のプロセスについて ◦ 特定のプロダクトの特性起因の苦労話について ◦ etc. • 自作の自動化ツールについてのあれこれ 3
今日話すこと・話さないこと 話すこと • sloth というツールで何が出来るのか • sloth を使うと何が嬉しいのか 話さないこと •
sloth を実際のプロダクト開発・運用に利用する話 ◦ SLO Review 等のプロセスについて ◦ 特定のプロダクトの特性起因の苦労話について ◦ etc. • 自作の自動化ツールについてのあれこれ 4 🙇 🙇 🙇
Sloth - Easy and simple Prometheus SLO generator 一言で表すと •
yaml を書くだけで、いい感じの Alerting Rules を出力してくれたり Grafana Dashboard で SLI/SLO をモニタリングできるようになるツール 前提 • Prometheus / Grafana を利用していること • SLI の元となるメトリクスが取得できていること https://github.com/slok/sloth 5
Sloth の設定例 (1/2) 6 https://github.com/slok/sloth/blob/v0.10.0/examples/getting-started.yml version: "prometheus/v1" service: "myservice" labels:
owner: "myteam" repo: "myorg/myservice" tier: "2" slos: - name: "requests-availability" objective: 99.9 description: "Common SLO based on availability for HTTP request responses." sli: events: error_query: sum(rate(http_request_duration_seconds_count{job="myservice",code=~"(5..|429)"}[{{.window}}])) total_query: sum(rate(http_request_duration_seconds_count{job="myservice"}[{{.window}}])) (snip…) {{.window}} にはデフォルトで 5m, 30m, 1h, 2h, 6h, 1d, 3d, 30d が入る 生成される Rules に付与するラベルを指定 目標値を指定 total, error 条件となるクエリを定義
Sloth の設定例 (2/2) 7 https://github.com/slok/sloth/blob/v0.10.0/examples/getting-started.yml slos: - (snip…) alerting: name:
MyServiceHighErrorRate labels: category: "availability" annotations: summary: "High error rate on 'myservice' requests responses" page_alert: labels: severity: pageteam routing_key: myteam ticket_alert: labels: severity: "slack" slack_channel: "#alerts-myteam" 生成される Alerting Rules に付与するラベルを指定 Page レベルの Alerting Rules に付与するラベルを指定 Ticket レベルの Alerting Rules に付与するラベルを指定
Recording Rules の生成 8 sloth.yml rules.yml $ sloth generate -i
sloth.yml --- # Code generated by Sloth (v0.10.0): https://github.com/slok/sloth. # DO NOT EDIT. groups: - name: sloth-slo-sli-recordings-myservice-requests-availability rules: - record: slo:sli_error:ratio_rate5m expr: | (sum(rate(http_request_duration_seconds_count{ job="myservice",code=~"(5..|429)"}[5m]))) / (sum(rate(http_request_duration_seconds_count{ job="myservice"}[5m]))) labels: owner: myteam repo: myorg/myservice sloth_id: myservice-requests-availability sloth_service: myservice sloth_slo: requests-availability sloth_window: 5m tier: "2" - record: slo:sli_error:ratio_rate30m (snip…)
SLO のアラーティング • 以下の閾値の Multiwindow, Multi-Burn-Rate のアラートルールを自動生成 • What advantage
of Multiwindow, Multi-Burn-Rate Alerts? ◦ エラーバジェットの消費速度の傾き (Burn Rate) を用いるため精度が高い ◦ システムを復旧させたのにアラートが止まない問題 (Burn Rate ベースのアラートの特徴) を軽減 詳しくは https://sre.google/workbook/alerting-on-slos/ 9 Severity Long window Short window Burn rate Page 1 day 2 hours 1 3 days 6 hours 1 Ticket 1 hour 5 minutes 14.4 6 hours 30 minutes 6 time window が 1 日, 2 時間のどちらに おいても burn rate が 1 を超える場合に発火
Grafana Dashboard • Sloth が出力する Recording Rules のみを参照する Grafana Dashboard
が提供されている 10 https://sloth.dev/introduction/dashboards/ 現在の Burn rate 残りの Error Budget SLI の推移 Burn Rate の推移 Error Budget の burn down chat
Sloth による一元管理 before after 11 dashboard.json rules.yaml sloth.yml dashboard.json rules.yaml
👍 シングルバイナリで可搬性が高い 👍 validate サブコマンドがあるので CI に組み込みやすい
痒いところに手が届く機能 Recording Rules 用クエリの最適化 • time window の大きい Recording Rule
は、元となるメトリクスの rate 30d を取らず time window の小さい Recording Rule の rate 30d を取る ▪ 多量のデータポイントの読み込まずに算出可能 様々な入力/出力フォーマットに対応 • v0.10.0 現在、以下に対応 ◦ 入力: default, K8s CustomResource, OpenSLO ◦ 出力: Prometheus Recording Rules, K8s CustomResource (for Prometheus Operator) SLI 算出のためのプラグイン機構 • https://github.com/slok/sloth-common-sli-plugins 12
Have a good SRE-Life with Sloth! 13