Task/642 monero metrics#665
Merged
Merged
Conversation
Derive fee and subsidy shares from the existing 24-hour canonical Monero block reward aggregate, with defensive input validation and the same tail-subsidy clamp used by average-fee calculations. Read the persisted metrics through moneroService in the Network Health and Tokenomics server components, keep missing data on the established muted paths, and add matching English, Portuguese, and Russian copy. No indexer, schema, service contract, or client-side data flow changes are required.
Render the tail-emission security card with the same plain no-data presentation as the other Monero tokenomics metrics. The previous blurred state followed the draft design but conflicted with the established convention that blur represents gated content.
Add nullable miner-count and freshness fields to MiningPool with an additive migration, then populate them from configured pool APIs during the existing hourly pool-stats job. Run independent live-stat calls concurrently before the block-tip gate, preserve prior values on missing or invalid responses, and leave expected no-endpoint pools empty. Include a live verification script that enforces the major-pool parser contract. The local migration was applied manually because the shared dev database contains an unrelated applied authz migration missing from this branch; no reset or destructive SQL was used.
Read MiningPool live gauges through an additive moneroService method and render them in the pool metrics profile and Monero network pool table. Keep the browser isolated from pool APIs and derive all output during SSR from PostgreSQL. Centralize the 24-hour freshness rule, use one render timestamp for sorting, totals, and cells, exclude P2Pool and solo miners from the tracked caption while retaining the P2Pool row with an explanatory tooltip, and localize the complete English, Portuguese, and Russian presentation.
Allow a five-minute forward clock-skew tolerance between the indexer and web hosts so newly persisted gauges remain visible, while still rejecting larger future timestamps. Only show the relative-update tooltip when the miner count itself is fresh, preventing stale no-data cards from displaying contradictory update metadata.
Add a per-pool completed-UTC-day share model and register a daily catch-up job after Monero attribution. Each day is written transactionally, includes zero rows for named pools and a residual unknown row, and recomputes a two-day overlap idempotently. Constrain attribution numerators to the exact canonical block hashes in each denominator day, which handles partial first-day MoneroBlock coverage without inflated shares. The migration is hand-authored additive SQL to preserve unmanaged pgvector HNSW indexes; pre/post index definitions matched and no Prisma schema diff, reset, or db push was used.
Read materialized daily pool shares through the Monero service and start the history query alongside current-window pool statistics so server rendering avoids an extra data-fetch waterfall. Add a dynamically loaded multi-series Chart.js view with deterministic pool ordering, a fixed percentage scale, localized controls and empty states, and a seven-completed-day honesty gate. Aggregate weekly, monthly, and yearly points from summed block counts and network denominators instead of averaging daily percentages. The database currently contains only two canonical history dates, so the page intentionally renders the localized warm-up state until real indexed history reaches the display threshold.
Add an additive GitHub health snapshot plus daily author-login and coverage fields so issue, pull-request, and maintainer metrics can be served entirely from PostgreSQL. Count open pull requests once per organization through the Search API, reuse owner and commit requests across duplicate chains, and extract linked non-bot authors from the commit payload the job already fetches. Existing repositories enter a bounded stale-first backfill, while partial pagination can update observed days without falsely advancing coverage. The migration is hand-authored and additive to preserve unmanaged HNSW indexes. Deterministic verification covers malformed and incomplete search results, bot filtering, author deduplication, partial commit pages, UTC windows, and the unique backfill limit.
Read persisted pull-request and issue snapshots alongside repository activity, and expose active maintainers only when every recently pushed repository has complete author coverage for the trailing 90-day window. Deduplicate linked author logins across repositories, preserve the existing activity-data consumers, and give the Developer Activity section one combined database read instead of sequential stats and chart queries. Render the seven metrics from a responsive data-driven list with keyboard-accessible explanations and localized English, Portuguese, and Russian labels. Until the indexer fills snapshots and coverage, the new values intentionally use the existing em-dash no-data state.
Move connected-miner and historical pool-dominance presentation out of the technical mining-pools table and into the existing PoW statistics composition. Reuse the established distribution rows, PassportRow health layout, subtitle, and window selector while preserving the DB-backed SSR data flow. Render developer health through the standard MetricsCardItem component in a responsive grid so seven values wrap predictably instead of stretching into a broken divider strip. Keep tooltip behavior on the existing shared tooltip component and move all affected localization keys with their owning views.
Add a clear responsive gap between the developer metric-card grid and its activity chart. Present per-pool connected-miner counts with the site's standard white Handjet numeric treatment so they read as first-class metrics beside pool dominance.
Use the same vertical padding and value spacing as the existing Commits p/month MetricsCardItem. Remove the custom minimum and title heights so the developer activity summary stays compact while retaining its responsive grid.
Replace the mining-pool profile's single-record networks read with a generic service that returns every verified row for the pool slug. Derive available windows from those rows and render one table row per chain with its own freshness-gated connected-miner value. Remove the miners card from pool Metrics and remove miners from network Stats so the profile Networks table is the sole presentation owner. Move the English, Portuguese, and Russian labels to that table while leaving indexer storage and service write paths unchanged.
Rename the development-health author union from maintainers to contributors and describe the metric honestly in every locale. Count unique linked GitHub commit authors across tracked repositories over the latest thirty fully indexed UTC days while continuing to exclude bot accounts. Allow a one-day ingestion lag by anchoring the rolling window to the latest common fetched-through date, but keep incomplete or older coverage as no-data. Align the daily GitHub author backfill with the thirty-day window and extend focused verification for deduplication, window boundaries, incomplete coverage, and stale coverage.
Add a localized tooltip clarifying that the displayed value is the highest total commit count for one tracked repository across all activity history currently stored in the index. Reuse the existing developer metric tooltip presentation without changing the calculation.
Resume daily-share materialization from the earliest canonical UTC day that has no stored rows instead of relying only on the latest stored date. This ensures a failed interior day is retried even when later per-day transactions succeeded. Ignore calendar days without canonical blocks and retain the existing two-day tail overlap for recent reorg recomputation. A live gap recovery populated July 11 with 400 reconciled blocks and 100 percent total share; a second run produced an identical snapshot.
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
Ships the Monero / PoW analytics slices from #642 that have a real data source, and triages the rest of the ideas list. All metrics are derived server-side from our own PostgreSQL (indexer → DB → service → SSR); no browser-side blockchain
or pool-API calls.
What this PR ships
Connected miners (T1) — per-pool live miner counts from the pool APIs, persisted as a freshness-gated gauge (
MiningPool.minersCount+minersUpdatedAt, hourly). Shown as a Miners column on the network mining-pools table with atracked-pools total. p2pool is labeled separately (sidechain participants, not stratum workers) and excluded from the total; nanopool has no stats endpoint → honest no-data; values older than 24h read as no-data.
Fee vs subsidy + tail emission security (T2) — fee share of miner revenue on the Stats tab and a tail-emission-security card on Tokenomics, both derived from the existing 24h
MoneroBlockreward aggregate (fees = max(0, reward − 0.6 XMR × blocks)). Reuses the same fee split as the avg-fee card so the two can't disagree.Pool dominance over time (T4) — new
MoneroPoolDailySharetable + a daily catch-up indexer job that materializes per-day, per-pool share (numerator = canonical block-hash attribution, denominator = canonicalMoneroBlock, unknown/solo= residual). Multi-series chart on the Stats tab, gated until ≥7 days of history. Job resumes from the first gap day, so a transient failure can't leave a permanent hole in the series.
Dev health (T3) — open PRs, PR-corrected open issues, and active maintainers (unique commit authors, 30d) on
/networks/{chain}/devfor all chains, fed by the existing daily GitHub job via the Search API (no per-repo fan-out).Data-honesty notes
open_issues_count); it's an approximation, forks can add small noise. Clamped ≥ 0.