A Background Task can be:
- the import of an Analysis Report
- the execution of the computation of Views
Note that analysis is not complete until the relevant Background Task has been completed. Even though the SonarQube Scanner's log shows
EXECUTION SUCCESS, the analysis results will not be visible in the SonarQube project until after the Background Task has been completed.
After one of the SonarQube Scanners has finished analyzing your code, the result of this analysis (Sources, Issues, Metrics), which is called the Analysis Report, is sent to SonarQube Server for final processing. Those Analysis Reports are queued and processed serially.
Administrators can view the current queue at Administration > Projects > Background Tasks.
You can filter Background Tasks according to their state: Success, Failed or Canceled
The "Only Latest Analysis" button will filter the Background Tasks by showing only the last import for each project.
You can also filter Background Tasks according to the starting date of import :
- "Today" shows only the import the Analysis Reports of the day
- "Any Date" removes any date filters
- "Custom" allows you to choose a date range
At the top of the page, are there are two to three counters:
- pending - shows the number of Analysis Reports queued and waiting to be processed. Only one Analysis Report can be processed at a time.
- failures shows the number of projects where the processing of a project's most recent analysis report failed.
- the third counter is only present during the processing of an analysis report. It shows the duration-to-date of the task currently being processed.
At the Project Dashboard level, when there is a pending Analysis Report waiting to be consumed, you have a notification in the header:
The Background Task being processing is marked with a rolling "wait" icon, and you can see the current duration:
You can cancel the handling of a task by clicking :
- on the red 'x' available on each line of a pending task
- on the red "bulk cancel" option next to the pending jobs count. This button cancels all pending tasks.
For each Analysis Report in process, failed or successfully imported, you can view the logs of the import by clicking on the "Logs" link on the row.
By default, you will see in the logs of the Analysis Report import :
- Active plugins and their versions at the moment where you ran the analysis
- Effective SonarQube properties used to run the analysis. It's basically the content of sonar-project.properties if you are analyzing with SonarQube Scanner.
- Details about the import of the report
If you want more information, set
sonar.verbose=true to activate the DEBUG mode when running your analysis. See Analysis Parameters Analysis Logging for more details.
You can tune the number of task logs to keep for a given project in General > General > Compute Engine Log Retention. The default value is 10.
Logs are kept for a (non-configurable) maximum of six months. This is likely to change in future versions.
Execution logs of Background Tasks are stored in $SONARQUBE_HOME/data/ce/logs/REPORT
The Background Tasks page allows you also to follow other task executions such as, for example, Views Computation triggered by the Views Plugin.