[Refactor][CircleCI] Make extractJobs and extractWorkflows incremental with NewStatefulApiExtractor
Los mantenedores suelen responder en 2 días
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 3.2k
- Forks
- 832
- Merge medio
- 1 d 21 h
- PR fusionados (30 d)
- 78
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/devlake
-
[Bug][Testmo] Runs, milestones and automation runs: only the first 100 are collectedPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
[Bug][Tempo] Worklog domain ids lack the connection id, so connections with the same worklog id overwrite each otherPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
[Bug][linker] LinkPrToIssue never matches lowercase issue keys (e.g. in branch names)Posiblemente ocupada @VictorColomb la tomó hace 3 días. Abiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/devlake#9283 · 1 comentario · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 60/100
Los mantenedores suelen responder en 2 días
-
type/bug
Dificultad 4/5 3-5 días Aptitud para principiantes 51/100
Los mantenedores suelen responder en 2 días
Todos los issues de apache/devlake
Issues similares
-
component:obi contribfest go test
Dificultad 2/5 Menos de una hora Aptitud para principiantes 83/100
open-telemetry/opentelemetry-ebpf-instrumentation#4143 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area/ambient
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 1 día
-
kind/cleanup
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
kubernetes-sigs/kueue#18324 ·
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100