telemetry: schema-first event registry (typed catalog + generated docs)
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 32/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- typescript
调研方向
先阅读 src/instrumentation/CONVENTIONS.md、src/instrumentation/* 下按域划分的文件以及 src/instrumentation/EVENTS.md。跟踪 TelemetryService.trace/log/logError、Span 及其测试,以了解当前的事件和属性类型定义。选定的注册表设计完成实现、instrumentation 和测试完成更新,并且生成的 EVENTS.md 通过 CI 的新鲜度检查后,这项工作就完成了。
由索引模型根据 Issue 内容生成。
描述
Problem
Telemetry events, properties, and value unions are declared per-domain in src/instrumentation/* and documented by hand in src/instrumentation/EVENTS.md. Nothing structurally prevents:
- emitting an event name that isn't cataloged anywhere,
- adding/renaming a property without updating the docs,
- drifting from the conventions in
src/instrumentation/CONVENTIONS.md(a recent audit found camelCase keys, kebab-case enum values, and caller-setresultthat review missed).
Proposal
Adopt a schema-first registry as the single source of truth for the telemetry surface, the way OTel itself defines semantic conventions in a registry and generates code + docs from it (Weaver).
TS-native sketch:
- A central
TelemetryEventMapinterface declaring every event with its properties and measurements (value unions spelled out). TelemetryService.trace/log/logErrorconstrained tokeyof TelemetryEventMap;Spanbecomes generic (Span<E>) sosetProperty/setMeasurementkeys and values are type-checked per event. An undeclared event or attribute key becomes a compile error.EVENTS.mdgenerated from the registry (script walking the interface + JSDoc), with a CI--checkmode so the doc can never go stale.
Known costs / open questions
- Every instrumentation class and its tests are touched by the
Span<E>generic. - Phase names compose at runtime (
parent.child), so child phases need registry entries or looser typing. - The registry partially duplicates per-domain unions the instrumentation classes already export; decide whether the registry imports those types or replaces them.
Cheaper interim guards (could land independently)
- Type the event-name parameter of
TelemetryService.trace/logas a union of registered names (names are already top-level string literals; near-zero churn). - ESLint restriction banning raw
telemetry.trace(/.log(outsidesrc/instrumentation(the layering rule from CONVENTIONS.md). - Golden event catalog aggregated from the test suite's sinks, checked like the existing OTLP goldens.
- 主要语言
- TypeScript
- 星标
- 131
- 派生
- 48
- 平均合并
- 4 天 15 小时
- 30 天内合并 PR
- 17
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
coder/vscode-coder 的其他 Issue
-
coder/vscode-coder#1125 · 1 条评论 · 已指派 1 人 ·
-
tech-debt
coder/vscode-coder#1119 · 1 条评论 · 已指派 1 人 ·
-
enhancement tech-debt
难度 3/5 1-2 天 新手友好度 74/100
coder/vscode-coder#1118 · 1 条评论 ·
-
coder/vscode-coder#1113 · 3 条评论 · 已指派 1 人 ·
-
enhancement tech-debt
难度 5/5 一周以上 新手友好度 45/100
coder/vscode-coder#1112 · 1 条评论 ·
查看 coder/vscode-coder 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100