feat(metrics): treasury USDT balance gauge (ENG-485 part 2)#437
Merged
Conversation
The `funder` gauge tracks the funder's DEFAULT wallet (BTC). The cutover treasury is the funder's USDT wallet (resolved by currency, ENG-482), so treasury drain during a cutover run — fee reimbursements, rollback top-ups — is invisible to metrics and alerts. Adds a `treasury_usdt` wallet gauge resolving the funder's USDT wallet, mirroring the cutover treasury resolver. When the treasury isn't provisioned yet (prod pre-cutover) the resolver throws and the gauge's existing cache-fallback path handles it — it simply doesn't report until the wallet exists. Part 1 (IbexError httpCode propagation) is NOT included — see ENG-485: the ibex-client ApiError constructor does `super(e.stack)`, discarding the original error's status entirely, so httpCode cannot be propagated without an upstream ibex-client change. Documented on the ticket. Refs ENG-485 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Adds a
treasury_usdt_balancePrometheus gauge. The existingfundergauge tracks the funder's default wallet (BTC); the cutover treasury is the funder's USDT wallet (resolved by currency, ENG-482), so treasury drain during a cutover run — fee reimbursements, rollback top-ups — was invisible to metrics. Resolver mirrors the cutover treasury logic; when the treasury isn't provisioned (prod pre-cutover) it throws and the gauge's existing cache-fallback path handles it (no report until the wallet exists).Part 1 (httpCode) deliberately excluded — upstream-blocked
The ticket's premise (uncomment
httpCode = err instanceof ApiError ? err.code) doesn't work: the ibex-clientApiErrorconstructor issuper(e.stack)— it discards the original error's status entirely. There is no.code; uncommenting would sethttpCode = undefinedalways. Structural=== 429detection requires an upstream ibex-client change (or parsing status text out of the message). Full finding on ENG-485.Test plan
runtime-services.spec.ts. The exporter itself has no unit harness (server bootstrap); the gauge machinery + cache-fallback are pre-existing and battle-tested.Refs ENG-485
🤖 Generated with Claude Code