This Python project generates a dashboard and CSV report that show how many subgraphs are deployed per network on The Graph Network. It includes time-based metrics, daily snapshots, and a modern, responsive HTML interface.
Live Dashboard:
🔗 graphtools.pro/network
🧪 This dashboard is part of Graph Tools Pro, a community-driven initiative to provide useful, independent analytics tools for The Graph ecosystem.
- Daily fetch of subgraph counts per network
- HTML dashboard with light/dark theme
- # rank counter column showing each chain's position
- Top-20 default view with a "Show All / Show Less" toggle button
- Sortable columns — clicking any column header re-sorts and renumbers the rank column
- CSV export of all network counts
- 24-hour delta tracking (if yesterday's snapshot exists)
- Custom network logos
- JSON snapshot stored daily with timestamp and counts
- Full logs of script runs
📦 network/
├── 📜 fetch_network_metrics.py # Main script
├── 📜 .env # Environment variables (not tracked)
├── 📂 logs/ # Timestamped log files
└── 📂 reports/
├── 📜 index.html # Rendered dashboard
├── 📜 network_subgraph_counts.csv # CSV report
├── 📂 images/ # Network logos + social card
│ └── 📜 social-card.png # OG/Twitter share image (1200×630)
└── 📂 metrics/ # JSON metric snapshots per day
- Install dependencies:
pip install requests python-dotenv- Create a
.envfile:
GRAPH_API_KEY=your_graph_api_key- Run the script:
python fetch_network_metrics.py- Open
reports/index.htmlin your browser to view the dashboard.
Bug fixes (10 issues resolved):
- Unhandled network exceptions —
requests.post()now wrapped in try/except; connection errors and timeouts are logged and return an empty result instead of crashing - Unhandled
JSONDecodeError—response.json()now guarded; non-JSON gateway responses (e.g. HTML error pages) are caught and logged - Partial data on HTTP error — HTTP non-200 now returns
[]instead of silently returning however many rows had been fetched before the failure total_subgraphs_yesterdayinconsistent state — bothtotal_subgraphs_yesterdayandyesterday_network_countsare now reset toNonein the except block- Zero baseline treated as valid delta — a missing
total_subgraphskey in yesterday's snapshot no longer produces a misleading "all subgraphs gained" delta;0is now treated asNone - Timestamp computed at import time —
timestampis now computed insidesave_subgraph_counts_to_html()so the HTML reflects the actual write time, not script-start time - Network logo outside anchor tag — the network logo
<img>was before the<a>, so clicking it did nothing; it is now inside the anchor - Sort comparator broken for equal values —
? 1 : -1always returned-1for ties, producing unstable ordering; replaced withaVal - bVal(numeric) andlocaleCompare(text) log_fileundefined when API key guard fires — directory and log-file setup now runs before theGRAPH_API_KEYcheck, so the error can be logged properly- HTTP errors logged without detail — error log now includes the HTTP status code and the first 500 chars of the response body
- Version bump; all v1.1.0 features and fixes consolidated into a stable release
- Added
#rank counter column (first column in the table) - Default view shows only the top 20 chains; a Show All / Show Less button reveals the full list
- Sorting any column now renumbers the
#column and reapplies the top-20 visibility - Footer now spans the full window width with no word wrap
- Updated footer to flex-row layout with version string and GitHub SVG icon
- Added dedicated social card image (
social-card.png, 1200×630) wired into all OG/X meta tags - Added
METRIC_SNAPSHOT_MINUTEenv var — schedule time now displays as6:30aminstead of6am - Removed version string from the "Generated on" subtitle
- Fixed and expanded social card meta tags (Open Graph + X/Twitter) for correct sharing on all platforms
- Removed stale
old.pyand untracked.DS_Storefiles from the repo
Bug fixes:
- Added
GRAPH_API_KEYguard — script now raises a clear error instead of silently embeddingNonein the API URL - Fixed wrong logo for Sonic network (was incorrectly using
abstract.png) - Removed dead
SUBGRAPH_URLconstant and unusedNetworkSubgraphCountdataclass + import - Fixed JS
TypeErroron page load —getElementById('themeToggle')returnednull; added null guard - Fixed
isNumericinsortTable— Var (24h) column was excluded from numeric sort - Fixed hardcoded
7amin the HTML subtitle — now correctly reads fromMETRIC_SNAPSHOT_HOUR - Synced Python template with manually added
#column header andshow-allCSS/JS so the next script run no longer wipes those features - Fixed loose JS comparison
!=→ strict!==
- Initial public release with per-network subgraph counts, 24h delta, unique indexers, light/dark theme, CSV export, and daily JSON snapshots
- 🧠 The Graph
- 🧩 Python 3.x, HTML5 + CSS
- ⚙️ Data sorting and light/dark theming via vanilla JavaScript