Skip to content

Commit b46c344

Browse files
authored
Sanitize stored log data / 清理存储的日志数据 (#1760)
* fix: redact IPs from public logs and stop exposing database hosts Redact IP addresses, Oracle VCN domains and credentials from server-log text and chart-series endpoint identifiers at ingest, in the public-database copy, and in a dry-run-by-default backfill for stored rows. Tags are HMACs under a per-process random key, so distinct endpoints stay distinct and nothing is reversible. The rules and test vectors match InferenceX's artifact redactor. Drop the database hostname from the agentx-integrity manifest, which was uploaded as a public artifact, and stop printing database hosts in the ingest and recompute workflows. 中文:入库时、复制到公开数据库时,以及通过默认试运行的回填脚本,对服务日志文本和 chart series 端点标识中的 IP 地址、Oracle VCN 域名和凭据进行脱敏。标签为使用每个进程 随机密钥计算的 HMAC,不同端点仍可区分且无法反推。规则和测试向量与 InferenceX 的产物 脱敏工具一致。从作为公开产物上传的 agentx-integrity manifest 中移除数据库主机名,并且 ingest 和 recompute workflow 不再打印数据库主机名。 * chore: tidy log sanitization docs and fixtures 中文:整理日志清理相关文档和测试数据 * refactor: simplify log sanitization 中文:简化日志清理逻辑 * feat: extend log sanitization to promoted runs 中文:将日志清理扩展到推广的运行 * fix: harden log sanitization 中文:加固日志清理 * Catch JWTs, keep pip versions, test the log backfill on the real driver - Redact JWTs, as an HF Xet access token leaked in a stored header dump. - Keep pip's '(9.19.0.56)' installed-version suffix, which was redacted as an IP. - Add both as shared vectors, with a parenthesised public IP and mq_connect_ip still redacted. - Move the backfill loop into backfillLogRedaction so a PGlite test runs it twice on the real driver: dry run writes nothing, rows other than log text stay, and the second run is a no-op. - Port the redaction tests to bun:test and pgliteDriverSql, and test that ingest stores sanitized text and blocks. - Keep the shared vectors out of oxfmt and document what is kept and when the backfill runs. 捕获 JWT(存储的请求头中泄露了 HF Xet 访问令牌),保留 pip 输出中 "(9.19.0.56)" 形式的已安装版本号, 并将两者加入共享测试向量。将回填循环提取为 backfillLogRedaction,在真实驱动上用 PGlite 连续运行两次: 试运行不写入,日志以外的数据保持不变,第二次运行没有任何改动。脱敏相关测试迁移到 bun:test 与 pgliteDriverSql,并新增摄取写入已脱敏文本和数据块的测试。文档说明了保留的内容以及回填的运行时机。 * Redact email addresses in stored logs - Replace email addresses with ***REDACTED***, after URL passwords. A real employee address appeared inside /home/<email>/.cache paths in 3 sampled points. - Keep what only looks like an email: user@host without a letters-only TLD, URL userinfo right after ://, scp-style remotes (git@github.com:org/repo), pkg@1.2.3, @scope/pkg, image digests and decorators. The domain may not continue past a match, so a host is never cut short. - Flip the shared 'compact json url next to an email kept' case (renamed without 'kept') and add cases for each kept shape. InferenceX#5013 has to take the same file and rule. 清理存储日志中的邮箱地址(替换为 ***REDACTED***,在 URL 密码之后处理)。抽样中有 3 个数据点的 /home/<邮箱>/.cache 路径包含一位员工的邮箱。形似邮箱的内容保持不变:没有纯字母顶级域名的 user@host、 紧跟 :// 的 URL 用户信息、git@github.com:org/repo 形式的远程地址、pkg@1.2.3、@scope/pkg、镜像摘要和 装饰器。共享用例 "compact json url next to an email kept" 改为清理邮箱并去掉 kept,同时为每种保留形式 新增用例,InferenceX#5013 需同步更新。 * Catch tokens after colour codes and escapes, and more secret formats - Tokens, IPs and emails right after an ANSI SGR code (\x1b[0m ends in a word character) or an escaped \n, \r or \t were skipped. Treat those as boundaries. - Redact Authorization Bearer/Basic/Token values, long bare Bearer tokens, upper-case *_TOKEN, *_API_KEY, *_SECRET, *_ACCESS_KEY and *_PASSWORD assignments with a non-placeholder value, nvapi- and ASIA keys, URL passwords under any scheme case and with JSON-escaped :\/\/. - Keep emails with internal TLDs (.internal, .local, .lan), q@k.transpose(...) and the version column of pip list, conda list and torch's [conda] dump. - Bound the scheme and host-label repeats and the line look-back, so long dotted runs and huge single lines stay linear (100 MB: 45 s or more before, about 1 s after). - Add shared vectors for each, including non-ASCII text next to an IP and a token. 紧跟在 ANSI 颜色码(\x1b[0m 以单词字符结尾)或转义的 \n、\r、\t 之后的令牌、IP 和邮箱此前会被漏掉,现在视为 边界。新增清理 Authorization 的 Bearer/Basic/Token 值、较长的独立 Bearer 令牌、值不是占位符的大写 *_TOKEN、*_API_KEY、*_SECRET、*_ACCESS_KEY、*_PASSWORD 赋值、nvapi- 与 ASIA 密钥,以及任意大小写协议 和 JSON 转义 :\/\/ 形式的 URL 密码。保留内部顶级域名的邮箱、q@k.transpose(...) 以及 pip list、conda list 和 torch [conda] 输出中的版本列。限制协议、主机标签和回看行首的长度,使长点分串和超长单行保持线性耗时。 为以上每项新增共享测试向量,包括与 IP 和令牌相邻的非 ASCII 文本。 * Strip private repo names in every form, and authenticate visibility reads - Only a letter or digit now continues a private repository name, so name-server-1, name_default and name-tools lose it, and owner%2Fname and the name with - and _ swapped match. - Read repository visibility with GITHUB_TOKEN when it is set; the anonymous limit is 60 an hour. 私有仓库名只有在后面紧跟字母或数字时才保留,因此 name-server-1、name_default、name-tools 中的仓库名都会被 清理,owner%2Fname 以及 - 与 _ 互换的写法也会匹配。设置了 GITHUB_TOKEN 时,仓库可见性查询使用该令牌(匿名 调用每小时仅 60 次)。 * Sanitize trace server-metric endpoint URLs, ids and engine labels - computeChartSeries groups sources by their raw identity, then serves endpointUrl, the source id and endpoint-based engine labels through redactText. Ids that then collide get #2, #3. - CHART_SERIES_VERSION stays at 21: read-only, all 776 endpoint URLs in production's 6,002 chart_series rows (535 with sources) are private, so a recompute would change nothing. - Document it on /api/v1/trace-server-metrics and update the reviewed source digest. computeChartSeries 先按原始标识对来源分组,再用 redactText 清理对外提供的 endpointUrl、来源 ID 以及基于端点的 引擎标签,清理后重复的 ID 加上 #2、#3。CHART_SERIES_VERSION 保持 21:只读检查显示生产环境 6,002 行 chart_series(535 行含来源)中的 776 个端点 URL 全部是私有地址,重新计算不会有任何变化。同时更新 /api/v1/trace-server-metrics 文档和已审核的源文件摘要。 * Restore the agentic backfill manifest database check with a host hash - Snapshots store a SHA-256 of the database host instead of the host, and --verify refuses a manifest from another database, or one without a fingerprint. 快照记录数据库主机名的 SHA-256 而不是主机名本身,--verify 会拒绝来自其他数据库或缺少指纹的清单。 * Make the log backfill race-safe, recoverable and downstream-aware - Take a per-file advisory lock in the backfill and in compact-server-logs (now through compactStoredServerLogFile), and rebuild blocks whose char_count no longer matches already-sanitized text, which a racing compaction could have built from the raw text. - Append every html_url about to be cleared to an operator-only JSONL file (--url-map, default ~/.inferencex/redacted-run-urls/, mode 600), in the backfill and in sync-public-db, and print only its path. - backfill-server-log-files, backfill-gpu-metrics and backfill-runtime-metadata report and skip a run without html_url instead of querying INGEST_REPO. - Add --downstream: shared rules only, keeping a downstream database's private repository names and run URLs, without GitHub calls. 回填与 compact-server-logs(改为通过 compactStoredServerLogFile)对每个日志文件加同一把 advisory 锁;对已清理 文本但 char_count 不一致的数据块(可能由并发压缩根据原始文本生成)重新生成。在回填和 sync-public-db 清空 html_url 之前,把原 URL 追加到仅操作者可读的 JSONL 文件(--url-map,默认 ~/.inferencex/redacted-run-urls/, 权限 600),只打印文件路径。backfill-server-log-files、backfill-gpu-metrics、backfill-runtime-metadata 遇到 没有 html_url 的运行时报告并跳过,不再改用 INGEST_REPO。新增 --downstream:只应用通用规则,保留下游数据库 自己的私有仓库名和运行 URL,也不调用 GitHub。 * Document log sanitization coverage, caches and copies - List every rule and what stays, the trace-metric sanitization, the URL map, --downstream, the s-maxage=31536000 log cache, downstream purges and backfills, and Neon branches and PITR. 文档列出全部清理规则和保留内容、跟踪指标的脱敏、URL 映射文件、--downstream、日志缓存的 s-maxage=31536000、下游部署各自的缓存清除与回填,以及 Neon 分支和时间点恢复中保留的原始文本。 * Widen escape boundaries and secret keys, and keep only real package rows - Treat any ANSI CSI ending in a letter (\x1b[2K, \x1b[1A, not just colour codes) and the escaped spellings \x1b[, \u001b[ and \033[ as token boundaries. - Redact JSON-escaped secret assignments (\"MY_SECRET_TOKEN\":\"...\"), lower-case *_token, *api_key, *_secret and *_password keys and --*-token/--api-key style flags when the value mixes letters and digits. Match those keys from the key word with a lookbehind, which also makes URL passwords cheaper; skip the email scan unless an @ is followed by a dotted domain. - Keep a pip/conda version column only when the package name has a lower-case letter and no address-like word, so MASTER_ADDR, mq_connect_ip and node-a lines with public IPs are redacted. - Keep a bare Bearer followed by a slash path without digits (bearer src/auth/...). - 12 new shared vectors and one changed: the placeholder case now ends hf_token=None. 任何以字母结尾的 ANSI CSI 序列(\x1b[2K、\x1b[1A,不只是颜色码)以及转义写法 \x1b[、\u001b[、\033[ 现在都视为 边界。新增清理 JSON 转义引号的密钥赋值、小写的 *_token、*api_key、*_secret、*_password 键以及 --*-token、 --api-key 等命令行参数(值须同时含字母和数字);这些键改为从关键词开始匹配并用后行断言校验,URL 密码同样 如此,邮箱扫描仅在 @ 后跟带点的域名时运行,以保持性能。pip/conda 版本列只有在包名含小写字母且不含地址类 词语时才保留,因此 MASTER_ADDR、mq_connect_ip、node-a 等行中的公网 IP 会被清理。独立的 Bearer 后跟不含 数字的斜杠路径时保留。新增 12 个共享用例,并修改占位符用例,改为以 hf_token=None 结尾。 * Fingerprint the manifest database by host and database name - Hash hostname plus pathname, so two databases on one host no longer share a fingerprint. 清单指纹改为对主机名加路径(数据库名)取哈希,同一主机上的两个数据库不再共用指纹。 * Fail backfills loudly, verify redacted blocks, and recover cleared repos - backfill-log-redaction exits 1 whenever a file failed, --downstream included, through the new reportLogRedaction. - For already-sanitized text holding ***REDACTED***, decode the blocks and rebuild them when they differ, which catches raw blocks whose replacements kept the same length. - chmod the URL map to 600 after every append, even when it already existed. - Admin backfills read every URL map in ~/.inferencex/redacted-run-urls/ and use a cleared run's recorded repository; other runs without html_url fall back to INGEST_REPO again. No migration. backfill-log-redaction 只要有文件失败就以 1 退出(包括 --downstream),由新的 reportLogRedaction 统一处理。 对已清理且含 ***REDACTED*** 的文本,解码数据块并在不一致时重建,以发现替换前后长度相同的原始数据块。 每次追加后都把 URL 映射文件权限设为 600,即使文件已存在。管理类回填会读取 ~/.inferencex/redacted-run-urls/ 下的全部映射文件,对被清空 URL 的运行使用记录的仓库;其他没有 html_url 的运行重新回退到 INGEST_REPO。无需数据库迁移。 * Document the widened rules, exit codes and URL-map lookups - Describe CSI and escaped boundaries, lower-case and flag secrets, the package-row and Bearer limits, the decoded-block check, the exit code and how admin backfills use the URL maps. 文档补充 CSI 与转义边界、小写键和命令行参数中的密钥、包版本行与 Bearer 的限制、数据块解码校验、 退出码,以及管理类回填如何使用 URL 映射文件。
1 parent d2901ca commit b46c344

34 files changed

Lines changed: 2232 additions & 60 deletions

‎.github/workflows/ingest-results.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ jobs:
232232
echo "::error::Resolved database host does not belong to the requested child branch"
233233
exit 1
234234
fi
235-
echo "Verified child database: $NEON_BRANCH_NAME ($branch_id), host $database_host"
235+
echo "Verified child database: $NEON_BRANCH_NAME ($branch_id)"
236236
cache_invalidate_url="${PREVIEW_SITE_URL%/}/api/v1/invalidate"
237237
cache_invalidate_secret="$INVALIDATE_SECRET_DEFAULT"
238238
protection_bypass_secret="$PROTECTION_BYPASS_SECRET_STAGING"

‎.github/workflows/recompute-agentic-metrics.yml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ jobs:
131131
'.endpoints[] | select(.branch_id == $branch and .host == $host)' <<<"$endpoints" >/dev/null
132132
{
133133
echo "Child database: $NEON_BRANCH_NAME ($branch_id)"
134-
echo "Host: $database_host"
135134
echo "Expires: $(jq -r '.expires_at' <<<"$branch")"
136135
} | tee -a "$GITHUB_STEP_SUMMARY"
137136
elif [ "$GITHUB_REF" != "refs/heads/$DEFAULT_BRANCH" ]; then

‎.oxfmtrc.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"packages/app/cypress/fixtures/api/collectivex-run-*.json",
1010
"packages/app/cypress/fixtures/api/collectivex-runs.json",
1111
"packages/app/src/lib/power/power-model.parity.json",
12-
"packages/app/src/components/video-benchmark/fixtures/native-serving-bundle/"
12+
"packages/app/src/components/video-benchmark/fixtures/native-serving-bundle/",
13+
"packages/db/src/etl/log-redaction.vectors.json"
1314
]
1415
}

‎docs/data-pipeline.md‎

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,77 @@ once on N connections; each file is its own transaction, so an interrupted run r
649649
Point `DATABASE_WRITE_URL` at the direct endpoint (no `-pooler` in the host): the pooler closed
650650
connections at 16 and above. Each connection holds up to about 1 GB while it compacts a large file.
651651

652+
#### Log sanitization
653+
654+
Ingest and `sync-public-db` sanitize server-log text with `etl/log-redaction.ts`, and
655+
`sync-public-db` also sanitizes runs from repositories that are not public. The rules replace
656+
these with `***REDACTED***`:
657+
658+
- access tokens: `hf_`, GitHub, AWS `AKIA`/`ASIA` key IDs, Slack, `sk-` and `nvapi-` API keys, and
659+
JWTs;
660+
- `Authorization: Bearer|Basic|Token` values, and a bare `Bearer` with a long token unless it is a
661+
slash path without digits (`bearer src/auth/…`);
662+
- values of upper-case `*_TOKEN`, `*_API_KEY`, `*_SECRET`, `*_ACCESS_KEY` and `*_PASSWORD`
663+
assignments, also with JSON-escaped quotes (`\"MY_SECRET_TOKEN\":\"…\"`), unless the value is a
664+
placeholder (`$VAR`, `<…>`, `***`, a number, `none`…);
665+
- values of lower-case `*_token`, `*api_key`, `*_secret` and `*_password` assignments and of
666+
`--*-token`, `--api-key`, `--*-secret` and `--*-password` flags, when the value mixes letters
667+
and digits (so `initial-cluster-token: etcd-cluster` and `bytes_per_full_token=13125.54` stay);
668+
- URL passwords, with any scheme case and JSON-escaped `:\/\/`;
669+
- email addresses with a public TLD;
670+
- public IPv4 and IPv6 addresses and `*.oraclevcn.com` host suffixes.
671+
672+
Tokens are found after ANSI CSI sequences (colour `\x1b[0m`, erase `\x1b[2K`, cursor `\x1b[1A`),
673+
their escaped spellings (`\x1b[`, `\u001b[`, `\033[`) and escaped `\n`, `\r` or `\t` too. Private,
674+
loopback, link-local and CGNAT addresses, internal node names, short usernames such as `/home/cam`,
675+
`user@host` without a TLD or with an internal one (`.internal`, `.local`, `.lan`), scp-style
676+
remotes (`git@github.com:org/repo`), URL userinfo without a password, `q@k.transpose(…)`,
677+
`pkg@1.2.3`, image digests, and package versions (`==9.19.0.56`, pip's `(9.19.0.56)`, and the
678+
version column of `pip list`, `conda list` and torch's `[conda]` dump, when the package name has a
679+
lower-case letter and no address-like word such as `addr`, `ip` or `node`) stay. For runs from a
680+
repository that is not public, `owner/repo`, `owner%2Frepo` and the name with `-` or `_` in either
681+
place are removed wherever no letter or digit continues them. The InferenceX uploader applies the
682+
same rules, and both sides test against `etl/log-redaction.vectors.json`, so change the two
683+
together. The patterns are ASCII-only; the Python port compiles with `re.ASCII` and needs the
684+
`regex` module for the variable-length lookbehinds.
685+
686+
Trace-replay server metrics (`/api/v1/trace-server-metrics` and
687+
`/api/v1/trace-server-metric-source`) apply the same rules to source endpoint URLs, source ids and
688+
engine labels when `computeChartSeries` builds them. Every endpoint URL stored before this change
689+
is private, so `CHART_SERIES_VERSION` stayed the same.
690+
691+
The log routes serve stored text as is and do not sanitize at read time. Rows stored before
692+
this change stay exposed until the backfill runs.
693+
`bun run admin:db:backfill-log-redaction` applies it to rows stored earlier in the public database
694+
(point `DATABASE_WRITE_URL` at it). It is a dry run by default. `--write` applies it, `--run-id`
695+
scopes it to one run, and `--concurrency N` sanitizes N files at once. Each file is its own
696+
transaction under the file's advisory lock, which `compact-server-logs` also takes, and its
697+
blocks are rebuilt from the sanitized text. So are blocks that no longer describe already-sanitized
698+
text: a different character count gives them away, and for text holding `***REDACTED***` the
699+
blocks are decoded and compared. Rerunning is safe because sanitized text is a fixed point. The
700+
backfill exits 1 whenever a file failed, `--downstream` included.
701+
702+
Besides log text, it clears `workflow_runs.html_url` for runs from repositories that are not
703+
public, once every file succeeded. Each cleared URL is first appended to an operator-only JSONL
704+
file (`--url-map <path>`, default `~/.inferencex/redacted-run-urls/`, mode 600 even for an existing
705+
file) whose path is printed; `sync-public-db` records the URLs it does not copy the same way. Keep
706+
that file out of git and CI logs: it is the only record of those runs' repositories. Admin
707+
backfills that read artifacts (`backfill-server-log-files`, `backfill-gpu-metrics`,
708+
`backfill-runtime-metadata`) read every map in `~/.inferencex/redacted-run-urls/` and use a cleared
709+
run's recorded repository; any other run without a URL falls back to `INGEST_REPO`, as before.
710+
GitHub run IDs are unique across repositories, so a cleared run missing from the maps reads as not
711+
found there rather than as another run. On a downstream deployment's own database, pass
712+
`--downstream`: it applies the shared rules but keeps that deployment's private repository names
713+
and run URLs, and never asks GitHub. Visibility checks use `GITHUB_TOKEN` when it is set.
714+
715+
After a write, purge the log cache with `bun run admin:cache:invalidate -- <app-url> --immediate`.
716+
Log responses carry `s-maxage=31536000`, so the CDN keeps the old text until that purge; browsers
717+
may keep it for up to an hour (`max-age=3600`). A downstream deployment that reads the public
718+
database through `PUBLIC_DATABASE_READONLY_URL` caches log responses in its own CDN and blob
719+
store and needs its own purge, and one that synced runs holds its own copies and needs its own
720+
backfill. Neon child and preview branches created before the backfill, and point-in-time history,
721+
keep the raw text.
722+
652723
### Agentic Dataset Provenance
653724

654725
AIPerf exports public-dataset provenance in `metadata.dataset`, including the Hugging Face dataset ID. InferenceX preserves that object as `dataset` on each agentic aggregate benchmark row. During benchmark ingest, `ingest-ci-run.ts` derives the dashboard slug from `hf_dataset_name` (for example, `semianalysisai/cc-traces-weka-062126` becomes `cc-traces-weka-062126`) and upserts `run_datasets` for the workflow run.

‎docs/deployment-configuration.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ scripts.
1818
| `INFERENCEX_SOURCE_REPOS` | optional | Comma-separated `owner/repo` list searched after `SemiAnalysisAI/InferenceX` for unofficial-run overlays, live GPU metrics, live eval samples, and ETL workflow-run lookups. Entries are trimmed and deduplicated; a malformed entry is an error. |
1919
| `VERCEL_PROTECTION_BYPASS_SECRET` | optional | Sent as `x-vercel-protection-bypass` by the cache invalidate and warmup scripts, the H3 media warmer, the PowerX publication verifier, and the CollectiveX ingest CLI's cache purge. |
2020
| `INFERENCEX_APP_URL` | `warm-video-results.ts`, and `verify-power-publication.ts` without an origin argument | Origin for those two scripts. The verifier's origin argument wins when given. The cache scripts keep their localhost default. |
21-
| `INGEST_REPO` | ingest, backfill, and artifact-preparation scripts when no argument or run URL names the repository | Repository for those scripts. `ingest-ci-run`, `ingest-operatorx`, and the backfills take a `[repo]` argument or a full run URL first. CI-mode `ingest-ci-run` and `prepare-ci-artifacts` always require it. |
21+
| `INGEST_REPO` | ingest, backfill, and artifact-preparation scripts when no argument or run URL names the repository | Repository for those scripts. `ingest-ci-run`, `ingest-operatorx`, and the backfills take a `[repo]` argument or a full run URL first. CI-mode `ingest-ci-run` and `prepare-ci-artifacts` always require it. `backfill-server-log-files`, `backfill-gpu-metrics` and `backfill-runtime-metadata` first look up a run without `html_url` in the log-redaction URL maps (`~/.inferencex/redacted-run-urls/*.jsonl`). |
2222
| `DATABASE_READONLY_URL` | yes, for the app | Read-only connection for the dashboard API routes. Read-only admin scripts and the MCP server use it too. |
2323
| `PUBLIC_DATABASE_READONLY_URL` | optional, for a downstream deployment | Read-only connection to the public database. When set, the app shows public results next to its own: list reads combine both databases, and a log, trace, eval sample, or GPU telemetry with an id below 10^12 is read from the public one. See [Showing public results on a downstream deployment](#showing-public-results-on-a-downstream-deployment). |
2424
| `DATABASE_DRIVER` | optional | `neon` (serverless HTTP) or `postgres` (TCP) for the app's database clients. When unset, hosts ending in `.neon.tech` use `neon` and all others use `postgres`. Admin scripts always use `postgres`. |

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"admin:db:backfill-full-response-interactivity": "bun run --cwd packages/db db:backfill-full-response-interactivity",
4949
"admin:db:backfill-gpu-metrics": "bun run --cwd packages/db db:backfill-gpu-metrics",
5050
"admin:db:backfill-gpu-sample-blobs": "bun run --cwd packages/db db:backfill-gpu-sample-blobs",
51+
"admin:db:backfill-log-redaction": "bun run --cwd packages/db db:backfill-log-redaction",
5152
"admin:db:backfill-power-series": "bun run --cwd packages/db db:backfill-power-series",
5253
"admin:db:backfill-request-chart-data": "bun run --cwd packages/db db:backfill-request-chart-data",
5354
"admin:db:backfill-sequence-length-sketches": "bun run --cwd packages/db db:backfill-sequence-length-sketches",

‎packages/app/src/lib/api/api-documentation.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3366,8 +3366,8 @@ export const apiOperations: readonly ApiOperation[] = [
33663366
path: '/api/v1/trace-server-metrics',
33673367
summary: text('Read trace server metrics', '读取跟踪服务器指标'),
33683368
description: text(
3369-
'Returns point metadata, including prefill/decode TP, EP, DP attention, worker counts, physical GPU counts and recipe_fingerprint for cache-reuse links, and chart-ready aggregate time series for cache usage, queue depth, prefill and decode throughput, and prompt-token sources. metricSources contains source descriptors; source-specific arrays are loaded by the point-detail UI only when selected. TokenSpeed exports device KV utilization and running/waiting request gauges; unavailable cache-hit and token-throughput measurements remain empty. Disaggregated TRT-LLM aggregate prompt and cache-hit series exclude identified decode endpoints; per-source drilldowns retain their own measurements.',
3370-
'返回数据点元数据(含 prefill/decode TP、EP、DP attention、worker 数、物理 GPU 数及 recipe_fingerprint,用于缓存复用链接),以及可直接用于图表的聚合时间序列,涵盖缓存使用率、队列深度、prefill/decode 吞吐量和 prompt token 来源。metricSources 包含各来源的描述信息;仅当用户在数据点详情界面选择某个来源时,才会加载该来源对应的数组。TokenSpeed 提供设备 KV 使用率以及运行中和排队请求数;未提供的缓存命中率和 token 吞吐量指标保留为空。分离式 TRT-LLM 的聚合 prompt 和缓存命中率序列不计入已识别的 decode 端点;按来源查看时,仍保留各端点自身的测量值。',
3369+
'Returns point metadata, including prefill/decode TP, EP, DP attention, worker counts, physical GPU counts and recipe_fingerprint for cache-reuse links, and chart-ready aggregate time series for cache usage, queue depth, prefill and decode throughput, and prompt-token sources. metricSources contains source descriptors; source-specific arrays are loaded by the point-detail UI only when selected. TokenSpeed exports device KV utilization and running/waiting request gauges; unavailable cache-hit and token-throughput measurements remain empty. Disaggregated TRT-LLM aggregate prompt and cache-hit series exclude identified decode endpoints; per-source drilldowns retain their own measurements. Source endpoint URLs, source ids and engine labels are sanitized like server logs: public addresses read ***REDACTED***, and ids that would then collide gain a #2, #3 suffix.',
3370+
'返回数据点元数据(含 prefill/decode TP、EP、DP attention、worker 数、物理 GPU 数及 recipe_fingerprint,用于缓存复用链接),以及可直接用于图表的聚合时间序列,涵盖缓存使用率、队列深度、prefill/decode 吞吐量和 prompt token 来源。metricSources 包含各来源的描述信息;仅当用户在数据点详情界面选择某个来源时,才会加载该来源对应的数组。TokenSpeed 提供设备 KV 使用率以及运行中和排队请求数;未提供的缓存命中率和 token 吞吐量指标保留为空。分离式 TRT-LLM 的聚合 prompt 和缓存命中率序列不计入已识别的 decode 端点;按来源查看时,仍保留各端点自身的测量值。来源端点 URL、来源 ID 和引擎标签按服务器日志的规则脱敏:公网地址显示为 ***REDACTED***,脱敏后重复的 ID 会加上 #2、#3 后缀。',
33713371
),
33723372
audience: 'public',
33733373
stability: 'beta',

‎packages/app/src/lib/api/api-route-catalog.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,7 +2143,10 @@ export const apiContractSourceDigests = [
21432143
},
21442144
{
21452145
source: '../db/src/etl/compute-chart-series.ts',
2146-
sourceSha256: 'ce00cbd168df883f1759cd7268726575d5effc3fe038a7f74d805df79072ab3a',
2146+
// Reviewed for log-style sanitization of served source ids, endpoint URLs and engine labels
2147+
// (documented on /api/v1/trace-server-metrics). Same CHART_SERIES_VERSION: every stored
2148+
// endpoint is private, so stored rows would not change.
2149+
sourceSha256: '17dd1c8cbfb966240fcc53aef43e34fc1df489dc634007fb9f898a87ebb52c58',
21472150
reviewArea: {
21482151
en: 'Server metric chart version, supported engine metrics, source identity, and missing-data semantics.',
21492152
zh: '服务器指标图表版本、支持的引擎指标、来源标识以及缺失数据语义。',

‎packages/db/package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"db:backfill-dataset-stats": "bun --env-file=../../.env src/backfill-dataset-stats.ts",
3333
"db:backfill-gpu-metrics": "bun --env-file=../../.env src/backfill-gpu-metrics.ts",
3434
"db:backfill-gpu-sample-blobs": "bun --env-file=../../.env src/backfill-gpu-sample-blobs.ts",
35+
"db:backfill-log-redaction": "bun --env-file=../../.env src/backfill-log-redaction.ts",
3536
"db:backfill-power-series": "bun --env-file=../../.env src/backfill-power-series.ts",
3637
"db:backfill-full-response-interactivity": "bun --env-file=../../.env src/backfill-full-response-interactivity.ts",
3738
"db:backfill-request-chart-data": "bun --env-file=../../.env src/backfill-request-chart-data.ts",

‎packages/db/src/backfill-gpu-metrics.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ import {
4343
collectMissingTelemetryExpectations,
4444
type GpuMetricsArtifactPair,
4545
} from './lib/gpu-metrics-backfill.js';
46-
import { repositoryFromRunUrl } from './lib/runtime-metadata-artifacts.js';
46+
import { loadRedactedRunUrls } from './lib/redacted-run-urls.js';
47+
import { storedRunRepository } from './lib/runtime-metadata-artifacts.js';
4748
import {
4849
gpuMetricsRunCoverage,
4950
type GpuMetricSeriesCoverageRow,
@@ -329,6 +330,7 @@ async function processPair(
329330
}
330331

331332
async function main(): Promise<void> {
333+
const redactedUrls = loadRedactedRunUrls();
332334
const flags = parseFlags(process.argv.slice(2));
333335
if (!flags.all && flags.run === null) {
334336
throw new Error('Pass --run <github run id> or --all');
@@ -355,7 +357,7 @@ async function main(): Promise<void> {
355357
let failedRuns = 0;
356358
for (const run of runs) {
357359
try {
358-
const repository = repositoryFromRunUrl(run.html_url) ?? requireIngestRepo();
360+
const repository = storedRunRepository(run, redactedUrls) ?? requireIngestRepo();
359361
const artifacts = await listBackfillRunArtifacts(repository, run.github_run_id);
360362
if (artifacts === null) {
361363
goneRuns++;
@@ -407,7 +409,7 @@ async function main(): Promise<void> {
407409

408410
for (const [runIndex, run] of runs.entries()) {
409411
const runId = run.github_run_id;
410-
const repository = repositoryFromRunUrl(run.html_url) ?? requireIngestRepo();
412+
const repository = storedRunRepository(run, redactedUrls) ?? requireIngestRepo();
411413
const runStart = Date.now();
412414
const manifest = flags.receipt === null ? null : readReceipt(flags.receipt, run);
413415
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), `gpu-metrics-backfill-${runId}-`));

0 commit comments

Comments
 (0)