Sonaqube usage for last 6months time


(Yash Brahmani) #1

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonaqube 6.7
  • what are you trying to achieve
    To know how much LOC was analysed for the last 6months on a specific sonarqube instance.
  • what have you tried so far to achieve this
    Looking for an API to grab the LOC from 200 SONARQUBE INSTANCE and also how it is been used by users.
    I want to get the stats.
    Is it possible?

(Yash Brahmani) #2

Is there a way we can find out as to whether the users are actively using the sonar instances or it is just ideal.
I want to analysed the data for past 6months. How can I do so?


(G Ann Campbell) #3

Hi,

It’s not entirely clear to me which historical data you want, but in general I can say that SonarQube is focused on “now” and not architected to make a historical usage audit easy.

That said, “actively using the… instances” can be interpreted multiple ways. My CI chain can be configured to automatically analyze every commit, but if no one ever looks at the results, is that “using” it? If this is your definition of “using” then you can look at projects’ analyses histories (the project Activity page) to see analysis frequency, subject to Housekeeping.

Conversely, I might be actively browsing issues from the last analysis, but that analysis could be months old. This use is going to be harder to trace since I’m told the access logs aren’t straightforward to parse.

A third case is that I’m using SonarLint in connected mode and/or PR analysis to make sure no new issues are committed into master, without ever pointing my browser to SQ. Is that “using”? (Same comment as above about parsing the access logs).

What if SonarLint isn’t in connected mode? (Okay, nevermind. That one’s probably not “using” the SonarQube instance.)

You haven’t mentioned your underlying motivation but I feel it’s relevant mention that starting in 7.7, instance admins will be able to see the last time each user logged in (SONAR-5611).

 
Ann


(Yash Brahmani) #4

Hello Gann,
Thank you for the reply.
Since we are hosting 200 sonar instances we wanted to understand as to whether our users are using it or not. Instead of manually going into each instance and analysis history is there a way we could get the last access date of the instance such that we can come to a conclusion as to whether the instance are in use or no.

Also on the other hand, is there a way we can get the current LOC which is been analysed by each instance till date. Do we have any API call using which we can grab the consumed LOC details?

Regards,
Yash Brahmani


(G Ann Campbell) #5

Hi Yash,

Again, this is problematic, but I supposed you could get some very raw data from each instance’s access log. Since analysis uses web services to get the basic data it needs and to submit the analysis report at the end, the access log will reflect both analysis and human browsing, as well as requests from connected SonarLint instances. But you may be able to get some gauge based on the most recent access in the logs and on how quickly those logs roll.

 
Ann


(Yash Brahmani) #6

Thanks Gann for the info.