[FR] Expose retry-attempt observability (hook/event) — retried 503s and per-attempt latency are invisible to callers
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 28/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- nodejs, typescript
- Lĩnh vực
- api, observability
Hướng nghiên cứu
Bắt đầu với hành vi retry được tham chiếu trong chú thích mã của api-request và xem xét các tùy chọn nhắn tin hoặc ứng dụng được thảo luận trong yêu cầu, cùng với issue liên quan #1615. Công việc được xem là hoàn tất khi các caller có thể quan sát các lần thử retry, thông tin chi tiết về status hoặc lỗi, thời gian đã trôi qua và liệu một lần retry khác có xảy ra hay không, mà không cần patch các thành phần nội bộ của HTTP/2.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.7k
- Fork
- 419
- Merge trung bình
- 4 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 16
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/firebase-admin-node
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 bình luận · 1 người được giao ·
-
api: messaging
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
firebase/firebase-admin-node#3215 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 bình luận · 1 người được giao ·
-
api: appcheck
firebase/firebase-admin-node#3181 · 2 bình luận · 5 reaction · 1 người được giao ·
Tất cả issue của firebase/firebase-admin-node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
vercel-labs/just-bash#464 ·
-
looksLikeSlug() is ASCII-only, so non-Latin entity slugs (e.g. Korean) skip exact match and collapse Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TanStack/tanstack.com#1293 ·