Must-share information (formatted with Markdown):
-
which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
SonarQube Enterprise Edition 8.9.2 LTS -
what are you trying to achieve
Retrieve values of metrics on new code using/api/measures/search_history
-
what have you tried so far to achieve this
https://<sonarqube-server>/api/measures/search_history?component=<project-key>&from=2021-10-13T14:47:51%2B0200&to=2021-10-13T14:47:51%2B0200&metrics=new_coverage,new_maintainability_rating,new_reliability_rating,new_security_rating,new_duplicated_lines_density,coverage,major_violations,critical_violations,blocker_violations,test_errors,test_failures
Calling the URL above will return the JSON response below. Note that metrics on new code won’t return any value. Is this the expected behavior? Are metrics on new code not stored in the history?
{"paging":{"pageIndex":1,"pageSize":100,"total":1},"measures":[{"metric":"test_errors","history":[{"date":"2021-10-13T14:47:51+0200","value":"0"}]},{"metric":"test_failures","history":[{"date":"2021-10-13T14:47:51+0200","value":"0"}]},{"metric":"coverage","history":[{"date":"2021-10-13T14:47:51+0200","value":"86.9"}]},{"metric":"new_coverage","history":[{"date":"2021-10-13T14:47:51+0200"}]},{"metric":"blocker_violations","history":[{"date":"2021-10-13T14:47:51+0200","value":"0"}]},{"metric":"critical_violations","history":[{"date":"2021-10-13T14:47:51+0200","value":"0"}]},{"metric":"major_violations","history":[{"date":"2021-10-13T14:47:51+0200","value":"87"}]},{"metric":"new_duplicated_lines_density","history":[{"date":"2021-10-13T14:47:51+0200"}]},{"metric":"new_maintainability_rating","history":[{"date":"2021-10-13T14:47:51+0200"}]},{"metric":"new_reliability_rating","history":[{"date":"2021-10-13T14:47:51+0200"}]},{"metric":"new_security_rating","history":[{"date":"2021-10-13T14:47:51+0200"}]}]}