[FR] Expose retry-attempt observability (hook/event) — retried 503s and per-attempt latency are invisible to callers
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 28/100
- Issue 类型
- 功能
- 描述清晰度
- 需要澄清
- 活跃度
- 冷清
- 技术栈
- nodejs, typescript
- 领域
- api, observability
调研方向
从 api-request 代码注释中提到的重试行为开始,查看请求中讨论的消息传递或应用选项,以及相关的 issue #1615。完成的标准是:调用方无需修改 HTTP/2 内部实现,即可观察到重试尝试、状态或错误详情、经过的时间,以及是否会进行下一次重试。
由索引模型根据 Issue 内容生成。
描述
Is your feature request related to a problem?
The HTTP clients retry transient failures — per the code comment in api-request, "Retries up to 4 times on connection reset and timeout errors as well as 503 errors" — which is great, but the retry lifecycle is completely invisible to the caller. You observe only the final result and total elapsed time.
In production this matters a lot for FCM:
- A
sendEach()call that "took 15s" is indistinguishable from one that made three 5s attempts. Capacity planning, SLO attribution, and incident analysis need to tell these apart. - 503s that the SDK retries away never appear anywhere. During an FCM backend hiccup, our error rate looked flat while the wire was full of retried 503s — we only learned this after instrumenting below the SDK.
What we did as a workaround (and what it revealed)
We attached listeners at the HTTP/2 layer to record, per attempt, the :status header the SDK already receives, plus per-attempt request→response duration. Two things became visible immediately:
- Swallowed 503s during backend episodes (invisible at the SDK surface).
- Batches with ~15s total latency decomposed cleanly into 3 × ~5s attempts — i.e. the tail was retry behavior, not slow single requests.
We validated the accounting at scale: in a ~650k-message load run at ~2,000 rps, wire-level attempt counts reconciled exactly with SDK-level result counts (596,663 = 596,663).
Monkey-patching works but is version-fragile and clearly not the intended way.
Describe the solution you'd like
Any of these would solve it (in rough order of preference):
- An
onRetryAttempt(info)callback / EventEmitter on the messaging or app options, with{ attempt, statusCode?, errorCode?, elapsedMs, willRetry }. - Attempt metadata attached to the final response/error (e.g.
attempts: [{status, elapsedMs}, ...]). - At minimum, a debug logging hook for retry decisions.
Describe alternatives you've considered
- Runtime-patching the HTTP/2 request path to observe response headers (works, but couples us to SDK internals).
enableLegacyHttpTransport()+ external proxy metrics (gives up HTTP/2).
Additional context
Related: #1615 (custom RetryConfig) — configuration and observability of the same mechanism. Verified against 12.7.0 and 14.1, on Node 16 and 24.
- 主要语言
- TypeScript
- 星标
- 1.7k
- 派生
- 419
- 平均合并
- 4 天 20 小时
- 30 天内合并 PR
- 16
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-admin-node 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 条评论 · 已指派 1 人 ·
-
api: messaging
难度 3/5 1-2 天 新手友好度 70/100
firebase/firebase-admin-node#3215 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 条评论 · 已指派 1 人 ·
-
api: appcheck
firebase/firebase-admin-node#3181 · 2 条评论 · 5 个 reaction · 已指派 1 人 ·
查看 firebase/firebase-admin-node 的全部 Issue
相似的 Issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 1/5 1 小时以内 新手友好度 85/100
-
Mend: dependency security vulnerability untriaged
难度 2/5 1-3 小时 新手友好度 70/100