diff options
author | lukasz-jarocki-sonarsource <lukasz.jarocki@sonarsource.com> | 2023-11-03 14:54:02 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-11-08 20:02:52 +0000 |
commit | a4718d6858cc6e44080641cb1da4e8f5c9ee0762 (patch) | |
tree | d5bb8099dd7b17b949ede5653fd88bece45612b4 /server/sonar-webserver-core/src/main | |
parent | 5e1db2ab6fb799e34d8c83191253f1f9b02da58e (diff) | |
download | sonarqube-a4718d6858cc6e44080641cb1da4e8f5c9ee0762.tar.gz sonarqube-a4718d6858cc6e44080641cb1da4e8f5c9ee0762.zip |
SONAR-20892 Updated api/measures endpoints to return renamed metric
Diffstat (limited to 'server/sonar-webserver-core/src/main')
-rw-r--r-- | server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java index 238c97dd8f6..8afa7232280 100644 --- a/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java +++ b/server/sonar-webserver-core/src/main/java/org/sonar/server/startup/RegisterMetrics.java @@ -20,6 +20,7 @@ package org.sonar.server.startup; import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.FluentIterable; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,10 +36,11 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.metric.MetricDto; import org.sonar.server.metric.MetricToDto; +import org.springframework.beans.factory.annotation.Autowired; import static com.google.common.collect.FluentIterable.concat; import static com.google.common.collect.Lists.newArrayList; -import org.springframework.beans.factory.annotation.Autowired; +import static org.sonar.db.metric.RemovedMetricConverter.REMOVED_METRIC; public class RegisterMetrics implements Startable { @@ -65,7 +67,9 @@ public class RegisterMetrics implements Startable { @Override public void start() { - register(concat(CoreMetrics.getMetrics(), getPluginMetrics())); + FluentIterable<Metric> metricsToRegister = concat(CoreMetrics.getMetrics(), getPluginMetrics()) + .filter(m -> !REMOVED_METRIC.equals(m.getKey())); + register(metricsToRegister); } @Override |