fix: reclassify Apollo network-error log severity#58
Draft
TaprootFreak wants to merge 1 commit into
Draft
Conversation
Drop noise from the recoverable-retry path:
- Use logger.warn (not logger.error) when the primary indexer fails and
the fallback is about to be engaged; reserve logger.error for cases
where no fallback is configured or the fallback itself failed.
- Drop the {message, name, stack} metadata payload — the Winston
formatter in api.main.ts uses only info.message, so it never reached
Loki anyway. Inline the message into the log line for actual signal.
- Collapse the redundant info-level breadcrumbs ('Network error
detected' / '503 Service Unavailable') into the single warn line.
- Refresh the fallback window after expiry instead of arming it once
per process lifetime, so a sustained outage keeps the fallback active.
Behaviour change for the no-fallback case (jdm/jdt PRD have no
CONFIG_INDEXER_FALLBACK_URL set): the same-URL retry via forward() is
dropped because it cannot recover anything. Errors now propagate to
the caller without an extra round-trip.
Mirrors the parallel change in d-EURO/api per the shared codebase
convention.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirror of
d-EURO/api#117per theshared-codebase convention. Reclassify recoverable Apollo network errors
from
errortowarn, drop log payload fields the active formattersilently discards, and refresh the fallback window after expiry.
Tracked in
DFXServer/server#278.Investigation
Sampled
2026-06-01 ~11:00 CESTondfxprd(Loki):juicedollar-jdm-api-11juicedollar-jdt-api-11Both PRD containers run with
LOG_LEVEL=warn(compose), so the existinginfo-level breadcrumbs (
[Ponder] Network error detected, activating fallback) were filtered out before they ever reached Loki. That's whythe
ApiApolloConfigevents show up as 100% error severity in thedashboards even though the runtime path is the recoverable one.
GraphQL-errors path: 0/24h on dfxprd — confirms the noise is purely
from the network-error path.
Two latent issues fixed alongside (same as in
d-EURO/api#117):api.main.tsusesonly
info.message; the{ message, name, stack }second arg nevershipped. Inlining
networkError.messageinto the line keeps thesignal that was being lost.
activateFallback()only armed once per process lifetime. Guardif (!fallbackUntil)stayed truthy after the first activation, sothe "Switching to fallback for 10min" log fired once per container
boot. Refreshed to re-arm when the window has passed.
Change
Byte-identical to the d-EURO sibling PR. Both apollo files are now in
sync (originally diverged by one line — the
&& CONFIG.indexerFallbackguard — which is now consolidated into both sides, benign in d-EURO
where
indexerFallbackhas a config-level default).Behaviour matrix
warnerrorerrorerrorBehaviour change for the no-fallback case
The PRD compose for
jdm/jdtdoes not setCONFIG_INDEXER_FALLBACK_URL(intentional: there is no second indexerdeployment). With the previous code, network errors entered the recovery
branch anyway and called
forward(operation)— a same-URL retry thatcannot recover anything meaningful, since both attempts hit the same
endpoint in the same JS tick. This PR drops that retry and propagates
the error to the caller instead.
these are real failures, not noise being mis-classified.
error— the no-fallback branch logslogger.error,not
warn. That's the correct semantic: nothing to retry with meansit's a real failure for the client.
their own polling/retry cycles, so the user-visible effect is minimal.
Once a fallback indexer is provisioned (
CONFIG_INDEXER_FALLBACK_URLbecomes a non-empty string different from
CONFIG_INDEXER_URL), therecovery branch lights up automatically: warn + URL switch + retry, just
like d-EURO PRD does today.
Expected post-deploy effect on dfxprd
ApiApolloConfigerror-level lines: stays ~607/d combined(jdm ~357, jdt ~250) — these are real failures that can't be hidden
behind a non-existent fallback. They retain visibility on the
error-rate panel.
[Ponder] Network error detected …breadcrumbs goneentirely (they were filtered by
LOG_LEVEL=warnanyway, so noobservable change).
A real noise reduction for JD requires either provisioning a separate
fallback indexer endpoint, or accepting these as real-failure signals
(my read).
Test plan
yarn buildclean (verified locally on the branch HEAD)yarn lintclean (verified locally on the branch HEAD)npx prettier --check api.apollo.config.tscleanno longer doubles up with retry round-trips; CI logs from the
dapp/bots show no regression.