Clarification on License Usage Metrics and Endpoint Discrepancies

Enterprise Edition v2025.1 (102418)

ACTIVE - Standard Experience

My team is currently working on internal structures to monitor our license usage more closely, given the high number of components we manage. During this process, we encountered some inconsistencies that we would appreciate your clarification on.

When using endpoint X (detailed below), we receive a JSON file with license consumption details per project. However, summing project[“linesOfCode”] across all returned projects results in a discrepancy of over 150K lines compared to the total shown in the license endpoint Y.

Also, out of over N projects registered in our Sonar instance, only about N/2 are returned by endpoint X. Initially, we assumed this was due to many projects being empty (not analyzed, created through APIs), but even after accounting for that, over 100 empty projects are still missing from the count. We assumed that only already analyzed components were counted in endpoint Y, but we have not received clarification on the criteria for a component to appear in the response from endpoint X.

Given this, we would like to ask:

  1. How can we gain real-time visibility into our license usage without relying solely on endpoint Y? Isn’t there any view that offer a individual component perspective?
  2. What are the exact criteria for a component to be included in the list returned by endpoint X?
  3. For license enforcement purposes, which value is used: the sum of linesOfCode from endpoint X, or the total shown in endpoint Y?

We appreciate your support in helping us better understand and manage our license usage.

Endpoint X: api/projects/license_usage
Endpoint Y: api/editions/show_license

I just hit GET api/projects/license_usage on one of our internal instances and I’m also seeing only a selection of projects returned. That’s now how it should work – all projects should be returned. I’m flagging this for the team as a bug!

When everything is working correctly, the sum of linesOfCode returned by Endpoint X should equal Endpoint Y.

1 Like

Okay, thanks Colin. Which endpoint should we use until the bug is fixed?

Hello @balbi_andre thanks for raising this.
For license enforcement purposes, the value returned from endpoint Y is the one used.
The endpoint X when introduced was based on a much more expensive database query, and it is supposed to provide the correct values project by project.

While checking the endpoint for version 2025.1 I noticed that its logic was changed in order to make it faster, I will check in details how projects can be filtered out from the response.
Because that was not the behavior when the endpoint was initially introduced.

I will check this internally with the squad that worked on the updated logic and I will come back to you.