Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Grafana エコシステムの活用事例 on ABEMA

tetsuya28
October 10, 2024

Grafana エコシステムの活用事例 on ABEMA

tetsuya28

October 10, 2024
Tweet

More Decks by tetsuya28

Other Decks in Technology

Transcript

  1. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    1 Grafana エコシステムの活用事例 on ABEMA 2024 Oct 10th tetsuya28
  2. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    2 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  3. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    3 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  4. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    4 山本 哲也 2021 年新卒 AbemaTV - E.M. of Developer Productivity X : @_tetsuya28 Kubernetes / Anthos Service Mesh / OpenTelemetry / Grafana / Terraform Developer Productivity 自己紹介
  5. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    5 最近のトピック 9 月末にサンフランシスコで行われた DPE SUMMIT に参加してきました DPE = Developer Productivity Engineering 自己紹介
  6. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    7 話すこと / 話さないこと ❏ 目標 ❏ 家に帰って Grafana を触ってみようと思えるきっかけを作る ❏ 話すこと ❏ ABEMA における Grafana 周りの構成 ❏ ABEMA における活用事例 / 展望 ❏ 話さないこと ❏ Grafana エコシステム以外の周辺技術 ❏ 視聴者数などのビジネスに関わる非公開の数値
  7. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    8 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  8. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    10 10 ABEMA とは 引用元 : 新しい未来のテレビ「ABEMA」、週間視聴者数が3,000万を突破
  9. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    11 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  10. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ※ 2021 年時点 ❏ ABEMA のインフラ構成の概念図 12 ABEMA のインフラ ABEMA における監視とは Micro Services Micro Services Micro Services API Gateways region: ap-northeast-1 AWS Cloud Micro Services CloudFront Micro Services Ingress Micro Services Edge Proxies Kubernetes Cluster App Mesh Micro Services Micro Services Micro Services API Gateways Micro Services Ingress region: asia-east1 Micro Services Cloud CDN Micro Services Edge Proxies Kubernetes Cluster Anthos Service Mesh Micro Services Micro Services Micro Services API Gateways Micro Services Ingress region: asia-northeast1 Micro Services Cloud CDN Micro Services Edge Proxies Kubernetes Cluster Anthos Service Mesh Plain mTLS
  11. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    13 ABEMA のインフラ その他参考記事 AbemaTV:Google Cloud の活用による徹底した負荷対策によって世界的スポーツ イベントにおいて安定した視聴体験を提供 300以上のマイクロサービスを支えるマルチクラウドアーキテクチャ戦略 | ABEMA Developer Conference 2021 引用元 : AWS 導入事例: 株式会社 AbemaTV 引用元 : Google Cloud Day ’23 Tour ABEMA における監視とは
  12. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    14 ABEMA の監視インフラ region: asia-east1 region: asia-northeast1 Grafana VictoriaMetrics storage VictoriaMetrics insert VictoriaMetrics select Micro Services Micro Services Micro Services Remote Write Remote Write Prometheus Prometheus Prometheus ABEMA における監視とは
  13. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    15 メトリクス Total Data Points 23+ Trillion Active Time Series 10+ Million Data Point Ingest Rate 450+ K/s Data Size 20 TiB ABEMA における監視とは
  14. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    16 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  15. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    17 まずは... Grafana エコシステムの活用事例 15 この数字なんだか分かりますか?
  16. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    18 まずは... 15 この数字なんだか分かりますか? Grafana OSS | Visualization and dashboarding technology Grafana エコシステムの活用事例
  17. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    19 まずは... いくつ知っていましたか? Grafana エコシステムの活用事例
  18. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    20 まずは... いくつ使ったことありますか? Grafana エコシステムの活用事例
  19. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    21 まずは... いくつ使いこなせてますか? Grafana エコシステムの活用事例
  20. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    22 ABEMA で利用しているツール Grafana エコシステムの活用事例 ❏ Grafana ❏ Grafana Loki ❏ Grafana Tempo ❏ Grafana Agent ❏ Grafana Alloy ❏ Grafana k6 ❏ Grafana Pyroscope ❏ Prometheus ❏ OpenTelemetry
  21. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    23 ABEMA で利用しているツール Grafana エコシステムの活用事例 ❏ Grafana — 可視化 ❏ Grafana Loki — ログ集約 ❏ Grafana Tempo — 分散トレーシングバックエンド ❏ Grafana Agent — 情報収集エージェント ( 非推奨 ) ❏ Grafana Alloy — Grafana 向け OpenTelemetry distribution ❏ Grafana k6 — 負荷試験 ❏ Grafana Pyroscope — プロファイリング ❏ Prometheus — メトリクス収集 ❏ OpenTelemetry — オブザーバビリティフレームワーク
  22. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    24 ABEMA で利用しているツール Grafana エコシステムの活用事例 ❏ Grafana — 可視化 ❏ Grafana Loki — ログ集約 ❏ Grafana Tempo — 分散トレーシングバックエンド ❏ Grafana Agent — 情報収集エージェント ( 非推奨 ) ❏ Grafana Alloy — Grafana 向け OpenTelemetry distribution ❏ Grafana k6 — 負荷試験 ❏ Grafana Pyroscope — プロファイリング ❏ Prometheus — メトリクス収集 ❏ OpenTelemetry — オブザーバビリティフレームワーク
  23. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    25 課題 ① Grafana エコシステムの活用事例 ❏ 課題 ❏ サービス / コンポーネントがどのような状態なのか分からない ❏ 解決方法 ❏ メトリクスでサービスの状態を統計情報として可視化する ❏ アラートのデータソースとしてメトリクスを利用している ❏ 一方で、基本的に統計情報以上の情報は取れない メトリクス、ログ、トレースをうまく使い分けて可観測性を高めよう! - Speaker Deck
  24. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    26 Prometheus Grafana エコシステムの活用事例 Prometheus Monitoring OSS | Store large amounts of metrics
  25. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    27 Prometheus によるシステムメトリクスの可視化 Grafana エコシステムの活用事例
  26. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    28 Prometheus によるビジネスメトリクスの可視化 Grafana エコシステムの活用事例
  27. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    29 Prometheus 推しポイント Grafana エコシステムの活用事例 ❏ Prometheus Agent Mode を採用することで ランニングコストと管理コストの削減を実現している ❏ メトリクスのカテゴリごとに Prometheus を分離していたが Prometheus Agent Mode を用いることで全てのメトリクスを 1 つの Prometheus で収集できている Introducing Prometheus Agent Mode, an Efficient and Cloud-Native Way for Metric Forwarding
  28. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    30 Prometheus 推しポイント Grafana エコシステムの活用事例 ❏ Prometheus Agent Mode での負荷試験 ❏ の話はまた別の機会に是非 https://x.com/cloudnativedays/status/1715306877305974839
  29. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    31 課題 ② Grafana エコシステムの活用事例 ❏ 課題 ❏ メトリクスだけだと何が起こったのか分からない ❏ 解決方法 ❏ ログを使ってイベントを可視化する
  30. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    32 Grafana Loki とは Grafana エコシステムの活用事例 Grafana Loki OSS | Log aggregation system
  31. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    33 Grafana Loki のユースケース Grafana エコシステムの活用事例 ❏ マイクロサービス / Kubernetes のログを集約する ❏ Promtial や Grafana Agent が回収した各種ログの集約先として利用 A Region - Amazon EKS A Region - Google Kubernetes Engine B Region - Google Kubernetes Engine 全てを Loki に集約することによる認知負荷の削減 ( 願望 ) B Region - Amazon EKS
  32. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ ログとメトリクスを同時に見る 34 Grafana Loki のユースケース Grafana エコシステムの活用事例
  33. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ Ad-hoc statistics によりログの統計情報を可視化できる ❏ 特定のクラスタやノードで起きているなどの分析が可能になる 35 Grafana Loki 推しポイント Grafana エコシステムの活用事例
  34. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    36 課題 ③ Grafana エコシステムの活用事例 ❏ 課題 ❏ 何故問題が起こったのか分からない ❏ 解決方法 ❏ トレースを使ってボトルネックや問題箇所を特定する
  35. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    37 Grafana Tempo とは Grafana エコシステムの活用事例 Grafana Tempo OSS | Distributed tracing backend
  36. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    38 Grafana Tempo 周辺のインフラ構成 Grafana エコシステムの活用事例 Google Kubernetes Engine OpenTelemetry Collector Grafana Tempo Amazon EKS OpenTelemetry Collector マイクロサービス マイクロサービス OpenTelemetry Operator OpenTelemetry Operator Google Kubernetes Engine
  37. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    39 トレースの計装方針 Grafana エコシステムの活用事例 ❏ ABEMA では OpenTelemetry ベースの計装に切り替え中 ❏ マルチクラウドを利用しているためベンダーニュートラルな OpenTelemetry を採用している ❏ 多段構成の OpenTelemetry を用いた tail-based 構成も本番環境へ導入中
  38. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    40 Grafana Tempo のユースケース Grafana エコシステムの活用事例 ❏ 特定のリクエストや条件に関連するリクエストを可視化 ❏ ログやメトリクスでは可視化できないボトルネックを見つけることができる
  39. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    41 Grafana Tempo 推しポイント Grafana エコシステムの活用事例 ❏ なんか...かっこいい!!
  40. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    42 Grafana Tempo 推しポイント Grafana エコシステムの活用事例 ❏ TraceQL でトレースからメトリクスを生成できる ❏ 例 : status=error のスパン数のメトリクス
  41. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    43 課題 ④ Grafana エコシステムの活用事例 ❏ 課題 ❏ どの実装がボトルネックになっているのか分からない ❏ 解決方法 ❏ プロファイルを使ってコードレベルでのボトルネックを把握する
  42. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    44 Grafana Pyroscope とは Grafana エコシステムの活用事例
  43. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ パフォーマンス / ボトルネックを可視化する ❏ コードの処理レベルでボトルネックを把握する ❏ 送信間隔を指定できるので OOM のような突発的な状態も可視化できる 45 Grafana Pyroscope のユースケース Grafana エコシステムの活用事例
  44. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    46 Grafana Pyroscope の使い方 Grafana エコシステムの活用事例 ❏ Explore でプロファイルを確認できる
  45. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ 実装が手軽にできる ❏ Go では最低限、以下の実装を追加するだけ 47 Grafana Pyroscope 推しポイント Grafana エコシステムの活用事例 pyroscope.Start(pyroscope.Config{ ApplicationName: "sample", ServerAddress: "pyroscope:4040", UploadRate: 10 * time.Second, ProfileTypes: []pyroscope.ProfileType{ pyroscope.ProfileCPU, }, })
  46. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    48 Grafana Pyroscope 推しポイント Grafana エコシステムの活用事例 ❏ Pyroscope の UI だと比較も手軽にできる
  47. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    49 課題 ⑤ Grafana エコシステムの活用事例 ❏ 課題 ❏ アプリケーションに手を加えられないけどボトルネックを見つけたい ❏ Grafana に依存しない形でプロファイルを取得したい ❏ 解決方法 ❏ pprof を用いてプロファイルを可視化する
  48. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    50 Grafana Alloy とは Grafana エコシステムの活用事例
  49. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    51 Grafana Alloy のユースケース Grafana エコシステムの活用事例 ❏ pprof のデータを Grafana Pyroscope に送信する ❏ Grafana Pyroscope の SDK 仕込めない場合に利用している MicroServices MicroServices
  50. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    52 Grafana Alloy のユースケース Grafana エコシステムの活用事例 ABEMA で利用している PipeCD の改善に利用 “about 10x 〜 20x faster when triggering 50 deployments simultaneously.” Use singleflight to clone/update repository cache by Warashi · Pull Request #5171 · pipe-cd/pipecd Performance improvement in Git operations on PipeCD v0.48.9
  51. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    53 課題 ⑥ Grafana エコシステムの活用事例 ❏ 課題 ❏ 今までのソリューションを 1 カ所で利用したい ❏ 解決方法
  52. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    54 課題 ⑥ Grafana エコシステムの活用事例 ❏ 課題 ❏ 今までのソリューションを 1 カ所で利用したい ❏ 解決方法 Grafana OSS and Enterprise | Grafana documentation
  53. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    55 Grafana とは Grafana エコシステムの活用事例 Grafana OSS | Leading observability tool for visualizations & dashboards
  54. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    56 Grafana のユースケース Grafana エコシステムの活用事例 ❏ あらゆるデータを可視化するためのプラットフォーム ❏ Explore ❏ 欲しいデータをオンデマンドに検索 ❏ Dashboard ❏ あらゆるデータをまとめて確認 ❏ Alerting ❏ 収集しているメトリクスを元にアラートを通知 ❏ RBAC ❏ 社内認証基盤とユーザ情報 / 権限を同期
  55. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    57 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ 様々な Data sources に対応している ❏ Built-in でも 18 個 ❏ ABEMA でも MySQL や BigQuery を利用している Data sources | Grafana documentation Four Keys ( MySQL ) FinOps ( BigQuery )
  56. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    58 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ Annotation でデプロイ状況を可視化
  57. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    59 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ Annotation でデプロイ状況を可視化 ❏ Grafana HTTP API で登録 ❏ メトリクスから生成 ❏ Otelcol のバージョン更新を Annotation として表示する例 sum by (service_version) (otelcol_receiver_accepted_spans{}) unless ( sum by (service_version) (otelcol_receiver_accepted_spans{}) offset 1m )
  58. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    60 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ 時系列をずらしての描画も簡単にできる ❏ 今週と先週のメトリクスを描画している例
  59. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    61 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ 時系列をずらしての描画も簡単にできる ❏ offset を追加するだけ
  60. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    62 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ ダッシュボードの表現力の強さ ❏ 例 : 時刻表時に曜日を入れられる Grafana の時刻表時に曜日を付け加える
  61. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    63 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ Library panels でよく使うパネルをテンプレート化できる ❏ ダッシュボードを作成する際に 1 クリックでパネルを作成できる
  62. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    64 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ Alerting の送信先をカスタマイズできる ❏ ABEMA では独自のプロキシを webhook で挟むことで紐付いているダッ シュボードやパネルを元に画像の生成やリンクなどの生成を行っている
  63. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    65 Grafana 推しポイント Grafana エコシステムの活用事例 ❏ Terraform provider が整備されている ❏ アラートもテンプレート化 ❏ 開発者が最低限の記述で作成
  64. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    66 課題 ⑦ Grafana エコシステムの活用事例 ❏ 課題 ❏ サービス監視の準備ができたので試しに負荷をかけてみたい ❏ 解決方法 ❏ Grafana k6 を用いた負荷試験の実施
  65. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    67 Grafana k6 とは Grafana エコシステムの活用事例 Grafana k6 | Open source load testing tool
  66. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ 単体負荷試験から大規模負荷試験まで様々な場面で活用 68 68 Grafana K6 による負荷試験 Grafana エコシステムの活用事例 引用元 : FIFA ワールドカップ 2022に向けたキャパシティ確保の軌跡 | ABEMA Developer Conference 2023
  67. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    69 その他 Tips Grafana エコシステムの活用事例 ❏ OpenTelemetry や Tempo 側の負荷試験が辛い ❏ そんなあなたに telemetrygen ❏ https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/cmd/telemetrygen
  68. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    70 その他 Tips Grafana エコシステムの活用事例 ❏ telemetrygen $ telemetrygen traces --otlp-insecure --duration 10s --rate 500 --workers 10
  69. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    71 目次 ❏ 自己紹介 ❏ ABEMA とは ❏ ABEMA における監視とは ❏ Grafana エコシステムの活用事例 ❏ まとめ
  70. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    72 今後の理想像 まとめ ABEMA では全部使いこなせて完璧なのか?
  71. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    ❏ オブザーバビリティ 4 本柱に橋を架ける ❏ いまは柱が立っているだけ、それぞれを繋ぐことで誰もがどこからでも対応 できる世界を作る → オブザーバビリティの民主化 74 今後の理想像 まとめ 引用元 : Traces and telemetry | Grafana Tempo documentation
  72. AbemaTV, Inc. All Rights Reserved
 AbemaTV, Inc. All Rights Reserved


    75 さいごに まとめ Grafana で試したいことありましたでしょうか?