Skip to content

Provision a Grafana datasource for AMS's local SQLite ledgers (attempt log + prediction ledger) #5184

Description

@JSONbored

Context

grafana/provisioning/datasources/ already wires up scrape-free datasources for ORB's local usage data (e.g. the codex-usage.json-style entry using the frser-sqlite-datasource plugin), but nothing there points at AMS's own local SQLite files. AMS maintains an append-only attempt-log SQLite file and a prediction-ledger SQLite file under packages/gittensory-miner, and neither is exposed to Grafana today. This issue is pure config wiring — it is explicitly distinct from #4838 (wiring the Prometheus renderer into a command) and #4839 (giving AMS its own metrics/tracing surface), neither of which is scoped to author Grafana provisioning YAML.

Dependencies

None — independently shippable. Per the candidate spec, this unblocks a follow-on AMS usage dashboard without needing #4838's or #4839's live metrics/tracing surface to land first. Note: the sibling dashboard issue in this same batch ("Add a Grafana dashboard for coding-agent-driver usage, cost, and attempt outcomes") depends on this issue landing first, since its panels query this datasource.

Requirements

  1. Add new datasource provisioning entry/entries under grafana/provisioning/datasources/ using the frser-sqlite-datasource plugin, mirroring the existing scrape-free pattern already used for ORB's usage datasources (e.g. codex-usage.json).
  2. Point the new datasource(s) at AMS's local append-only attempt-log SQLite file and its prediction-ledger SQLite file (both under packages/gittensory-miner's local ledger storage).
  3. This issue is read-only datasource wiring only — do not author any dashboard panels or queries in this PR; that is explicitly out of scope and belongs to the follow-on dashboard issue.
  4. Do not modify any existing ORB datasource provisioning files (e.g. codex-usage.json) — this change must be purely additive.
  5. Follow the naming/UID conventions already used by sibling datasource files so Grafana provisioning does not collide with existing entries.
  6. Document how an operator points the datasource's file path at their actual local ledger file location, since the absolute path varies per install (add this to existing self-host/observability docs if such a doc exists, otherwise as inline comments in the provisioning file).

Deliverables / Acceptance Criteria

  • New datasource file(s) added under grafana/provisioning/datasources/ for the attempt-log SQLite file
  • New datasource file(s) added under grafana/provisioning/datasources/ for the prediction-ledger SQLite file
  • Both use the frser-sqlite-datasource plugin and mirror the existing scrape-free pattern
  • No existing ORB datasource provisioning files modified
  • Path-configuration guidance documented for operators

Test Coverage Requirements

This PR must ship with full test coverage for every changed line and branch — the repo's Codecov patch gate requires 99%+ coverage and the house standard is to aim for 100%, including both sides of every conditional/nullish-coalescing branch introduced. The datasource provisioning files themselves are YAML/JSON config under grafana/provisioning/, not src/**, so Codecov's gate does not directly instrument them — but any config-loading or path-resolution helper this issue adds under src/** must still hit the 99%+ bar, covering both the path-exists and path-missing branches. Add: (1) unit tests for any new path-resolution/config-generation logic covering both the success path (ledger file found) and failure path (ledger file missing or unreadable), (2) an invariant test asserting the new datasource config is read-only and never grants write access to the underlying SQLite files, and (3) no regression test applies since this is new functionality, not a bug fix.

Expected Outcome

An operator running Grafana alongside AMS can see the miner's attempt-log and prediction-ledger data as first-class Grafana datasources, which the follow-on usage dashboard can then query directly — without needing AMS's full metrics/tracing surface to exist first.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:featureGittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions