sync-dashboards
Installation
SKILL.md
You maintain the consistency between the MegaLinter observability payload and the provider dashboards.
The contract
- Producer:
megalinter/reporters/ApiReporter.pybuilds the v2 payload (run-level KPIs incl.qualityGateStatusand the 0-100healthScore, per-linter records, SARIF-derivedrulesBreakdown/filesBreakdown);megalinter/api_providers/ApiProvider.pydefines the metric fields (run_metric_fields,linter_metric_fields) and eachApiProvider*subclass maps them to its backend (Prometheus/Loki, Datadog, Elastic, New Relic). - Contract file:
.automation/dashboard_builders/contract.pylists the same fields, labels (base + run-levelmegalinterVersion/megalinterFlavor), record types and metric name prefixes. - Consumers: the
DashboardBuilder*classes in.automation/dashboard_builders/generatedocs/dashboards/(Grafana JSON, Datadog JSON, New Relic JSON, Kibana ndjson +manifest.json).
Dashboard design invariants (keep them when editing)
- Fleet-to-detail navigation: Grafana org table/charts carry data links to the Repository dashboard (
var-repo), which links to Linter Detail (var-linter); Datadog uses thegit_repo_name/git_branch_nametemplate variables +__SELF_URL__custom links (substituted by the uploader); New Relic has Repository/Branch NRQL variables, a "Repository detail" page and facet links (__REPOSITORY_DETAIL_PAGE_GUID__, substituted by the uploader's second pass); Kibana relies on native click-to-filter. - Branch filtering must stay available on every platform (Grafana
$branch, Datadog$git_branch_name, New Relic{{gitBranchName}}with%default, Kibana filter bar). - Rating drill-down: every rating (A-E) tile leads to a "Why this rating?" explanation — Grafana dedicated dashboard (uid
megalinter-rating, linked from the rating stats), New Relic dedicated page (facet-linkable via the__RATING_PAGE_GUID__marker), Datadog group widget, Elastic markdown + breakdown panels. It must always show: the formula, linters success/warning/error counts, and the linters dragging the score down. - Derived KPIs: the A-E rating is a dashboard-side range mapping of
healthScore(A>=90, B>=80, C>=65, D>=50, else E); "time saved" istotalErrorsFixed * 5minutes — keep formulas consistent across providers and documented indocs/observability.md. - Agnostic dashboards: no account ids, datasource uids, or instance URLs hardcoded in generated files — placeholders are resolved by
mega-linter-runner/lib/upload-dashboards.jsat upload time so anyone can provision them on their own account. - Value-conditional styling: KPIs are colored by value on every platform — Grafana thresholds/background stat tiles/color-background table cells/threshold-zone areas, Datadog
conditional_formats+ semantic timeseries palettes (warm=errors, cool=health, purple=duration), New Relic billboardthresholds+ fixed series colors (Blocking=red, Non-blocking=yellow), Kibana Lens custom palettes on metric panels. Keep the semantics: green=good, yellow=warning, red=blocking, blue=neutral/informative. - Cardinality:
runId,jobUrl, rule ids and file paths never become metric tags or Loki stream labels.