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
CircleCI_Serverの利用状況を可視化した話 / CircleCI Server ...
Search
dehio3
August 23, 2019
Technology
0
860
CircleCI_Serverの利用状況を可視化した話 / CircleCI Server Visualization of usage status
CircleCI ユーザーコミュニティミートアップ 【LT会】
https://circleci.connpass.com/event/140666/
dehio3
August 23, 2019
Tweet
Share
More Decks by dehio3
See All by dehio3
とっ散らかったログバケットを S3バッチオペレーションで整理整頓 / Organizing disordered log buckets using S3 Batch Operations
tomohide_tanaka
0
220
40代エンジニアの生活の変化とキャリアの歩み
tomohide_tanaka
0
1.3k
AWSソリューションを活用して 1ヶ月で動画配信機能をリリースした話 / The story of releasing the Video distribution service in one month using AWS solutions
tomohide_tanaka
1
1.4k
GitHub Actionsで Terraformをplan&applyしてみた / I tried to plan and apply Terraform with GitHub Actions
tomohide_tanaka
6
6k
CircleCI Server運用のポイント / Point of CirlceCI Server operation
tomohide_tanaka
1
610
Other Decks in Technology
See All in Technology
Nonaka Sensei
kawaguti
PRO
3
530
Monorepo Error Management: Automated Runbooks and Team-Targeted Alert Distribution
biwashi
1
140
Introduction to Sansan, inc / Sansan Global Development Center, Inc.
sansan33
PRO
0
2.6k
堅牢な認証基盤の実現 TypeScriptで代数的データ型を活用する
kakehashi
PRO
1
170
ソフトウェア開発現代史: "LeanとDevOpsの科学"の「科学」とは何か? - DORA Report 10年の変遷を追って - #開発生産性_findy
takabow
1
330
kotlin-lsp を Emacs で使えるようにしてみた / use kotlin-lsp in Emacs
nabeo
0
110
上長や社内ステークホルダーに対する解像度を上げて、より良い補完関係を築く方法 / How-to-increase-resolution-and-build-better-complementary-relationships-with-your-bosses-and-internal-stakeholders
madoxten
13
6.5k
AIコーディング新時代を生き残るための試行錯誤 / AI Coding Survival Guide
tomohisa
8
10k
Whats_new_in_Podman_and_CRI-O_2025-06
orimanabu
3
160
dbt Cloudの新機能を紹介!データエンジニアリングの民主化:GUIで操作、SQLで管理する新時代のdbt Cloud
sagara
0
160
Securing your Lambda 101
chillzprezi
0
190
やさしい認証認可
minorun365
PRO
29
11k
Featured
See All Featured
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
Why Our Code Smells
bkeepers
PRO
337
57k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
35
2.3k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
233
17k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
How to train your dragon (web standard)
notwaldorf
92
6.1k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
130
19k
Rails Girls Zürich Keynote
gr2m
94
14k
VelocityConf: Rendering Performance Case Studies
addyosmani
329
24k
Transcript
CircleCI Serverの 利用状況を可視化した話 CircleCI ユーザーコミュニティミートアップ #6
自己紹介 Tanaka Tomohide • twitter: @dehio3 • blog:https://www.dehio3.com/ • 音響屋→インフラエンジニア
• CircleCI運用歴:10ヶ月 2
はじめに 3
注意 Workflow、OrbsなどCircle機能の話は 一切出ません!! (そもそもオンプレはOrbs対応してない) 4
CircleCI Serverの 利用状況を可視化した話
CircleCI Serverとは • オンプレミス版のCircleCI • AWS上で利用可能 • 構築用のTerraformが提供 ◦ https://github.com/circleci/enterprise-setup
6
可視化の背景 7
顧客からこんな依頼が 「チーム毎での利用比率を取れない?」 8
なぜ? • ライセンス費は年払い • ユーザー数分ライセンス費がかかる • 利用してるチーム毎に予算を振り分けたい 9
こんなものを作った 10
CircleCIコスト按分ダッシュボード 11
構成 12
lambda + S3 + Athena + Redash 13
ポイント • APIを利用し日次でビルド情報を収集 • AthenaでJSONデータをテーブル化 • Redashにてテーブルデータを可視化 14
ポイント • APIを利用し日次でビルド情報を収集 • AthenaでJSONデータをテーブル化 • Redashにてテーブルデータを可視化 15
APIの選択 / resent-builds API実行時から指定のビルド情報を取得 16
https://circleci.com/docs/api/#recent-builds-across-all-projects
APIの選択 / limitパラメータ • マニュアルでは「Maixmum 100」とあるがオンプレ は制限なし? • limitを大きめの5000にして、取りこぼしのないよう にビルド情報を取得
17
ビルド日時の判断 • ビルド情報を集計する時に日付の判断が必要 • 「queued_at」からビルドの実施日を判断 • 実施日毎でJSONファイルを作成 "queued_at" : "2013-02-12T21:33:30Z"
// time build was queued "start_time" : "2013-02-12T21:33:38Z", // time build started "stop_time" : "2013-02-12T21:34:01Z", // time build finished 18
JSONファイルの管理 作成したJSONファイルはS3で管理 19
ポイント • APIを利用し日次でビルド情報を収集 • AthenaでJSONデータをテーブル化 • Redashにてテーブルデータを可視化 20
JSON用ライブラリでのテーブル作成 CREATE EXTERNAL TABLE circleci_buids_data ( username string, // GitHubのorganization
build_url string, status string, // ビルドのステータス queued_at timestamp, start_time timestamp, stop_time timestamp, build_time_millis int // ビルド走行時間 ) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' LOCATION 's3://<バケット名>/' 21
そのままテーブルを参照するとエラー 日付の取得でERRORが発生する Error running query: HIVE_BAD_DATA: Error parsing field value
'2019-04-11T14:45:00.417Z' for field 3: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff] 22
テーブル作成時はstring型 ”Athena は、Java の TIMESTAMP 形式「YYYY-MM-DD HH:MM:SS.fffffffff」 (小数点以下 9 桁)
を必要とします。 データが必須の TIMESTAMP 形式でない場合は、列を STRING として定義し、次に Presto の日付と時刻の関数を使用してフィー ルドを DATE または TIMESTAMP としてクエリ内に読み取りま す。” https://aws.amazon.com/jp/premiumsupport/knowledge-center/query-table-athena- timestamp-empty/ 23
最終的なテーブル作成クエリ CREATE EXTERNAL TABLE circleci_buids_data ( username string, // GitHubのorganization
build_url string, status string, // ビルドのステータス queued_at string, start_time string, stop_time string, build_time_millis int // ビルド走行時間 ) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe' LOCATION 's3://<バケット名>/' 24
ポイント • APIを利用し日次でビルド情報を収集 • AthenaでJSONデータをテーブル化 • Redashにてテーブルデータを可視化 25
string型をtimestamp型に変換 “注意: データが ISO 8601 形式である場合は、操作を進める前に from_iso8601_timestamp() 関数を使用してデータを TIMESTAMP に変換してください。”
https://aws.amazon.com/jp/premiumsupport/knowledge-center/query-table-athena- timestamp-empty/ 26
string型をtimestamp型に変換 from_iso8601_timestamp関数を使用して、参照時にtimestamp型に 変換 SELECT queued_at, typeof(queued_at) as "type", from_iso8601_timestamp(queued_at) as
"queued_at timestamp", typeof(from_iso8601_timestamp(queued_at)) as "type" FROM circleci_buids_data; 27
Redash上でのクエリ 28 https://github.com/kakakakakku/redash-hands-on
CircleCIコスト按分ダッシュボード 29
こんなデータも可視化 30
日毎のOrganization別ビルド数 31
曜日別、時間帯別ビルド数 32
ビルドステータス推移(success以外) 33
まとめ 34
まとめ 35 • APIを使って簡単にビルド情報が取れる • AthenaとBIツールでJSONデータを簡単に可視化 できる • ビルド状況の可視化する事で、チームの活動状 況を把握する事ができる
Thank you!! 36