Grafana + Prometheus Exporter #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally filed by @coilysiren on 2026-05-02T23:09:29Z - https://github.com/coilysiren/eco-mcp-app/issues/10
Task 1 - Grafana + Prometheus Exporter
Prereq when starting: read
todo/README.mdfirst. Also read/Users/kai/projects/coilysiren/kai-serverfor cluster conventions - Claude can't run write-kubectl directly, GH Actions → cluster is the path. For the dashboard half, read/Users/kai/projects/coilysiren/infrastructure/terraform/grafana/README.md.Goal
Build a Prometheus exporter for the Eco server and a Grafana dashboard that renders snapshots via an MCP tool.
Endpoints to scrape (every 30 s — do not go faster)
Public:
GET /infoGET /datasets/flatlist(one-time at startup to discover stat names) +GET /datasets/get?dataset=X&dayStart=0&dayEnd=<now>for ~15 chosen stats./datasets/flatlist(verified):PayWages,RepaidLoanOrBond,DefaultedOnLoanOrBond,PostedContract,CompletedContract,PropertyTransfer,ReputationTransfer,TransferMoney,PayTax,SettlementFounded,BecomeCitizen,ItemCraftedAction,ChopTree,HarvestOrHunt. Do NOT tryTotalCultureas a dataset — it's only a/infofield and/datasets/get?dataset=TotalCulturereturns 500.online_players,days_running(from/info).Admin (
X-API-Keyfrom SSM/eco-mcp-app/api-admin-token, regionus-east-1):GET /api/v1/users?hoursPlayedGte=0Deliverables
New top-level directory
exporter/with a Python/metricsendpoint usingprometheus_client:_totalsuffix) for cumulative event series (wages paid, contracts completed).exporter/Dockerfile+ k3s manifest atdeploy/exporter.yml, matching thebackendrepo deploy pattern. See/Users/kai/projects/coilysiren/backendfor the canonical rig (Dockerfile shape, Makefile targets, GH Actions publish, Traefik ingress). Add a vmagent scrape config for the exporter's/metricsendpoint toinfrastructure/deploy/observability/vmagent-values.yml(cross-repo edit; commit there separately).Grafana dashboard YAML at
infrastructure/terraform/grafana/dashboards/eco-mcp.yaml(NOT in this repo) with panels:ItemCraftedActiondelta)Wire it up by adding a
grafana_dashboardresource ininfrastructure/terraform/grafana/dashboards.tfand runninginv k8s.terraform-grafana --action applyfrominfrastructure/. UID:eco-mcp. Datasource:VictoriaMetrics.New MCP tool
get_grafana_snapshot(panel_id)insrc/eco_mcp_app/server.pythat calls Grafana's/renderAPI and inlines the resulting PNG as a data URI in an iframe card (CSP, perclaude-ai-mcp#40).Constraints
deploy/main.yml.yamldecode+jsonencodein terraform. Don't author it as raw JSON.Acceptance
players_onlineand at least one counter series.observabilitynamespace successfully scrapes the new exporter (scrape_samples_scraped > 0for the new job).terraform planfrominfrastructure/terraform/grafana/shows the new dashboard resource cleanly;applylands it in Grafana with the correct datasource.inv smoke.