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
890
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
240
40代エンジニアの生活の変化とキャリアの歩み
tomohide_tanaka
0
1.4k
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
6.1k
CircleCI Server運用のポイント / Point of CirlceCI Server operation
tomohide_tanaka
1
620
Other Decks in Technology
See All in Technology
「タコピーの原罪」から学ぶ間違った”支援” / the bad support of Takopii
piyonakajima
0
150
もう外には出ない。より快適なフルリモート環境を目指して
mottyzzz
14
11k
Raycast AI APIを使ってちょっと便利なAI拡張機能を作ってみた
kawamataryo
0
190
abema-trace-sampling-observability-cost-optimization
tetsuya28
0
380
ヘンリー会社紹介資料(エンジニア向け) / company deck for engineer
henryofficial
0
420
[re:Inent2025事前勉強会(有志で開催)] re:Inventで見つけた人生をちょっと変えるコツ
sh_fk2
1
980
20251029_Cursor Meetup Tokyo #02_MK_「あなたのAI、私のシェル」 - プロンプトインジェクションによるエージェントのハイジャック
mk0721
PRO
6
2k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
0
390
From Natural Language to K8s Operations: The MCP Architecture and Practice of kubectl-ai
appleboy
0
370
アウトプットから始めるOSSコントリビューション 〜eslint-plugin-vueの場合〜 #vuefes
bengo4com
3
1.9k
実践マルチモーダル検索!
shibuiwilliam
1
430
20251027_マルチエージェントとは
almondo_event
1
480
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Docker and Python
trallard
46
3.6k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.5k
Balancing Empowerment & Direction
lara
5
700
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
2.9k
How to train your dragon (web standard)
notwaldorf
97
6.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.2k
RailsConf 2023
tenderlove
30
1.3k
Context Engineering - Making Every Token Count
addyosmani
8
310
4 Signs Your Business is Dying
shpigford
186
22k
Building an army of robots
kneath
306
46k
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