Skip to content

Commit

Permalink
SONAR-23207 Fix telemetry metrics for Cpp autoconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
alain-kermis-sonarsource authored and sonartech committed Sep 30, 2024
1 parent e1b5c43 commit c9e5cb7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,17 +488,17 @@ private Set<ProjectData> insertProjects(int number) {
.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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ void getValues_whenCAndCppProjectsWithDifferentConfig_returnMapWithSize2AndNotAu
);
}

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 + "=" + 100);
}

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()));
}
}

0 comments on commit c9e5cb7

Please sign in to comment.