Skip to content

perp-fees: delete gauges on asset_not_found (Lighter ghost metrics) - #1619

Closed
Flotapponnier wants to merge 7 commits into
devfrom
fix/lighter-ghost-metrics
Closed

perp-fees: delete gauges on asset_not_found (Lighter ghost metrics)#1619
Flotapponnier wants to merge 7 commits into
devfrom
fix/lighter-ghost-metrics

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Problem

Lighter removed BTC, ETH, and SOL from their perp markets. Their live /orderBookDetails API returns 89 markets, none of which are BTC/ETH/SOL. The harness has been returning asset_not_found on every 5-minute tick for all three assets.

The bug: recordSample() returned early on error without clearing the gauge. The Go Prometheus client retains the last .Set() value in memory indefinitely. So Lighter kept showing as #1 for BTC all-in cost (0.35 bps) — a ghost metric from before the delisting.

This affected the headline ranking AND all notional tier gauges ($10k, $100k, $1M), which is why the perp-fees?chain=BTC&view=all_in_100k page showed a suspiciously great Lighter value.

Fix

  • Added not_found error class to classifyErr() (matches asset_not_found and unsupported_venue)
  • When errType == "not_found", delete all gauge series for that venue/asset: allInBps, spread, takerFee, funding, fetchLatency, lastRefresh, and all four tier gauges
  • Transient failures (timeout, rate limit, server error) still keep the last value — that behavior is intentional

Deploy

After merging to dev → main, rebuild and redeploy the perp-fees harness on the VPS so the running process picks up the fix and clears the stale Lighter/BTC metrics on its next tick.

ssh rescue@57.130.61.201 -p 8822
cd /opt/ocb && docker compose build perp-fees && docker compose up -d perp-fees

* bridge-monitor: add Squid, Socket, Mayan bridges + bench specs
* feat: Squid/Socket/Mayan bridges + per-region quote latency + corridor p50/p99 matrix
cron: warm /perps hub in health-check every 5 min
- ethereum-rpc answer: 8→7 providers, remove Flashbots (now on mev-protect-rpc), bench FAQ 15s→60s cadence
- bridge-quote-latency answer+bench: add Squid/Socket (now 8 bridges), update single eu-west→3 regions
- cheapest-bridge answer: add Squid/Socket (now 8 routers, was 6), remove false 'not measured' claim
- staking answer: update 3→7 chains to match validator-yield bench, enumerate all 7 in short_answer and limitations
- bridge page: add Squid/Socket to description and tooltip, Fragment key fix
Lighter removed BTC/ETH/SOL from their perp markets. The harness was
returning asset_not_found on every tick but recordSample() returned
early without deleting the gauge, so the Go Prom client kept the last
set value in memory forever. Classifying asset_not_found as not_found
and calling DeleteLabelValues clears all gauge series (allInBps,
spread, takerFee, funding, tiers) so Lighter/BTC etc. drops off the
rankings instead of carrying stale top-ranked values indefinitely.
@Flotapponnier

Copy link
Copy Markdown
CollaboratorAuthor

Superseded by #1621 (clean branch from dev, no merge conflicts)

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Flotapponnier