fix(dashboards): fix Grafana variable interpolation for string team/user IDs in MySQL dashboards
Summary
Fixes #8829
MySQL Grafana dashboards break when teams.id or users.id are
non-numeric strings (the schema allows varchar(255)). Grafana injects
$variable raw into SQL IN() clauses, so string values arrive
unquoted and the query fails.
Root Cause
The affected SQL patterns looked like:
-- before
where team_id in (${team1})
where t.name in (${team})
where ua.user_id in (${users})
Grafana's ${variable:singlequote} formatter wraps each value in
single quotes, making the query safe for string IDs. The PostgreSQL
variants of these dashboards already used this formatter; only the
MySQL variants were affected.
Changes
grafana/dashboards/mysql/work-logs.json
- Variable definition query:
${team:singlequote}for user dropdown - All 12 panel
rawSqlblocks:${users}→${users:singlequote}
grafana/dashboards/mysql/dora-by-team.json
- All occurrences of
${team}→${team:singlequote}across all panels (Deployment Frequency, Lead Time, Change Failure Rate, Recovery Time — both stat cards and monthly bar charts)
grafana/dashboards/mysql/engineering-throughput-and-cycle-time-team-view.json
- All occurrences of
${team1}/${team2}→${team1:singlequote}/${team2:singlequote}across all panels
Testing
Verified by inspecting all rawSql blocks in each affected file.
No changes to PostgreSQL dashboards (grafana/dashboards/postgresql/)
as they already use :singlequote throughout.
Hi @Startrekzky please review and merge pull request.