-
Notifications
You must be signed in to change notification settings - Fork 481
perf regression guard detox #9835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf regression guard detox #9835
Conversation
- Add iOS/Android Detox configs and e2e perf regression test (3-run loop) - Add perf-ci runners (debug/release/daemon), thresholds, Slack notification - Improve performance-server: /api/health, session overview index - Add docs and launchd templates
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
All alerts resolved. Learn more about Socket for GitHub. This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
Head branch was pushed to by a user without write access
|
处理一下冲突哦 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
PR 说明:Perf Regression Guard(Detox + performance-server)
TL;DR(这次 PR 做了什么)
我们在仓库内落地了一套“自动化性能回归守护”的基础设施,用 Detox 作为编排器,在固定测试设备上重复跑基准场景,并基于 perf sessions(performance-server)做聚合与阈值判断,超阈值/失败时可发 Slack 告警。
覆盖平台:
核心产物:
yarn perf:*development/perf-ci/thresholds/*$HOME/perf-sessions/sessions.overview.jsonlPR 范围
x(base:origin/x)xeon/perf-regression-guard-ios-detoxdevelopment/perf-ci/(runner + docs + launchd 模板 + thresholds)apps/mobile/e2e/(Detox Jest 测试 + Metro warmup)apps/mobile/.detoxrc.js(iOS/Android Detox 配置)development/performance-server/(health + session overview)背景与目标
背景可参考:
development/output/perf-regression-guard-ios-detox.md我们已经有一套 perf 数据采集/落盘能力:
packages/shared/src/performance/*development/performance-server/*缺口在于:缺少“可持续、可重复、自动化”的基准跑测与回归预警机制。
本 PR 的目标:
总体设计
1) performance-server(常驻)
yarn perf:server$HOME/perf-sessions/api/health(runner 用来做健康检查与 outputDir 一致性校验)sessions.overview.jsonl:2) Detox e2e(单测负责 3-run loop)
Jest 测试:
apps/mobile/e2e/perf-regression-guard.test.js每轮 run:
device.launchApp({ newInstance: true })sessionId目录<sessionId>/mark.log,等待 mark:Home:refresh:done:tokensAFTER_MARK_DELAY_MS收尾,再device.terminateApp()Debug 模式:
apps/mobile/e2e/globalSetup.js会做 Metro ready + warmup bundling(避免首次 bundle 太慢导致 app 侧报 “Could not connect to development server”)reverseTcpPort(8081)(设备侧 localhost:8081 -> 宿主机 8081)3) perf-ci job runner(负责构建/跑测/derive/阈值/Slack)
iOS:
development/perf-ci/run-ios-perf-detox-debug.jsdevelopment/perf-ci/run-ios-perf-detox-release.jsdevelopment/perf-ci/run-ios-perf-detox-release-daemon.js(interval daemon)Android:
development/perf-ci/run-android-perf-detox-debug.jsdevelopment/perf-ci/run-android-perf-detox-release.jsdevelopment/perf-ci/run-android-perf-detox-release-daemon.js(interval daemon)runner 负责:
runs.json)development/performance-server/cli/derive-session.js指标与阈值(当前实现)
阈值文件:
development/perf-ci/thresholds/ios.debug.jsondevelopment/perf-ci/thresholds/ios.release.jsondevelopment/perf-ci/thresholds/android.debug.jsondevelopment/perf-ci/thresholds/android.release.json当前用于回归判断的指标(MVP):
tokensStartMs:Home:refresh:start:tokens的 timestamptokensSpanMs:Home:refresh:done:tokens - Home:refresh:start:tokensfunctionCallCount:function_call.log行数策略:
strategy=median(3 次 run 取 median,大于阈值则触发 regression)two_of_three如何运行(本地/CI/定时)
详细使用说明见:
development/perf-ci/README.md常用命令(repo root):
常用环境变量:
PERF_SESSIONS_DIR(默认:$HOME/perf-sessions)PERF_SERVER_URL(默认:http://localhost:9527,仅用于 health check / 启停 server)SLACK_WEBHOOK_URL(可选)DETOX_DEVICE_UDID(推荐 pin iOS simulator)DETOX_ANDROID_AVD_NAME(推荐 pin Android AVD)可选本地配置文件(避免 env vars):
development/perf-ci/config.local.json(已 gitignore)定时任务(launchd)
本 PR 提供模板:
development/perf-ci/launchd/perf-server.plist:常驻 perf-serverdevelopment/perf-ci/launchd/ios-perf-job.plist:定时跑 iOS job安装方式与注意事项写在:
development/perf-ci/README.mdAndroid 定时:
ios-perf-job.plist复制一份,将 ProgramArguments 改为yarn perf:android:release --headless输出与排查
Perf sessions:
$HOME/perf-sessions/<sessionId>/...$HOME/perf-sessions/sessions.overview.jsonl(session 概览索引)Job 输出:
development/perf-ci/output/<jobId>/report.jsondevelopment/perf-ci/output/<jobId>/derived/*.jsondevelopment/perf-ci/output/<jobId>/detox/runs.json备注与限制(当前假设)
PERF_SESSIONS_DIR目录默认假设“单机串行写入”。如果并行跑多个 job 并写到同一个目录,可能会导致 sessionId 误匹配(需要后续增强:加 platform 校验/更强的 session 归属判定)。