Show market data and performance cache health in admin diagnostics - #105
Show market data and performance cache health in admin diagnostics#105jaywedgeworth22 wants to merge 5 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0591091d87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| FROM securities_ref | ||
| WHERE source IS NOT NULL AND source != '' |
There was a problem hiding this comment.
Count source-less provider failures in diagnostics
When a configured Massive/Intrinio/Twelve Data/Finnhub attempt fails before any provider returns a ref, upsertEmpty records enrichment_error and enriched_at but leaves source NULL. This new provider-health aggregate drops those rows with WHERE source IS NOT NULL, so the new provider cards can report 0 recent errors and no last use even while the diagnostics error list contains fresh enrichment failures. Please either tag the attempted provider when recording the failure or include source-less failures in the configured provider's health calculation.
Useful? React with 👍 / 👎.
| connections.push({ | ||
| id: 'provider:fmp', | ||
| label: 'FMP Market Data', | ||
| label: 'FMP Enrichment', |
There was a problem hiding this comment.
Filter FMP diagnostics to FMP-sourced rows
With the new provider-specific cards, this card is now presented as FMP-only, but the query feeding it still aggregates every row in securities_ref without a source predicate. In an environment where FMP is configured but recent enrichment came from Massive/EDGAR/etc., provider:fmp will inherit those providers' last-used times, counts, and errors, sending admins to the wrong provider. Filter this aggregate to sources containing fmp or fold FMP into the same per-provider aggregation as the new cards.
Useful? React with 👍 / 👎.
| `SELECT CASE | ||
| WHEN lower(source) LIKE '%massive%' THEN 'massive' | ||
| WHEN lower(source) LIKE '%intrinio%' THEN 'intrinio' | ||
| WHEN lower(source) LIKE '%twelvedata%' THEN 'twelvedata' | ||
| WHEN lower(source) LIKE '%finnhub%' THEN 'finnhub' | ||
| WHEN lower(source) LIKE '%edgar%' THEN 'edgar' |
There was a problem hiding this comment.
Split composite sources across provider cards
securities_ref.source is persisted as a +-joined list when multiple providers contribute to a ticker, but this CASE assigns each row to only one provider. For example, a row sourced from both Massive and EDGAR is counted only under Massive because that branch matches first, so the other provider cards can show zero usage even though they are part of the enrichment chain. Aggregate each provider with its own source LIKE predicate, or otherwise explode the source list before grouping.
Useful? React with 👍 / 👎.
Summary
Why S&P performance can be unavailable
Performance requires tickered, non-option trades with cached asset EOD prices, cached SPY/S&P benchmark closes, current price, and computed tx_performance anchors. This PR makes those cache states visible to admins.
Verification
Preview: https://congress-trade-preview.jaywedgeworth22.workers.dev
Preview version: 22af451e-1380-4d21-a192-8d74714fa3a2