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 Visualization of usage status
Search
dehio3
August 23, 2019
Technology
0
720
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
40代エンジニアの生活の変化とキャリアの歩み
tomohide_tanaka
0
840
AWSソリューションを活用して 1ヶ月で動画配信機能をリリースした話 / The story of releasing the Video distribution service in one month using AWS solutions
tomohide_tanaka
1
1.3k
GitHub Actionsで Terraformをplan&applyしてみた / I tried to plan and apply Terraform with GitHub Actions
tomohide_tanaka
5
5.2k
CircleCI Server運用のポイント / Point of CirlceCI Server operation
tomohide_tanaka
1
530
Other Decks in Technology
See All in Technology
ビジネスロジックを「型」で表現するOOPのための関数型DDD / Functional And Type-Safe DDD for OOP
yuitosato
29
12k
中央集権体制からDataOpsへの転換 / centralized-to-dataops-transformation
pei0804
7
1.5k
Getting started with controlling LEGO using Swift
hcrane
0
130
検証からプロダクトへ: シームレスなLLM開発の ためのしくみ作り
nunukim
1
200
データマネジメントを支える武器としてのメタデータ管理
10xinc
2
830
オブジェクト指向宗教史
tanakahisateru
14
12k
ビジネスとコード品質の接合点 そしてコード品質がそこに及ぼす影響 / The Intersections of Business and Engineering, and The Impact of Code Quality There
mtx2s
10
1k
Building a RAG app to chat with your data (on Azure)
pamelafox
0
100
私のRSpecの書き方 / How I write RSpec
tmtms
4
840
Vos logs méritent mieux que la config par défaut
lyrixx
2
360
データ品質をコード化! LINEヤフーのMLOpsを最適化する "ACP Data Quality" の紹介
lycorptech_jp
PRO
2
230
Autopsy of a Cascading Outage from a MySQL Crashing Bug
jfg956
0
200
Featured
See All Featured
Web development in the modern age
philhawksworth
201
10k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
113
18k
Pencils Down: Stop Designing & Start Developing
hursman
115
11k
Building Flexible Design Systems
yeseniaperezcruz
317
37k
Six Lessons from altMBA
skipperchong
19
2.9k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
Designing for Performance
lara
601
67k
Git: the NoSQL Database
bkeepers
PRO
421
63k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
240
1.2M
Keith and Marios Guide to Fast Websites
keithpitt
407
22k
Fashionably flexible responsive web design (full day workshop)
malarkey
397
65k
Testing 201, or: Great Expectations
jmmastey
27
6.3k
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