Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65692

URL Used to Retrieve Issues Metrics may not be correct

XMLWordPrintable

    • 3.0.2

      private static final String SONAR_ISSUES_BASE_URL = "/api/issues/search?ps=1&projectKeys=";

      I don't believe this URL is getting what you expect.  It returns the total number of issues in the entire sonarqube system whether you have the projectKeys request parameter or not.

      I believe to get the issues by project you need the following:
      $sonarurl="${SonarHostUrl}api/measures/component?metricKeys=code_smells,ncloc,duplicated_lines_density,open_issues,sqale_rating,critical_violations,blocker_violations,major_violations,vulnerabilities,complexity,sqale_index,sqale_debt_ratio,violations&component=$SonarProjectKey"
       
      You have to specify the metrics you want returned
       
      Then on the returned JSON, you need to get:

      $sonmeasures=$sonresult.component.measures
      This object will contain the metrics only for the project you are looking for.
       
      I'd be happy to talk further if anything isn't clear.  I love this plugin, btw.  Makes our grafana dashboards very helpful.
       

            aleksisimell Aleksi Simell
            cburne Christian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: