LStrike
LStrike

Reputation: 1648

Sonar database structure & sonar api metrics

I have two questions regarding sonar:

  1. I have taken a look at the database of sonar. I was wondering where sonar stores the results of each measurement?

    I found only the table measure_data, but the field data looks to me like a has value. Can anyone tell me where sonar stores the data of all measurements?

    Yes I know, that it is better to use the REST API, and I will do it, but I also want to know, how the database is used by sonar itself.

  2. Is there a way by using the API to get a full list of all used metrics?

Upvotes: 5

Views: 1862

Answers (2)

LStrike
LStrike

Reputation: 1648

I figured question number 2 out:

List<Metric> smq = sonar.findAll(MetricQuery.all());
    System.out.println(smq);

    for(int i = 0; i< smq.size(); i++){
       System.out.println(smq.get(i));
    }

Upvotes: 1

I won't answer the first question as Sonar DB is not an API and might change at any point of time.

For your second question: the WS you're looking for is the "/api/metrics" WS. For instance, you can see all the metrics that are registered on Nemo - our Sonar live instance, here: http://nemo.sonarsource.org/api/metrics

Upvotes: 0

Related Questions