Skip to content

[grafana] Dashboard validation uses only python3 json.tool — Grafana schema and PromQL syntax not verified #285

@obchain

Description

@obchain

Refs #54

Location

PR #54 test plan: "python3 -m json.tool parses, schema v39 (Grafana 10.4+)"

Problem

python3 -m json.tool only validates that the file is syntactically valid JSON. It does not validate:

  • Whether panel types, target fields, and datasource refs conform to Grafana's schema
  • Whether PromQL expressions are syntactically valid
  • Whether template variable queries are well-formed
  • Whether schemaVersion 39 features are used correctly

A dashboard JSON that passes json.tool can still fail to import, silently drop panels, or render incorrectly.

Impact

The test plan provides no confidence that the dashboard is importable or correct. Any schema regression in future edits will not be caught in CI.

Suggested Fix

  1. Add a CI step using grafana-dashboard-checker (grafana/dashboard-linter) to validate panel schema and PromQL syntax.
  2. Alternatively, add a docker-based smoke test in scripts/ that spins up Grafana 10.4.x and imports the JSON via the Grafana API, asserting a 200 response.
  3. At minimum, validate PromQL syntax using promtool check rules or a PromQL parser as a linting step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:devopsCI / deploy / infra / telemetrypriority:p2-polishNice-to-have / polishstatus:readyScoped and ready to pick uptype:testTests, fuzz, fork, integration

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions