[Refactor][CircleCI] Make extractJobs and extractWorkflows incremental with NewStatefulApiExtractor
メンテナーはふだん 2 日以内に返信
評価
この issue はまだ評価されていません。
説明
What and why to refactor
The CircleCI extractors extractJobs and extractWorkflows use the old api.NewApiExtractor. This extractor reads all rows of the raw table on every run, also on incremental runs. The GitHub, GitLab, Jira and YouTrack plugins already use api.NewStatefulApiExtractor, which reads only the raw rows added since the last successful run.
So the time for each run grows with the size of the raw table, not with the new CI activity. In our instance:
_raw_circleci_api_jobs |
about 9.3M rows (10.3 GB) |
| New raw rows per night | about 166k (almost all from the problem in #9304) |
extractJobs speed |
about 490 rows/s with default MySQL settings |
extractJobs time per run |
about 4.5 hours for one project, every night |
The job extraction writes one row per commit. It uses almost no CPU on the DevLake or MySQL side; the disk sync on each commit sets the speed.
Environment: DevLake v1.0.3-beta14 (the code is the same on main at 351d86738), MySQL 8.4, CircleCI Cloud, nightly incremental blueprint.
Describe the solution you'd like
Change ExtractJobs (backend/plugins/circleci/tasks/job_extractor.go) and ExtractWorkflows (backend/plugins/circleci/tasks/workflow_extractor.go) to api.NewStatefulApiExtractor, the same way as other plugins (for example backend/plugins/github/tasks/pr_extractor.go).
- On an incremental run, the extractor reads only raw rows with
created_at >= since. - On a full sync, or when the configuration changes, it reads all raw rows, as it does now.
- Duplicate raw rows for the same job are safe: the tool-layer key is
(connection_id, workflow_id, id)for jobs and(connection_id, id)for workflows, so a newer row replaces the older one. - Add or update the e2e tests for the two extractors.
With #9304 fixed and this change, extractJobs in our instance would read about 20k rows per night, not 9.3M.
I can start work on a PR for this if the DevLake maintainers approve this approach.
Related issues
- #9304: the "unfinished details" collectors collect the same jobs again without a limit.
- #8907, #8956: earlier fixes in the same collectors.
Additional context
A one-time cleanup of the duplicate raw rows is not part of this change. After both fixes, a full sync removes the old raw rows.
- 主要言語
- Go
- スター
- 3.2k
- フォーク
- 832
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 77
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/devlake のほかの issue
-
[Bug][Jira] collectWorklogs requests every page without startAt, so each page returns the same worklogs (raw table grows quadratically)対応中かも @RyoKusnadi が今日担当しました。 オープンtype/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/devlake#9323 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
[Bug][linker] LinkPrToIssue never matches lowercase issue keys (e.g. in branch names)対応中かも @VictorColomb が 3 日前に担当しました。 オープンtype/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/devlake#9283 · コメント 1 件 · リアクション 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 2 日以内に返信
-
[Bug][Tempo] GET /connections/{id}/teams always fails to decode the teams page, and remote scope search only sees the first 50 teams対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
[Bug][Tempo] A team scope's pipeline adds every Tempo team as a scope and resets their scope config対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
似ている issue
-
area:sampler tech-debt
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
jmbarzee/temporal-architect#302 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
riverqueue/river#1576 ·
メンテナーはふだん 1 日以内に返信
-
NFS StorageProvider renders a missing nfsSubDir as "<no value>"対応中かも @ldming が今日担当しました。 オープンkind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
apecloud/kubeblocks#11067 ·
メンテナーはふだん 1 日以内に返信
-
area:ui bug priority:low
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
RTX payload type is not found when the RTX fmtp line has rtx-time対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信