Skip to end of metadata
Go to start of metadata

Table of Contents

Introduction

One of the most powerful features of SonarQube is that it shows you not just your project health today, but how it has changed over time. It does that by selectively keeping data from previous analyses. It doesn't keep all previous analyses - that would bloat the database. Similarly, for the analyses it does keep, SonarQube doesn't keep all the data. Once a project snapshot moves from the the "Last analysis" (i.e. the most recent) to being part of the project's history, data below the project level is purged - again to keep from bloating the database.

Typically these aren't things you need to even think about; SonarQube just handles them for you. But occasionally you may need to remove a bad snapshot from a project's history or change the housekeeping algorithms. 

Events

Every snapshot with an event is ignored by the housekeeping algorithms, and retained indefinitely in the database. There are four types of events:

  • Quality Gate - the status of the quality gate changed.
  • Profile - the quality profile used to analyze the project changed - either the profile was edited, or a different profile was used to analyze the project.
  • Version - the project's version changed.
  • Other - an event was manually created on a snapshot. See Managing History, below.

All events are indicated in the Timeline widget. Version events are used by the History Table widget.

Housekeeping

As previously mentioned, when you run a new analysis of your project, some data that was previously available is cleaned out of the database. For example the source code of the previous analysis, measures at directory and file levels, and so on are automatically be removed at the end of a new analysis. Additional, some old analysis snapshots are also removed.

It is useful to analyze a project frequently to see how its quality evolves. It is also useful to be able to see the trends over weeks, months, years. But when you look back in time, you don't really need the same level of detail as you do for the project's current state. To save space and to improve overall performance, the Database Cleaner deletes some rows in the database. Here is its default configuration:

  • All data older than 5 years old are deleted
  • For each project:
    • only one analysis per month is kept after 1 year
    • only one analysis per week is kept after 1 month
    • only one analysis per day is kept after 1 day
  • All closed issues more than 30 days old are deleted
  • History at package/directory level is not kept
  • Snapshots that include an event (new project version, new quality profile version, etc.) are not deleted

These settings can be changed at Settings > General Settings > General > Database Cleaner.

Managing History

Occasionally, you may need to manually delete a project snapshot, whether because the wrong quality profile was used, or because there was a problem with analysis, and so on. Note that the most recent snapshot (labeled "Last snapshot") can never be deleted.

About deleting snapshots

Icon

Deleting a snapshot is a 2-step process:

  • The snapshot must first be removed from the project history by clicking on Delete snapshot. It won't be displayed anymore on this History page but will still be present in the database.
  • The snapshot is actually deleted during the next project analysis.

At project level, go to Configuration > History.

For every snapshot, it is possible to manually:

  • Add, rename or remove a version
  • Add, rename or remove an event

See also

 

 

  • No labels