Skip to content

fix(dashboards): fix Grafana variable interpolation for string team/user IDs in MySQL dashboards#8926

Open
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8829
Open

fix(dashboards): fix Grafana variable interpolation for string team/user IDs in MySQL dashboards#8926
bujjibabukatta wants to merge 1 commit into
apache:mainfrom
bujjibabukatta:fix/#8829

Conversation

@bujjibabukatta

Copy link
Copy Markdown
Contributor

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 rawSql blocks: ${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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Grafana] team-related dashboards are failing with non-numeric IDs

1 participant