aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-db-dao
diff options
context:
space:
mode:
authorAlain Kermis <alain.kermis@sonarsource.com>2024-09-27 12:13:01 +0200
committersonartech <sonartech@sonarsource.com>2024-09-27 20:02:48 +0000
commit1fb4fa71017a200b11e5234db82885eb88b72499 (patch)
tree21961ed757a771daba14b8f5be87488173b05e3a /server/sonar-db-dao
parent39a11ef5242225da28c51d97e08a06faf2b87dc1 (diff)
downloadsonarqube-1fb4fa71017a200b11e5234db82885eb88b72499.tar.gz
sonarqube-1fb4fa71017a200b11e5234db82885eb88b72499.zip
SONAR-23207 Fix telemetry metrics for Cpp autoconfig
Diffstat (limited to 'server/sonar-db-dao')
-rw-r--r--server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java6
-rw-r--r--server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml12
2 files changed, 10 insertions, 8 deletions
diff --git a/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java
index 6209b00b976..3f4003019cf 100644
--- a/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java
+++ b/server/sonar-db-dao/src/it/java/org/sonar/db/project/ProjectDaoIT.java
@@ -488,17 +488,17 @@ class ProjectDaoIT {
.collect(Collectors.toSet());
}
- private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ProjectDto project, ComponentDto componentDto) {
+ private Consumer<LiveMeasureDto> configureLiveMeasure(String language, MetricDto metric, ComponentDto componentDto) {
return liveMeasure -> liveMeasure
.setMetricUuid(metric.getUuid())
.setComponentUuid(componentDto.uuid())
- .setProjectUuid(project.getUuid())
+ .setProjectUuid(componentDto.uuid())
.setData(language + "=" + random.nextInt(10));
}
private Consumer<ProjectData> insertLiveMeasure(String language, MetricDto metric) {
return (projectData) -> db.measures().insertLiveMeasure(projectData.getMainBranchComponent(), metric,
- configureLiveMeasure(language, metric, projectData.getProjectDto(), projectData.getMainBranchComponent()));
+ configureLiveMeasure(language, metric, projectData.getMainBranchComponent()));
}
private void insertProjectsLiveMeasures(String language, Set<ProjectData> projects) {
diff --git a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
index abfd58f2f88..575a4356117 100644
--- a/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
+++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/project/ProjectMapper.xml
@@ -129,15 +129,15 @@
<select id="selectProjectUuidsAssociatedToDefaultQualityProfileByLanguage" parameterType="map" resultType="string">
select
- lm.project_uuid
+ p.uuid
from
live_measures lm
inner join
- projects p on p.uuid = lm.project_uuid
+ project_branches pb on pb.uuid = lm.component_uuid
inner join
- metrics m on m.uuid = lm.metric_uuid
+ projects p on p.uuid = pb.project_uuid
inner join
- project_branches pb on pb.uuid = lm.component_uuid
+ metrics m on m.uuid = lm.metric_uuid
where
m.name = 'ncloc_language_distribution'
and pb.is_main = ${_true}
@@ -154,7 +154,9 @@
from
live_measures lm
inner join
- projects p on p.uuid = lm.project_uuid
+ project_branches pb on pb.uuid = lm.project_uuid and pb.is_main = ${_true}
+ inner join
+ projects p on p.uuid = pb.project_uuid
inner join
metrics m on m.uuid = lm.metric_uuid
where