Skip to content

fix(sonarqube): correct aggregate coverage formula in Grafana dashboards#8997

Open
bramhanandlingala wants to merge 1 commit into
apache:mainfrom
bramhanandlingala:fix/#8973
Open

fix(sonarqube): correct aggregate coverage formula in Grafana dashboards#8997
bramhanandlingala wants to merge 1 commit into
apache:mainfrom
bramhanandlingala:fix/#8973

Conversation

@bramhanandlingala

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes the SonarQube Grafana dashboard "Test" panel, which showed a
coverage percentage that didn't match SonarQube's own reported
coverage for the project.

Root cause

The panel recalculated coverage from raw line counts
(lines_to_cover / uncovered_lines), which only accounts for line
coverage and ignores condition coverage. SonarQube's real coverage
metric is already collected correctly per file in
cq_file_metrics.coverage — the dashboard just wasn't using it.

Fix

Changed the panel query to use a weighted average of the existing
coverage column (weighted by lines_to_cover) instead of
recomputing it from scratch.9

Fixes #8973

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.

[Question][Module Name] Sonarqube Version 10.x Support

1 participant