[9.3] Speed up telemetry check by sharing a single TS program across roots !! (#267651)#268008
Merged
Merged
Conversation
…!! (elastic#267651) ## Summary The CI telemetry check (`node scripts/telemetry_check`) was creating a separate TypeScript program (`ts.createProgram` + `getTypeChecker()`) for each of the 10 telemetry roots. Since each program independently resolves the same shared Kibana transitive dependencies, this resulted in ~212s of redundant sequential CPU work. This PR: - **Creates a single shared TS program** for all 69 collector files across all roots, then partitions the parsed results back by root - **Parallelizes globbing** across all roots via `Promise.all` - **Extracts `filterCollectorPaths` and `extractCollectorsWithProgram`** as reusable functions ### Benchmark results (local, 3 consistent runs) | Metric | Before | After | Improvement | |--------|--------|-------|-------------| | Total wall time | **210s** | **59s** | **-151s (72%)** | | TS type-check time | 212s (6 programs) | 50s (1 program) | -162s | | Glob phase | 0.7s (sequential) | 0.3s (parallel) | -0.4s | ### Validation - `node scripts/telemetry_check` — passes (no changes mode) - `node scripts/telemetry_check --fix` — passes, correctly detects and fixes schema drift - `schema_checks.test.ts` — all 13 tests pass - `kbn-telemetry-tools` unit tests — all 8 suites / 45 tests pass - Tested with a real collector change (added field to CSP collector) to verify end-to-end detection, fix, and schema JSON update ## Test plan - [ ] CI telemetry check passes on this PR - [ ] Verify telemetry check correctly detects schema drift when a collector is modified - [ ] Verify `--fix` correctly updates the JSON schema files - [ ] Verify `--path` flag still works for scoped checks Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit 010a027)
4 tasks
Contributor
Author
💚 Build Succeeded
Metrics [docs]
cc @shahzad31 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.3:Questions ?
Please refer to the Backport tool documentation