[FR] Expose retry-attempt observability (hook/event) — retried 503s and per-attempt latency are invisible to callers
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Tranquilo
- Stack tecnológico
- nodejs, typescript
- Área
- api, observability
Línea de trabajo
Comienza con el comportamiento de reintento mencionado en el comentario de código de api-request y revisa las opciones de mensajería o de la app tratadas en la solicitud, junto con el issue relacionado #1615. Se considera terminado cuando los llamadores pueden observar los intentos de reintento, los detalles del estado o del error, el tiempo transcurrido y si se realizará otro reintento, sin parchear los componentes internos de HTTP/2.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.7k
- Forks
- 419
- Merge medio
- 4 d 20 h
- PR fusionados (30 d)
- 16
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de firebase/firebase-admin-node
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 comentarios · 1 asignado ·
-
api: messaging
Dificultad 3/5 1-2 días Aptitud para principiantes 70/100
firebase/firebase-admin-node#3215 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 comentario · 1 asignado ·
-
api: appcheck
firebase/firebase-admin-node#3181 · 2 comentarios · 5 reacciones · 1 asignado ·
Todos los issues de firebase/firebase-admin-node
Issues similares
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
-
Mend: dependency security vulnerability untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100