LOC analyzed showing up incorrect after upgrade 8.8 -> 8.9 -> 9.9

  1. What version are you upgrading from?
  • The upgrade process was from version 8.8 to version 8.9, finally to 9.9
  1. System information:
  • sonarqube 9.9.1-developer running with docker-compose (I can provide the docker-compose.yml but at this point I see no benefit in that).
  • Ubuntu 20.04 64-Bit
  • containerd 1.6.21
  • docker 24.02
  • docker-compose 1.29.0
  • postgres 12
  1. What’s the issue you’re facing?
    After doing a “staging” upgrade on a cloned instance of the productive sonarqube instance (cloned the virtual machine in VMware vCenter) and doing the real upgrade of the productive instance, the “License Manager” in admin configuration section displays a much higher “lines currently analyzed” number then before the upgrade (around two times the original value).
    The value showing before the upgrade was around 480k LOC, this I know for sure, because at that point we had the 500K license active and luckily because of being close to the limit, we updated our license to the 1M developer license.
    The interesting part is that in the cloned instance the “lines currently analyzed” value was around the previous 480k value, so apparently counting correctly.

  2. What I did so far, to try solving the issue:

  • powering off the clone and restarting the original/productive instance of sonarqube → no change in LOC count
  • powering the clone back on and removing/deleting all projects, the “lines currently analyzed” value in the clone was then showing 0 (zero)


Welcome to the community!

In 9.9.1 there’s an API called api/projects/license_usage. It will give you your list of projects, along with each one’s largest branch and how many license-loc it’s using.

I think that’s your starting place. Pull those results and make sure that what you see there makes sense to you.


Hi Ann,

thank you very much for your reply.

I’m going to check on that API endpoint you mentioned and report my findings here then.


1 Like

So after checking on the API it looks like we are actually using 732943 LOC of our license, attached there is a textfile which contains the values of the “linesOfCode” key from each project.

Thanks again Ann now I am able to see which projects use the most LOC and have an easy way to accurately show the LOC per project.

loc.txt (319 Bytes)

1 Like