Custom Metrics / Measurements

Environment:

  • SonarQube 10.6
  • SonarScanner
  • GitHub Actions

Help with Custom Metrics

Where do I see metrics like Java version which I add to the sonar scanner -Dsonar.java.version=11 -Dsonar.java.builder=Gradle -Dsonar.java.builder.version=8.8?
I really would like to have custom metrics, so that I can easily compare these metrics via API against the EOL API

Hi,

Welcome to the community!

These analysis parameter values aren’t stored. They’re used during analysis and then discarded.

If you’d like custom values stored with the analysis, you can use sonar.analysis.<key>=<value>, altho values passed this way are not considereds “metrics”. Explicitly, you won’t be able to query them with metric/measure-related APIs, but instead with analysis-related APIs.

 
HTH,
Ann

Hey, cool approach, but it’s not working :frowning:
I used -Dsonar.analysis.javaBuilder=Gradle -Dsonar.analysis.javaVersion=8 -Dsonar.analysis.javaBuilderVersion=6.5.1 and it’s not working as it is described in the documentation using this property in the command line may not work. :frowning:

Hi,

Have you tried it not on the commandline?

 
Ann

Yes Command Line via GitHub Actions